Skip to content
Permalink
Browse files
Fixed bug where the render target is updated instead of the default o…
…utput when the window is resized.
  • Loading branch information
slouken committed Aug 17, 2014
1 parent f17587d commit 2e3c778ef50bded2d31d3d86ec6ecc9ea58695b2
Showing 1 changed file with 16 additions and 6 deletions.
@@ -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

0 comments on commit 2e3c778

Please sign in to comment.