diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-01 12:57:06 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-01 12:57:06 +0100 |
commit | fe220c247813c269ff4c167518b32db9f6839663 (patch) | |
tree | fbaa23986ec06173df25b1366dfbab0bd8e85f9d /fb-gui.c | |
parent | f1609f44313763d09e32856a6cd846ee99d42c7a (diff) | |
download | fbida-fe220c247813c269ff4c167518b32db9f6839663.tar.gz |
use cairo for darkify
Diffstat (limited to 'fb-gui.c')
-rw-r--r-- | fb-gui.c | 35 |
1 files changed, 5 insertions, 30 deletions
@@ -245,36 +245,11 @@ void shadow_merge_rgbdata(int x, int y, int pixels, int weight, void shadow_darkify(int x1, int x2, int y1,int y2, int percent) { - unsigned char *ptr; - int x,y,h; - - if (x2 < x1) - h = x2, x2 = x1, x1 = h; - if (y2 < y1) - h = y2, y2 = y1, y1 = h; - - if (x1 < 0) - x1 = 0; - if (x2 >= swidth) - x2 = swidth; - - if (y1 < 0) - y1 = 0; - if (y2 >= sheight) - y2 = sheight; - - percent = percent * 256 / 100; - - for (y = y1; y <= y2; y++) { - sdirty[y]++; - ptr = shadow[y]; - ptr += 4*x1; - x = 4*(x2-x1+1); - while (x-- > 0) { - *ptr = (*ptr * percent) >> 8; - ptr++; - } - } + cairo_rectangle(context, x1, y1, + x2 - x1 + 1, + y2 - y1 + 1); + cairo_set_source_rgba(context, 0, 0, 0, percent * 0.01); + cairo_fill(context); } void shadow_reverse(int x1, int x2, int y1,int y2) |