From a4013d86fbfe7c38f7927c0630a85a8ade53795a Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Sun, 10 Oct 1999 07:20:37 +0000 Subject: [PATCH] Changed 'pixbuf' variable to 'art_pixbuf' in the core function. Core function now determines whether the requested geometry is on screen or not. If part of it is not then the request is clamped to geometry that is on the screen. --- gdk-pixbuf/ChangeLog | 7 +++++++ gdk/gdkpixbuf-drawable.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 98ab859ea3..a07c218f4e 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,10 @@ +1999-10-10 Cody Russell + * src/gdk-pixbuf-drawable.c: core function now determines whether + the requested geometry is on screen or not, and if some is not + then the request is clamped to geometry that is on the screen. + + Changed 'pixbuf' to 'art_pixbuf' in core function. + 1999-10-08 Michael Fulbright * src/gdk-pixbuf-data.c: Added to load rgb data from const data. diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index 3969763303..aa7b9b1ed2 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -1,5 +1,5 @@ /* - * creates an ArtPixBuf from a Drawable + * Creates an GdkPixBuf from a Drawable * * Author: * Cody Russell @@ -21,7 +21,7 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window, gint with_alpha) { GdkImage *image; - ArtPixBuf *pixbuf; + ArtPixBuf *art_pixbuf; GdkColormap *colormap; art_u8 *buff; art_u8 *pixels; @@ -30,9 +30,39 @@ gdk_pixbuf_from_drawable_core (GdkWindow *window, art_u8 r, g, b; gint xx, yy; gint fatness; + gint screen_width, screen_height; + gint window_width, window_height, window_x, window_y; g_return_val_if_fail (window != NULL, NULL); + screen_width = gdk_screen_width(); + screen_height = gdk_screen_height(); + gdk_window_get_geometry(window, NULL, NULL, + &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; + } + image = gdk_image_get (window, x, y, width, height); colormap = gdk_rgb_get_cmap ();