blob: fee70db87ec594ed786b7269a52df359b3d3db83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "TZR.h"
#include "TZR_globals.h"
#include "sdl_error.h"
int
TZR_SetViewportSize(int width, int height)
{
const int pw = ___tzr_config.width;
const int ph = ___tzr_config.height;
___tzr_config.width = width;
___tzr_config.height = height;
if (___tzr_config.hd_render) {
if (SDL_RenderSetLogicalSize(___tzr_renderer,
___tzr_config.width,
___tzr_config.height) < 0)
return sdl_error(-1);
} else {
if (___tzr_target != NULL && pw == width && ph == height)
return 0;
if (___tzr_target != NULL)
SDL_DestroyTexture(___tzr_target);
___tzr_target = SDL_CreateTexture(___tzr_renderer,
SDL_PIXELFORMAT_RGB888,
SDL_TEXTUREACCESS_TARGET,
___tzr_config.width,
___tzr_config.height);
if (___tzr_target == NULL)
return sdl_error(-1);
if (___tzr_config.interlace) {
___tzr_target_pre = SDL_CreateTexture(
___tzr_renderer,
SDL_PIXELFORMAT_RGB888,
SDL_TEXTUREACCESS_TARGET,
___tzr_config.width,
___tzr_config.height);
}
}
return 0;
}
|