X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=images%2Falpha.c;h=d97207e8cb4c54589a37186ae94f595624684e58;hb=d46d9596c225dbbcaef4b76e0828036e3addfbe3;hp=f3a85c354a39eff48c0307bf7b461a9a19040066;hpb=422234aee83909200561bcce45f6bc1ed84f4789;p=libucw.git diff --git a/images/alpha.c b/images/alpha.c index f3a85c35..d97207e8 100644 --- a/images/alpha.c +++ b/images/alpha.c @@ -7,7 +7,7 @@ * of the GNU Lesser General Public License. */ -#define LOCAL_DEBUG +#undef LOCAL_DEBUG #include "lib/lib.h" #include "images/images.h" @@ -20,7 +20,7 @@ merge_func(uns value, uns alpha, uns acoef, uns bcoef) } int -image_apply_background(struct image_thread *thread UNUSED, struct image *dest, struct image *src, struct color *background) +image_apply_background(struct image_context *ctx UNUSED, struct image *dest, struct image *src, struct color *background) { DBG("image_apply_background()"); @@ -29,7 +29,10 @@ image_apply_background(struct image_thread *thread UNUSED, struct image *dest, s { ASSERT(dest->pixel_size == 1); byte bg; - color_put_grayscale(&bg, background); + if (background->color_space) + color_put_grayscale(&bg, background); + else + bg = 0; uns a = 255 * bg, b = bg; # define IMAGE_WALK_PREFIX(x) walk_##x # define IMAGE_WALK_INLINE @@ -48,7 +51,10 @@ image_apply_background(struct image_thread *thread UNUSED, struct image *dest, s { ASSERT((src->flags & IMAGE_ALPHA) && dest->pixel_size >= 3 && !(dest->flags & IMAGE_ALPHA)); byte bg[3]; - color_put_rgb(bg, background); + if (background->color_space) + color_put_rgb(bg, background); + else + bg[0] = bg[1] = bg[2] = 0; uns a0 = 255 * bg[0], b0 = bg[0]; uns a1 = 255 * bg[1], b1 = bg[1]; uns a2 = 255 * bg[2], b2 = bg[2];