From a27d02fab9d6feb793cdcd6146f2655658f36f2b Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 6 Nov 2014 10:24:39 -0600 Subject: Make libminuitwrp compile Odds are this is horribly broken, but we are not able to work on it just yet. Change-Id: I8cd12a6dba7957b1ccc1275b8d72c24797856db0 --- minuitwrp/graphics.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'minuitwrp/graphics.c') diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c index 9926904ef..0cdd7726c 100644 --- a/minuitwrp/graphics.c +++ b/minuitwrp/graphics.c @@ -77,6 +77,13 @@ static int gr_is_curr_clr_opaque = 0; static int gr_fb_fd = -1; static int gr_vt_fd = -1; +static unsigned char gr_current_r = 255; +static unsigned char gr_current_g = 255; +static unsigned char gr_current_b = 255; +static unsigned char gr_current_a = 255; + +static GRSurface* gr_draw = NULL; + struct fb_var_screeninfo vi; static struct fb_fix_screeninfo fi; @@ -575,7 +582,8 @@ void gr_fill(int x, int y, int w, int h) } void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) { - if (gr_context == NULL) { + // This is the old code, not sure if we still need it or not + /*if (gr_context == NULL) { return; } @@ -594,7 +602,29 @@ void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) { gl->recti(gl, dx, dy, dx + w, dy + h); if(surface->format == GGL_PIXEL_FORMAT_RGBX_8888) - gl->enable(gl, GGL_BLEND); + gl->enable(gl, GGL_BLEND);*/ + if (source == NULL) return; + + // This code doesn't compile yet, but may very well be needed later + /*if (gr_draw->pixel_bytes != source->pixel_bytes) { + printf("gr_blit: source has wrong format\n"); + return; + } + + dx += overscan_offset_x; + dy += overscan_offset_y; + + if (outside(dx, dy) || outside(dx+w-1, dy+h-1)) return;*/ + + unsigned char* src_p = source->data + sy*source->row_bytes + sx*source->pixel_bytes; + unsigned char* dst_p = gr_draw->data + dy*gr_draw->row_bytes + dx*gr_draw->pixel_bytes; + + int i; + for (i = 0; i < h; ++i) { + memcpy(dst_p, src_p, w * source->pixel_bytes); + src_p += source->row_bytes; + dst_p += gr_draw->row_bytes; + } } unsigned int gr_get_width(gr_surface surface) { -- cgit v1.2.3