- sdl_rect.x = clipping_rect.x;
- sdl_rect.y = clipping_rect.y;
- sdl_rect.w = clipping_rect.width;
- sdl_rect.h = clipping_rect.height;
+ sdl_rect.x = gfx->clipping_rect.x;
+ sdl_rect.y = gfx->clipping_rect.y;
+ sdl_rect.w = gfx->clipping_recvoid fill_rect(const Rect &rect, int r, int g, int b)
+{
+ Rect drect = rect;
+ Rect screen_rect = get_screen_size();
+
+ if(drect.x < clipping_rect.x) {
+ drect.width -= clipping_rect.x - drect.x;
+ drect.x = clipping_rect.x;
+ }
+
+ if(drect.y < clipping_rect.y) {
+ drect.height -= clipping_rect.y - drect.y;
+ drect.y = clipping_rect.y;
+ }
+
+ if(drect.x + drect.width >= clipping_rect.x + clipping_rect.width) {
+ drect.width = clipping_rect.width + clipping_rect.x - drect.x;
+ }
+
+ if(drect.y + drect.height >= clipping_rect.y + clipping_rect.height) {
+ drect.height = clipping_rect.height + clipping_rect.y - drect.y;
+ }
+
+ unsigned char *fb = get_framebuffer() + (drect.x + screen_rect.width * drect.y) * 4;
+ for(int i=0; i<drect.height; i++) {
+ for(int j=0; j<drect.width; j++) {
+ fb[j * 4] = b;
+ fb[j * 4 + 1] = g;
+ fb[j * 4 + 2] = r;
+ }
+ fb += screen_rect.width * 4;
+ }
+}
+t.width;
+ sdl_rect.h = gfx->clipping_rect.height;