diff options
author | Cody Russell <bratsche@src.gnome.org> | 1999-11-03 00:37:40 +0000 |
---|---|---|
committer | Cody Russell <bratsche@src.gnome.org> | 1999-11-03 00:37:40 +0000 |
commit | 8e6f4fc803708afdcdb4f81a15f59b9cbb9274a4 (patch) | |
tree | 9a6a8a0b269a5c1691cdef6695e7ef688255f980 /gdk/gdkpixbuf-drawable.c | |
parent | 1588285e3ad51d219ce3c89dc208b9b3285a650c (diff) | |
download | gtk+-8e6f4fc803708afdcdb4f81a15f59b9cbb9274a4.tar.gz |
src/gdk-pixbuf-drawable.c: Changed the behavior to return NULL if part of
the requested image is offscreen, rather than clipping the image.
Diffstat (limited to 'gdk/gdkpixbuf-drawable.c')
-rw-r--r-- | gdk/gdkpixbuf-drawable.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index dbbd6f18b1..d0c3151f10 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -39,20 +39,12 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window, gint x, gint y, gint width, gi &window_width, &window_height, NULL); gdk_window_get_origin(window, &window_x, &window_y); - if(window_x < 0) { - x = ABS(window_x); - width = window_width - x; - } else { - width = CLAMP(window_x + window_width, window_x, - screen_width) - window_x; - } - - if(window_y < 0) { - y = ABS(window_y); - height = window_height - y; - } else { - height = CLAMP(window_y + window_height, window_y, - screen_height) - window_y; + /* If part of the requested image is offscreen, return NULL. */ + if((window_x) < 0 || (window_y < 0) || + (window_x + window_width > screen_width) || + (window_y + window_height > screen_height)) + { + return NULL; } image = gdk_image_get (window, x, y, width, height); |