mirror of
https://github.com/yawut/SDL.git
synced 2026-09-25 18:05:41 -05:00
Render: Allow empty cliprect.
This fixes an issue where an empty cliprect is treated the same as a NULL
cliprect, causing the render backends to disable clipping.
Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to
differentiate between:
- SDL_RenderSetClipRect(render, NULL)
- SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r);
Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504
This commit is contained in:
@@ -347,11 +347,9 @@ SW_UpdateClipRect(SDL_Renderer * renderer)
|
||||
{
|
||||
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
|
||||
SDL_Surface *surface = data->surface;
|
||||
const SDL_Rect *rect = &renderer->clip_rect;
|
||||
|
||||
if (surface) {
|
||||
if (!SDL_RectEmpty(rect)) {
|
||||
SDL_SetClipRect(surface, rect);
|
||||
if (renderer->clipping_enabled) {
|
||||
SDL_SetClipRect(surface, &renderer->clip_rect);
|
||||
} else {
|
||||
SDL_SetClipRect(surface, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user