mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-01 19:37:55 +03:00
Clipping
This commit is contained in:
+8
-2
@@ -451,9 +451,16 @@ void AGS::draw_screen(int sx, int sy, int width, int height)
|
||||
void AGS::invalidate_screen(int sx, int sy, int width, int height)
|
||||
{
|
||||
SDL_UnlockSurface(hBmpDest);
|
||||
uint32* pixels = surface_line(hBmpDest, screen_height == 400 ? sy + (scroll - 400) : sy) + sx;
|
||||
int top = screen_height == 400 ? sy + (scroll - 400) : sy;
|
||||
if (top < 0) {
|
||||
height += top;
|
||||
top = 0;
|
||||
}
|
||||
uint32* pixels = surface_line(hBmpDest, top) + sx;
|
||||
if (sy + height > screen_height)
|
||||
height = screen_height - sy;
|
||||
if (sx + width > hBmpDest->w)
|
||||
width = hBmpDest->w - sx;
|
||||
SDL_Rect rect = {sx, sy, width, height};
|
||||
SDL_UpdateTexture(sdlTexture, &rect, pixels, hBmpDest->pitch);
|
||||
SDL_RenderClear(sdlRenderer);
|
||||
@@ -461,4 +468,3 @@ void AGS::invalidate_screen(int sx, int sy, int width, int height)
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
SDL_LockSurface(hBmpDest);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user