X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fgfx.cc;h=5c04d1edb3b2856719071f2f0ea75d1d34842cf0;hb=5449bf8fbca1d2cfbefa0386df7109afb2a5aa34;hp=3de2e1d149f981196825b3c9cdb6a26316898d03;hpb=52e08b5a5e7d44271d217892372c6c0878484c44;p=winnie diff --git a/src/gfx.cc b/src/gfx.cc index 3de2e1d..5c04d1e 100644 --- a/src/gfx.cc +++ b/src/gfx.cc @@ -92,7 +92,7 @@ void clear_screen(int r, int g, int b) void fill_rect(const Rect &rect, int r, int g, int b) { - unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4; + unsigned char *fb = framebuffer + (rect.x + screen_rect.width * rect.y) * 4; for(int i=0; i= dest_rect.width) { + width -= xend - dest_rect.width; + } + + int yend = dest_y + height; + if(yend >= dest_rect.height) { + height -= yend - dest_rect.height; + } + + if(width <= 0 || height <= 0) { + return; + } + + unsigned char *sptr = src_img + (src_rect.y * src_rect.width + src_rect.x) * 4; + unsigned char *dptr = dest_img + (dest_y * dest_rect.width + dest_x) * 4; + + for(int i=0; i= dest_rect.width) { + width -= xend - dest_rect.width; + } + + int yend = dest_y + height; + if(yend >= dest_rect.height) { + height -= yend - dest_rect.height; + } + + if(width <= 0 || height <= 0) { + return; + } + + unsigned char *sptr = src_img + (src_rect.y * src_rect.width + src_rect.x) * 4; + unsigned char *dptr = dest_img + (dest_y * dest_rect.width + dest_x) * 4; + + for(int i=0; i