X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Fimage.c;h=5209d1207c42a40949f526245cc35a2ddc336200;hb=b1f5555218ecaa3827450125dc47b4bf0d404ee4;hp=feb259703d3d96bc6be2f62b4044c0879b11917c;hpb=a18c1697b1176c26e74267f2ac7a153a2cf2c442;p=chaz%2Fopenbox diff --git a/render/image.c b/render/image.c index feb25970..5209d120 100644 --- a/render/image.c +++ b/render/image.c @@ -1,19 +1,15 @@ -#include #include "../kernel/geom.h" #include "image.h" +#include "color.h" + +#include -void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position, - Rect *surarea) +void image_draw(pixel32 *target, RrTextureRGBA *rgba, Rect *area) { pixel32 *draw = rgba->data; - guint c, i, e, t, sfw, sfh; - sfw = position->width; - sfh = position->height; - - /* it would be nice if this worked, but this function is well broken in - these circumstances. */ - g_assert(position->width == surarea->width && - position->height == surarea->height); + gint c, i, e, t, sfw, sfh; + sfw = area->width; + sfh = area->height; g_assert(rgba->data != NULL); @@ -28,7 +24,7 @@ void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position, /* scale it and cache it */ if (rgba->cache != NULL) g_free(rgba->cache); - rgba->cache = g_new(unsigned long, sfw * sfh); + rgba->cache = g_new(pixel32, sfw * sfh); rgba->cwidth = sfw; rgba->cheight = sfh; for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) { @@ -47,7 +43,7 @@ void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position, draw = rgba->cache; /* apply the alpha channel */ - for (i = 0, c = 0, t = position->x, e = sfw*sfh; i < e; ++i, ++t) { + for (i = 0, c = 0, t = area->x, e = sfw*sfh; i < e; ++i, ++t) { guchar alpha, r, g, b, bgr, bgg, bgb; alpha = draw[i] >> default_alpha_offset; @@ -57,7 +53,7 @@ void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position, if (c >= sfw) { c = 0; - t += surarea->width - sfw; + t += area->width - sfw; } /* background color */