1
0
Fork 0

Change the cached rectangle ares to a GdkRectangle

Simplifies the code as the rectangle is mainly interacting with GDK
APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
Benjamin Otte 2010-09-20 21:14:00 +02:00
parent ecf812db83
commit a0ffe71db3

View file

@ -275,7 +275,7 @@ meta_frames_finalize (GObject *object)
typedef struct typedef struct
{ {
MetaRectangle rect; GdkRectangle rect;
GdkPixmap *pixmap; GdkPixmap *pixmap;
} CachedFramePiece; } CachedFramePiece;
@ -2109,30 +2109,24 @@ clear_backing (GdkPixmap *pixmap,
static GdkPixmap * static GdkPixmap *
generate_pixmap (MetaFrames *frames, generate_pixmap (MetaFrames *frames,
MetaUIFrame *frame, MetaUIFrame *frame,
MetaRectangle rect) GdkRectangle *rect)
{ {
GdkRectangle rectangle;
MetaRegion *region; MetaRegion *region;
GdkPixmap *result; GdkPixmap *result;
/* do not create a pixmap for nonexisting areas */ /* do not create a pixmap for nonexisting areas */
if (rect.width <= 0 || rect.height <= 0) if (rect->width <= 0 || rect->height <= 0)
return NULL; return NULL;
rectangle.x = rect.x;
rectangle.y = rect.y;
rectangle.width = rect.width;
rectangle.height = rect.height;
result = gdk_pixmap_new (frame->window, result = gdk_pixmap_new (frame->window,
rect.width, rect.height, -1); rect->width, rect->height, -1);
clear_backing (result, frame->window, rectangle.x, rectangle.y); clear_backing (result, frame->window, rect->x, rect->y);
region = meta_region_new_from_rectangle (&rectangle); region = meta_region_new_from_rectangle (rect);
meta_frames_paint_to_drawable (frames, frame, result, region, meta_frames_paint_to_drawable (frames, frame, result, region,
-rectangle.x, -rectangle.y); -rect->x, -rect->y);
meta_region_destroy (region); meta_region_destroy (region);
@ -2207,7 +2201,7 @@ populate_cache (MetaFrames *frames,
/* generate_pixmap() returns NULL for 0 width/height pieces, but /* generate_pixmap() returns NULL for 0 width/height pieces, but
* does so cheaply so we don't need to cache the NULL return */ * does so cheaply so we don't need to cache the NULL return */
if (!piece->pixmap) if (!piece->pixmap)
piece->pixmap = generate_pixmap (frames, frame, piece->rect); piece->pixmap = generate_pixmap (frames, frame, &piece->rect);
} }
if (frames->invalidate_cache_timeout_id) if (frames->invalidate_cache_timeout_id)