From dd54e0b6f91f65b9832077acce7466448a5174c7 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 26 Sep 2016 13:00:01 -0300 Subject: [PATCH] Use bg1/bg2 directly as alpha=255 in the thumbnails generation --- src/app/thumbnails.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/app/thumbnails.cpp b/src/app/thumbnails.cpp index be15c1737..c1ed2cce8 100644 --- a/src/app/thumbnails.cpp +++ b/src/app/thumbnails.cpp @@ -54,23 +54,12 @@ she::Surface* get_cel_thumbnail(const doc::Cel* cel, base::UniquePtr thumb_img(doc::Image::create( image->pixelFormat(), thumb_size.w, thumb_size.h)); - double alpha = 255.0; - uint8_t bg_r[] = { rgba_getr(bg1), rgba_getr(bg2) }; - uint8_t bg_g[] = { rgba_getg(bg1), rgba_getg(bg2) }; - uint8_t bg_b[] = { rgba_getb(bg1), rgba_getb(bg2) }; - uint8_t bg_a[] = { rgba_geta(bg1), rgba_geta(bg2) }; - - doc::color_t bg[] = { - rgba(bg_r[0], bg_g[0], bg_b[0], (int)(bg_a[0] * alpha)), - rgba(bg_r[1], bg_g[1], bg_b[1], (int)(bg_a[1] * alpha)) - }; - int block_size = MID(4, thumb_size.w/8, 16); for (int dst_y = 0; dst_y < thumb_size.h; dst_y++) { for (int dst_x = 0; dst_x < thumb_size.w; dst_x++) { thumb_img->putPixel(dst_x, dst_y, - bg[((dst_x / block_size) % 2) ^ - ((dst_y / block_size) % 2)]); + (((dst_x / block_size) % 2) ^ + ((dst_y / block_size) % 2)) ? bg2: bg1); } }