X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fgfx.cc;h=c517b399a952309dcfa885a68e57794c951e67b8;hb=32869d8ffb64be82541f48166c5e73a6c4336135;hp=1da29539767792a7823f303ad0bc70abed2473a9;hpb=59cd3a77c4517e387f4c2e21e8b62a9017370116;p=winnie diff --git a/src/gfx.cc b/src/gfx.cc index 1da2953..c517b39 100644 --- a/src/gfx.cc +++ b/src/gfx.cc @@ -3,18 +3,6 @@ #include "geom.h" #include "gfx.h" -static Rect clipping_rect; - -void set_clipping_rect(const Rect &rect) -{ - clipping_rect = rect_intersection(rect, get_screen_size()); -} - -const Rect &get_clipping_rect() -{ - return clipping_rect; -} - void clear_screen(int r, int g, int b) { Rect screen_rect = get_screen_size(); @@ -25,6 +13,7 @@ void fill_rect(const Rect &rect, int r, int g, int b) { Rect drect = rect; Rect screen_rect = get_screen_size(); + Rect clipping_rect = get_clipping_rect(); if(drect.x < clipping_rect.x) { drect.width -= clipping_rect.x - drect.x; @@ -58,6 +47,9 @@ void fill_rect(const Rect &rect, int r, int g, int b) void blit(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img, const Rect &dest_rect, int dest_x, int dest_y) { + int red_offs, green_offs, blue_offs; + get_rgb_order(&red_offs, &green_offs, &blue_offs); + Rect irect = rect_intersection(get_clipping_rect(), dest_rect); int width = src_rect.width; @@ -93,7 +85,11 @@ void blit(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img, unsigned char *dptr = dest_img + (dest_y * dest_rect.width + dest_x) * 4; for(int i=0; i