Fixed bug where the render target is updated instead of the default output when the window is resized.

This commit is contained in:
Sam Lantinga 2014-08-17 14:34:41 -07:00
parent f17587df4a
commit 2e3c778ef5
1 changed files with 16 additions and 6 deletions

View File

@ -115,6 +115,12 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
}
if (event->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) {
/* Make sure we're operating on the default render target */
SDL_Texture *saved_target = SDL_GetRenderTarget(renderer);
if (saved_target) {
SDL_SetRenderTarget(renderer, NULL);
}
if (renderer->logical_w) {
UpdateLogicalSize(renderer);
} else {
@ -140,6 +146,10 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
renderer->UpdateViewport(renderer);
}
}
if (saved_target) {
SDL_SetRenderTarget(renderer, saved_target);
}
} else if (event->window.event == SDL_WINDOWEVENT_HIDDEN) {
renderer->hidden = SDL_TRUE;
} else if (event->window.event == SDL_WINDOWEVENT_SHOWN) {
@ -916,12 +926,12 @@ int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect,
SDL_assert(!texture->native);
renderer = texture->renderer;
SDL_assert(renderer->UpdateTextureYUV);
if (renderer->UpdateTextureYUV) {
return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
} else {
return SDL_Unsupported();
}
}
if (renderer->UpdateTextureYUV) {
return renderer->UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
} else {
return SDL_Unsupported();
}
}
}
static int