summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-11-01 16:34:23 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-11-01 16:34:23 +0000
commitfcaa719b7d563047245fc3d7f57ad5b714ddd9a4 (patch)
tree7c258b0f338a8c43e0cad95d1278faf9df7384ab
parent15767742768d7d4a294cfba12dc9cad5cd302e36 (diff)
downloadgtk+-fcaa719b7d563047245fc3d7f57ad5b714ddd9a4.tar.gz
Clip the rectangle to be rendered to the drawable, since
2000-11-01 Havoc Pennington <hp@redhat.com> * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha): Clip the rectangle to be rendered to the drawable, since get_from_drawable() requires a region within the drawable
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-06
-rw-r--r--ChangeLog.pre-2-106
-rw-r--r--ChangeLog.pre-2-26
-rw-r--r--ChangeLog.pre-2-46
-rw-r--r--ChangeLog.pre-2-66
-rw-r--r--ChangeLog.pre-2-86
-rw-r--r--gdk/gdkpixbuf-render.c32
8 files changed, 73 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 433258998f..9ae227850d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 433258998f..9ae227850d 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,5 +1,11 @@
2000-11-01 Havoc Pennington <hp@redhat.com>
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
+ Clip the rectangle to be rendered to the drawable, since
+ get_from_drawable() requires a region within the drawable
+
+2000-11-01 Havoc Pennington <hp@redhat.com>
+
* gtk/gtkimage.c (gtk_image_expose): Um, don't randomly subtract 4
from coordinates.
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index 9ef7bb6f6b..cb4b9ea2bf 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -266,6 +266,8 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
GdkBitmap *bitmap = NULL;
GdkGC *gc;
GdkPixbuf *composited = NULL;
+ gint dwidth, dheight;
+
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
@@ -277,9 +279,37 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
- if (width == 0 || height == 0)
+ /* Clip to the drawable; this is required for get_from_drawable() so
+ * can't be done implicitly
+ */
+
+ if (dest_x < 0)
+ {
+ src_x -= dest_x;
+ width += dest_x;
+ dest_x = 0;
+ }
+
+ if (dest_y < 0)
+ {
+ src_y -= dest_y;
+ height += dest_y;
+ dest_y = 0;
+ }
+
+ gdk_drawable_get_size (drawable, &dwidth, &dheight);
+
+ if ((dest_x + width) > dwidth)
+ width = dwidth - dest_x;
+
+ if ((dest_y + height) > dheight)
+ height = dheight - dest_y;
+
+ if (width <= 0 || height <= 0)
return;
+ /* Actually draw */
+
gc = gdk_gc_new (drawable);
if (pixbuf->has_alpha)