diff options
Diffstat (limited to 'packages/gtk+/gtk+-2.10.10/gnome-bug-341177.patch')
-rw-r--r-- | packages/gtk+/gtk+-2.10.10/gnome-bug-341177.patch | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/packages/gtk+/gtk+-2.10.10/gnome-bug-341177.patch b/packages/gtk+/gtk+-2.10.10/gnome-bug-341177.patch new file mode 100644 index 0000000000..c31868462a --- /dev/null +++ b/packages/gtk+/gtk+-2.10.10/gnome-bug-341177.patch @@ -0,0 +1,217 @@ +diff -uprN gtk+-2.8.13.org/gdk-pixbuf/pixops/pixops.c gtk+-2.8.13.INNER_LOOP/gdk-pixbuf/pixops/pixops.c +--- gtk+-2.8.13.org/gdk-pixbuf/pixops/pixops.c Tue Jul 12 18:58:57 2005 ++++ gtk+-2.8.13.INNER_LOOP/gdk-pixbuf/pixops/pixops.c Tue May 9 17:30:53 2006 +@@ -71,35 +71,24 @@ get_check_shift (int check_size) + return check_shift; + } + +-static void +-pixops_scale_nearest (guchar *dest_buf, +- int render_x0, +- int render_y0, +- int render_x1, +- int render_y1, +- int dest_rowstride, +- int dest_channels, +- gboolean dest_has_alpha, +- const guchar *src_buf, +- int src_width, +- int src_height, +- int src_rowstride, +- int src_channels, +- gboolean src_has_alpha, +- double scale_x, +- double scale_y) +-{ +- int i; +- int x; +- int x_step = (1 << SCALE_SHIFT) / scale_x; +- int y_step = (1 << SCALE_SHIFT) / scale_y; +- int xmax, xstart, xstop, x_pos, y_pos; +- const guchar *p; ++typedef struct { guchar a,b,c; } b3; ++extern void BUG_bad_size_of_struct_b3(void); + +-#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL) \ ++#define INNER_LOOP_PREP() \ ++ do { \ ++ x = render_x0 * x_step + x_step / 2; \ + xmax = x + (render_x1 - render_x0) * x_step; \ + xstart = MIN (0, xmax); \ + xstop = MIN (src_width << SCALE_SHIFT, xmax); \ ++ } while(0) ++ ++#define INNER_LOOP_BODY(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL)\ ++ do { \ ++ y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; \ ++ y_pos = CLAMP (y_pos, 0, src_height - 1); \ ++ src = src_buf + y_pos * src_rowstride; \ ++ dest = dest_buf + i * dest_rowstride; \ ++ x = render_x0 * x_step + x_step / 2; \ + p = src + (CLAMP (x, xstart, xstop) >> SCALE_SHIFT) * SRC_CHANNELS; \ + while (x < xstart) \ + { \ +@@ -121,42 +110,58 @@ pixops_scale_nearest (guchar *des + ASSIGN_PIXEL; \ + dest += DEST_CHANNELS; \ + x += x_step; \ +- } ++ } \ ++ } while(0) + +- for (i = 0; i < (render_y1 - render_y0); i++) +- { +- const guchar *src; +- guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; ++static void ++pixops_scale_nearest (guchar *dest_buf, ++ int render_x0, ++ int render_y0, ++ int render_x1, ++ int render_y1, ++ int dest_rowstride, ++ int dest_channels, ++ gboolean dest_has_alpha, ++ const guchar *src_buf, ++ int src_width, ++ int src_height, ++ int src_rowstride, ++ int src_channels, ++ gboolean src_has_alpha, ++ double scale_x, ++ double scale_y) ++{ ++ int i; ++ int x; ++ int x_step = (1 << SCALE_SHIFT) / scale_x; ++ int y_step = (1 << SCALE_SHIFT) / scale_y; ++ int xmax, xstart, xstop, x_pos, y_pos; ++ const guchar *p; + +- x = render_x0 * x_step + x_step / 2; ++ const guchar *src; ++ guchar *dest; + +- if (src_channels == 3) +- { +- if (dest_channels == 3) +- { +- INNER_LOOP (3, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); +- } +- else +- { +- INNER_LOOP (3, 4, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2];dest[3]=0xff); +- } +- } +- else if (src_channels == 4) +- { +- if (dest_channels == 3) +- { +- INNER_LOOP (4, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]); +- } +- else +- { +- guint32 *p32; +- INNER_LOOP(4, 4, p32=(guint32*)dest;*p32=*((guint32*)p)); +- } +- } ++ if(sizeof(b3) != 3) BUG_bad_size_of_struct_b3(); ++ ++ INNER_LOOP_PREP(); ++ ++ if (src_channels == 3) ++ { ++ if (dest_channels == 3) ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (3, 3, *(b3*)dest = *(b3*)p); ++ else ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (3, 4, (*(b3*)dest = *(b3*)p, dest[3]=0xff) ); ++ } ++ else if (src_channels == 4) ++ { ++ if (dest_channels == 3) ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (4, 3, *(b3*)dest = *(b3*)p); ++ else ++ for (i = 0; i < (render_y1 - render_y0); i++) ++ INNER_LOOP_BODY (4, 4, *(guint32*)dest = *((guint32*)p)); + } + } + +@@ -187,18 +192,14 @@ pixops_composite_nearest (guchar + const guchar *p; + unsigned int a0; + ++ INNER_LOOP_PREP(); ++ + for (i = 0; i < (render_y1 - render_y0); i++) + { + const guchar *src; + guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; +- +- x = render_x0 * x_step + x_step / 2; + +- INNER_LOOP(src_channels, dest_channels, ++ INNER_LOOP_BODY(src_channels, dest_channels, + if (src_has_alpha) + a0 = (p[3] * overall_alpha) / 0xff; + else +@@ -209,9 +210,7 @@ pixops_composite_nearest (guchar + case 0: + break; + case 255: +- dest[0] = p[0]; +- dest[1] = p[1]; +- dest[2] = p[2]; ++ *(b3*)dest = *(b3*)p; + if (dest_has_alpha) + dest[3] = 0xff; + break; +@@ -279,17 +278,12 @@ pixops_composite_color_nearest (guchar + const guchar *p; + unsigned int a0; + ++ INNER_LOOP_PREP(); ++ + for (i = 0; i < (render_y1 - render_y0); i++) + { + const guchar *src; + guchar *dest; +- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT; +- y_pos = CLAMP (y_pos, 0, src_height - 1); +- src = src_buf + y_pos * src_rowstride; +- dest = dest_buf + i * dest_rowstride; +- +- x = render_x0 * x_step + x_step / 2; +- + + if (((i + check_y) >> check_shift) & 1) + { +@@ -313,7 +307,7 @@ pixops_composite_color_nearest (guchar + } + + j = 0; +- INNER_LOOP(src_channels, dest_channels, ++ INNER_LOOP_BODY(src_channels, dest_channels, + if (src_has_alpha) + a0 = (p[3] * overall_alpha + 0xff) >> 8; + else +@@ -372,7 +366,8 @@ pixops_composite_color_nearest (guchar + ); + } + } +-#undef INNER_LOOP ++#undef INNER_LOOP_BODY ++#undef INNER_LOOP_PREP + + static void + composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha, |