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.
This commit is contained in:
Cody Russell 1999-10-10 07:20:37 +00:00
parent 2501ca70d6
commit a4013d86fb
2 changed files with 39 additions and 2 deletions

View File

@ -1,3 +1,10 @@
1999-10-10 Cody Russell <bratsche@dfw.net>
* 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 <drmike@redhat.com>
* src/gdk-pixbuf-data.c: Added to load rgb data from const data.

View File

@ -1,5 +1,5 @@
/*
* creates an ArtPixBuf from a Drawable
* Creates an GdkPixBuf from a Drawable
*
* Author:
* Cody Russell <bratsche@dfw.net>
@ -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 ();