aboutsummaryrefslogtreecommitdiffstats
path: root/fb-gui.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-02-01 12:57:06 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-02-01 12:57:06 +0100
commitfe220c247813c269ff4c167518b32db9f6839663 (patch)
treefbaa23986ec06173df25b1366dfbab0bd8e85f9d /fb-gui.c
parentf1609f44313763d09e32856a6cd846ee99d42c7a (diff)
downloadfbida-fe220c247813c269ff4c167518b32db9f6839663.tar.gz
use cairo for darkify
Diffstat (limited to 'fb-gui.c')
-rw-r--r--fb-gui.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/fb-gui.c b/fb-gui.c
index d62bc87..c17a953 100644
--- a/fb-gui.c
+++ b/fb-gui.c
@@ -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)