[gtk+] image: Always render the whole image
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] image: Always render the whole image
- Date: Sun, 26 Sep 2010 13:33:06 +0000 (UTC)
commit c76221426a03bf11a1ee949e8efd6285fba061e1
Author: Benjamin Otte <otte redhat com>
Date: Fri Sep 3 18:18:28 2010 +0200
image: Always render the whole image
Otherwise effects like blur etc will have funny seams on repaints.
Oh, and also, the draw vfunc doesn't have an equivalent to event->area
;)
gtk/gtkimage.c | 65 +++----------------------------------------------------
1 files changed, 4 insertions(+), 61 deletions(-)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 13e512f..df611b5 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1568,45 +1568,6 @@ ensure_pixbuf_for_gicon (GtkImage *image,
}
}
-
-/*
- * Like gdk_rectangle_intersect (dest, src, dest), but make
- * sure that the origin of dest is moved by an "even" offset.
- * If necessary grow the intersection by one row or column
- * to achieve this.
- *
- * This is necessary since we can't pass alignment information
- * for the pixelation pattern down to gdk_pixbuf_saturate_and_pixelate(),
- * thus we have to makesure that the subimages are properly aligned.
- */
-static gboolean
-rectangle_intersect_even (GdkRectangle *src,
- GdkRectangle *dest)
-{
- gboolean isect;
- gint x, y;
-
- x = dest->x;
- y = dest->y;
- isect = gdk_rectangle_intersect (dest, src, dest);
-
- if ((dest->x - x + dest->y - y) % 2 != 0)
- {
- if (dest->x > x)
- {
- dest->x--;
- dest->width++;
- }
- else
- {
- dest->y--;
- dest->height++;
- }
- }
-
- return isect;
-}
-
static gint
gtk_image_expose (GtkWidget *widget,
GdkEventExpose *event)
@@ -1625,7 +1586,7 @@ gtk_image_expose (GtkWidget *widget,
{
GtkAllocation allocation;
GtkMisc *misc;
- GdkRectangle area, image_bound;
+ GdkRectangle image_bound;
gint x, y;
gint xpad, ypad;
gfloat xalign, yalign;
@@ -1634,7 +1595,6 @@ gtk_image_expose (GtkWidget *widget,
gboolean needs_state_transform;
misc = GTK_MISC (widget);
- area = event->area;
/* For stock items and icon sets, we lazily calculate
* the size; we might get here between a queue_resize()
@@ -1646,9 +1606,6 @@ gtk_image_expose (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
- if (!gdk_rectangle_intersect (&area, &allocation, &area))
- return FALSE;
-
gtk_misc_get_alignment (misc, &xalign, &yalign);
gtk_misc_get_padding (misc, &xpad, &ypad);
@@ -1672,21 +1629,8 @@ gtk_image_expose (GtkWidget *widget,
image_bound.width = gdk_pixbuf_get_width (priv->data.pixbuf.pixbuf);
image_bound.height = gdk_pixbuf_get_height (priv->data.pixbuf.pixbuf);
- if (rectangle_intersect_even (&area, &image_bound) &&
- needs_state_transform)
- {
- pixbuf = gdk_pixbuf_new_subpixbuf (priv->data.pixbuf.pixbuf,
- image_bound.x - x, image_bound.y - y,
- image_bound.width, image_bound.height);
-
- x = image_bound.x;
- y = image_bound.y;
- }
- else
- {
- pixbuf = priv->data.pixbuf.pixbuf;
- g_object_ref (pixbuf);
- }
+ pixbuf = priv->data.pixbuf.pixbuf;
+ g_object_ref (pixbuf);
break;
case GTK_IMAGE_STOCK:
@@ -1799,8 +1743,7 @@ gtk_image_expose (GtkWidget *widget,
break;
}
- if (pixbuf &&
- rectangle_intersect_even (&area, &image_bound))
+ if (pixbuf)
{
cairo_t *cr;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]