|
26 | 26 | #include "../../video/wiiu/SDL_wiiuvideo.h" |
27 | 27 | #include "../../video/wiiu/wiiu_shaders.h" |
28 | 28 | #include "../SDL_sysrender.h" |
| 29 | +#include "SDL_hints.h" |
29 | 30 | #include "SDL_render_wiiu.h" |
30 | 31 |
|
31 | 32 | #include <gx2/event.h> |
@@ -114,17 +115,34 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags) |
114 | 115 | void WIIU_SDL_CreateWindowTex(SDL_Renderer * renderer, SDL_Window * window) |
115 | 116 | { |
116 | 117 | WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata; |
| 118 | + const char *s_hint; |
| 119 | + SDL_ScaleMode s_mode; |
117 | 120 |
|
118 | 121 | if (data->windowTex.driverdata) { |
119 | 122 | WIIU_SDL_DestroyTexture(renderer, &data->windowTex); |
120 | 123 | data->windowTex = (SDL_Texture) {0}; |
121 | 124 | } |
122 | 125 |
|
| 126 | + /* Setup scaling mode; this is normally handled by |
| 127 | + SDL_CreateTexture/SDL_GetScaleMode, but those can't |
| 128 | + be called before fully initializinig the renderer */ |
| 129 | + s_hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); |
| 130 | + if (!s_hint || SDL_strcasecmp(s_hint, "nearest") == 0) { |
| 131 | + s_mode = SDL_ScaleModeNearest; |
| 132 | + } else if (SDL_strcasecmp(s_hint, "linear") == 0) { |
| 133 | + s_mode = SDL_ScaleModeLinear; |
| 134 | + } else if (SDL_strcasecmp(s_hint, "best") == 0) { |
| 135 | + s_mode = SDL_ScaleModeBest; |
| 136 | + } else { |
| 137 | + s_mode = (SDL_ScaleMode)SDL_atoi(s_hint); |
| 138 | + } |
| 139 | + |
123 | 140 | /* Allocate a buffer for the window */ |
124 | 141 | data->windowTex = (SDL_Texture) { |
125 | 142 | .format = SDL_PIXELFORMAT_RGBA8888, |
126 | 143 | .r = 255, .g = 255, .b = 255, .a = 255, |
127 | 144 | .driverdata = WIIU_TEXTURE_MEM1_MAGIC, |
| 145 | + .scaleMode = s_mode, |
128 | 146 | }; |
129 | 147 |
|
130 | 148 | SDL_GetWindowSize(window, &data->windowTex.w, &data->windowTex.h); |
|
0 commit comments