X-Git-Url: http://git.mutantstargoat.com?p=winnie;a=blobdiff_plain;f=src%2Fgfx.cc;fp=src%2Fgfx.cc;h=0000000000000000000000000000000000000000;hp=b72e43bcf1fa67788a349c72366e73a6379aacde;hb=b4c8d68e0357683cec82fb8a9c5a4447155b3192;hpb=9261ecb0ad85bdf8b21e17b7309ddaeb76a57d96 diff --git a/src/gfx.cc b/src/gfx.cc deleted file mode 100644 index b72e43b..0000000 --- a/src/gfx.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* -winnie - an experimental window system - -Copyright (C) 2013 Eleni Maria Stea - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -Author: Eleni Maria Stea -*/ - -#include - -#include "geom.h" -#include "gfx.h" - -void clear_screen(int r, int g, int b) -{ - Rect screen_rect = get_screen_size(); - fill_rect(screen_rect, r, g, b); -} - -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; - 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= irect.width) { - width -= xend - irect.width; - } - - int yend = dest_y + height; - if(yend >= irect.height) { - height -= yend - irect.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= irect.width) { - width -= xend - irect.width; - } - - int yend = dest_y + height; - if(yend >= irect.height) { - height -= yend - irect.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