Annotation of /trunk/gtk2+/patches/gtk+-2.2.1-disable_icons_smooth_alpha.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 1383 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 1383 byte(s)
-import
1 | niro | 144 | diff -ru gtk+-2.2.1/gtk/gtkstyle.c gtk+-2.2.1.patch/gtk/gtkstyle.c |
2 | --- gtk+-2.2.1/gtk/gtkstyle.c 2003-01-31 05:42:34.000000000 +0100 | ||
3 | +++ gtk+-2.2.1.patch/gtk/gtkstyle.c 2003-02-07 19:16:04.000000000 +0100 | ||
4 | @@ -1988,6 +1988,36 @@ | ||
5 | } | ||
6 | } | ||
7 | |||
8 | +static void | ||
9 | +set_pixbuf_alpha (GdkPixbuf *src) | ||
10 | +{ | ||
11 | + int width, wb; | ||
12 | + int height; | ||
13 | + int rowstride; | ||
14 | + gboolean has_alpha; | ||
15 | + guchar *pixels, *p; | ||
16 | + int i, j; | ||
17 | + | ||
18 | + width = gdk_pixbuf_get_width (src); | ||
19 | + height = gdk_pixbuf_get_height (src); | ||
20 | + rowstride = gdk_pixbuf_get_rowstride (src); | ||
21 | + has_alpha = gdk_pixbuf_get_has_alpha (src); | ||
22 | + | ||
23 | + if (has_alpha == FALSE) | ||
24 | + return; | ||
25 | + | ||
26 | + pixels = gdk_pixbuf_get_pixels (src); | ||
27 | + | ||
28 | + wb = width << 2; | ||
29 | + for (i = 0; i < height; i ++) | ||
30 | + { | ||
31 | + p = pixels + (i * rowstride); | ||
32 | + | ||
33 | + for (j = 0; j < wb; j += 4) | ||
34 | + p[j + 3] = p[j + 3] >> 1; | ||
35 | + } | ||
36 | +} | ||
37 | + | ||
38 | static GdkPixbuf * | ||
39 | gtk_default_render_icon (GtkStyle *style, | ||
40 | const GtkIconSource *source, | ||
41 | @@ -2054,8 +2084,8 @@ | ||
42 | stated = gdk_pixbuf_copy (scaled); | ||
43 | |||
44 | gdk_pixbuf_saturate_and_pixelate (scaled, stated, | ||
45 | - 0.8, TRUE); | ||
46 | - | ||
47 | + 0.0, FALSE); | ||
48 | + set_pixbuf_alpha (stated); | ||
49 | g_object_unref (scaled); | ||
50 | } | ||
51 | else if (state == GTK_STATE_PRELIGHT) |