summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2010-07-05 12:56:02 +0300
committerTor Lillqvist <tml@iki.fi>2010-07-05 12:57:13 +0300
commit34e8bd9dba7122661ada0e10f7e60e8eaea3642d (patch)
tree537ec0255b7b8e3ca20114476bf9160218907796 /gdk
parent1ac50118730e3cb2b8fac36551656eb371a89832 (diff)
downloadgtk+-34e8bd9dba7122661ada0e10f7e60e8eaea3642d.tar.gz
Fix build breakage on Windows caused by the region changes
Patches by Sam Thursfield, from bug #623476.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkdrawable-win32.c42
-rw-r--r--gdk/win32/gdkgc-win32.c31
-rw-r--r--gdk/win32/gdkgeometry-win32.c2
-rw-r--r--gdk/win32/gdkmain-win32.c10
-rw-r--r--gdk/win32/gdkprivate-win32.h8
-rw-r--r--gdk/win32/gdkwindow-win32.c8
6 files changed, 54 insertions, 47 deletions
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 83d87273e5..19bb89a29d 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -512,14 +512,14 @@ generic_draw (GdkDrawable *drawable,
const GdkGCValuesMask blitting_mask = 0;
GdkGCValuesMask drawing_mask = GDK_GC_FOREGROUND;
gint ts_x_origin = 0, ts_y_origin = 0;
+ cairo_rectangle_int_t region_extents;
- gint width = region->extents.x2 - region->extents.x1;
- gint height = region->extents.y2 - region->extents.y1;
+ cairo_region_get_extents (region, &region_extents);
GdkPixmap *mask_pixmap =
- gdk_pixmap_new (drawable, width, height, 1);
+ gdk_pixmap_new (drawable, region_extents.width, region_extents.height, 1);
GdkPixmap *tile_pixmap =
- gdk_pixmap_new (drawable, width, height, -1);
+ gdk_pixmap_new (drawable, region_extents.width, region_extents.height, -1);
GdkPixmap *stipple_bitmap = NULL;
GdkColor fg;
@@ -542,13 +542,13 @@ generic_draw (GdkDrawable *drawable,
if (gcwin32->values_mask & GDK_GC_TS_Y_ORIGIN)
ts_y_origin = gc->ts_y_origin;
- ts_x_origin -= region->extents.x1;
- ts_y_origin -= region->extents.y1;
+ ts_x_origin -= region_extents.x;
+ ts_y_origin -= region_extents.y;
/* Fill mask bitmap with zeros */
gdk_gc_set_function (mask_gc, GDK_CLEAR);
gdk_draw_rectangle (mask_pixmap, mask_gc, TRUE,
- 0, 0, width, height);
+ 0, 0, region_extents.width, region_extents.height);
/* Paint into mask bitmap, drawing ones */
gdk_gc_set_function (mask_gc, GDK_COPY);
@@ -575,7 +575,7 @@ generic_draw (GdkDrawable *drawable,
mask_hdc = gdk_win32_hdc_get (mask_pixmap, mask_gc, drawing_mask);
(*function) (GDK_GC_WIN32 (mask_gc), mask_hdc,
- region->extents.x1, region->extents.y1, args);
+ region_extents.x, region_extents.y, args);
gdk_win32_hdc_release (mask_pixmap, mask_gc, drawing_mask);
if (fill_style == GDK_TILED)
@@ -584,21 +584,22 @@ generic_draw (GdkDrawable *drawable,
draw_tiles (tile_pixmap, tile_gc, SRCCOPY,
_gdk_gc_get_tile (gc),
0, 0, ts_x_origin, ts_y_origin,
- width, height);
+ region_extents.width, region_extents.height);
}
else
{
/* Tile with stipple */
GdkGC *stipple_gc;
- stipple_bitmap = gdk_pixmap_new (NULL, width, height, 1);
+ stipple_bitmap =
+ gdk_pixmap_new (NULL, region_extents.width, region_extents.height, 1);
stipple_gc = gdk_gc_new (stipple_bitmap);
/* Tile stipple bitmap */
draw_tiles (stipple_bitmap, stipple_gc, SRCCOPY,
_gdk_gc_get_stipple (gc),
0, 0, ts_x_origin, ts_y_origin,
- width, height);
+ region_extents.width, region_extents.height);
if (fill_style == GDK_OPAQUE_STIPPLED)
{
@@ -606,7 +607,8 @@ generic_draw (GdkDrawable *drawable,
fg.pixel = _gdk_gc_get_bg_pixel (gc);
gdk_gc_set_foreground (tile_gc, &fg);
gdk_draw_rectangle (tile_pixmap, tile_gc, TRUE,
- 0, 0, width, height);
+ 0, 0,
+ region_extents.width, region_extents.height);
}
g_object_unref (stipple_gc);
}
@@ -662,14 +664,18 @@ generic_draw (GdkDrawable *drawable,
* Reading bottom-up: 11100010 = 0xE2. PSDK docs say this is
* known as DSPDxax, with hex value 0x00E20746.
*/
- GDI_CALL (BitBlt, (tile_hdc, 0, 0, width, height,
- stipple_hdc, 0, 0, ROP3_DSPDxax));
+ GDI_CALL (BitBlt, (tile_hdc, 0, 0,
+ region_extents.width, region_extents.height,
+ stipple_hdc, 0, 0,
+ ROP3_DSPDxax));
if (fill_style == GDK_STIPPLED)
{
/* Punch holes in mask where stipple is zero */
- GDI_CALL (BitBlt, (mask_hdc, 0, 0, width, height,
- stipple_hdc, 0, 0, SRCAND));
+ GDI_CALL (BitBlt, (mask_hdc, 0, 0,
+ region_extents.width, region_extents.height,
+ stipple_hdc, 0, 0,
+ SRCAND));
}
GDI_CALL (SelectObject, (tile_hdc, old_tile_brush));
@@ -683,8 +689,8 @@ generic_draw (GdkDrawable *drawable,
* the areas where mask is one. (It is filled with said pattern.)
*/
- GDI_CALL (MaskBlt, (hdc, region->extents.x1, region->extents.y1,
- width, height,
+ GDI_CALL (MaskBlt, (hdc, region_extents.x, region_extents.y,
+ region_extents.width, region_extents.height,
tile_hdc, 0, 0,
GDK_PIXMAP_HBITMAP (mask_pixmap), 0, 0,
MAKEROP4 (rop2_to_rop3 (gcwin32->rop2), ROP3_D)));
diff --git a/gdk/win32/gdkgc-win32.c b/gdk/win32/gdkgc-win32.c
index 6b80269236..578cd5d274 100644
--- a/gdk/win32/gdkgc-win32.c
+++ b/gdk/win32/gdkgc-win32.c
@@ -543,9 +543,9 @@ gdk_win32_gc_set_dashes (GdkGC *gc,
}
void
-_gdk_windowing_gc_set_clip_region (GdkGC *gc,
+_gdk_windowing_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region,
- gboolean reset_origin)
+ gboolean reset_origin)
{
GdkGCWin32 *win32_gc = GDK_GC_WIN32 (gc);
@@ -556,9 +556,9 @@ _gdk_windowing_gc_set_clip_region (GdkGC *gc,
{
GDK_NOTE (GC, g_print ("gdk_gc_set_clip_region: %p: %s\n",
win32_gc,
- _gdk_win32_gdkregion_to_string (region)));
+ _gdk_win32_cairo_region_to_string (region)));
- win32_gc->hcliprgn = _gdk_win32_gdkregion_to_hrgn (region, 0, 0);
+ win32_gc->hcliprgn = _gdk_win32_cairo_region_to_hrgn (region, 0, 0);
win32_gc->values_mask |= GDK_GC_CLIP_MASK;
}
else
@@ -1055,16 +1055,16 @@ _gdk_win32_bitmap_to_hrgn (GdkPixmap *pixmap)
}
HRGN
-_gdk_win32_gdkregion_to_hrgn (const cairo_region_t *region,
- gint x_origin,
- gint y_origin)
+_gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
+ gint x_origin,
+ gint y_origin)
{
HRGN hrgn;
RGNDATA *rgndata;
RECT *rect;
- cairo_region_tBox *boxes = region->rects;
- guint nbytes =
- sizeof (RGNDATAHEADER) + (sizeof (RECT) * region->numRects);
+ cairo_rectangle_int_t cairo_rect;
+ guint nbytes = sizeof (RGNDATAHEADER)
+ + (sizeof (RECT) * cairo_region_num_rectangles (region));
int i;
rgndata = g_malloc (nbytes);
@@ -1074,14 +1074,15 @@ _gdk_win32_gdkregion_to_hrgn (const cairo_region_t *region,
SetRect (&rgndata->rdh.rcBound,
G_MAXLONG, G_MAXLONG, G_MINLONG, G_MINLONG);
- for (i = 0; i < region->numRects; i++)
+ for (i = 0; i < cairo_region_num_rectangles (region); i++)
{
rect = ((RECT *) rgndata->Buffer) + rgndata->rdh.nCount++;
+ cairo_region_get_rectangle (region, i, &cairo_rect);
- rect->left = boxes[i].x1 + x_origin;
- rect->right = boxes[i].x2 + x_origin;
- rect->top = boxes[i].y1 + y_origin;
- rect->bottom = boxes[i].y2 + y_origin;
+ rect->left = cairo_rect.x + x_origin;
+ rect->right = cairo_rect.x + cairo_rect.width + x_origin;
+ rect->top = cairo_rect.y + y_origin;
+ rect->bottom = cairo_rect.y + cairo_rect.height + y_origin;
if (rect->left < rgndata->rdh.rcBound.left)
rgndata->rdh.rcBound.left = rect->left;
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index ca28b28a24..a94b81ea92 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -282,7 +282,7 @@ gdk_window_post_scroll (GdkWindow *window,
{
GDK_NOTE (EVENTS,
g_print ("gdk_window_clip_changed: invalidating region: %s\n",
- _gdk_win32_gdkregion_to_string (new_clip_region)));
+ _gdk_win32_cairo_region_to_string (new_clip_region)));
gdk_window_invalidate_region (window, new_clip_region, FALSE);
g_print ("gdk_window_post_scroll\n");
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index e8258f4536..8c684d0223 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -517,7 +517,6 @@ _gdk_win32_gcvalues_mask_to_string (GdkGCValuesMask mask)
BIT (FOREGROUND);
BIT (BACKGROUND);
- BIT (FONT);
BIT (FUNCTION);
BIT (FILL);
BIT (TILE);
@@ -1158,12 +1157,13 @@ _gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect)
}
gchar *
-_gdk_win32_gdkregion_to_string (const cairo_region_t *rgn)
+_gdk_win32_cairo_region_to_string (const cairo_region_t *rgn)
{
+ cairo_rectangle_int_t extents;
+ cairo_region_get_extents (rgn, &extents);
return static_printf ("%dx%d@%+d%+d",
- (rgn->extents.x2 - rgn->extents.x1),
- (rgn->extents.y2 - rgn->extents.y1),
- rgn->extents.x1, rgn->extents.y1);
+ extents.width, extents.height,
+ extents.x, extents.y);
}
gchar *
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 39a9f9a33a..0945d6e20f 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -267,9 +267,9 @@ COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
HRGN _gdk_win32_bitmap_to_hrgn (GdkPixmap *bitmap);
-HRGN _gdk_win32_gdkregion_to_hrgn (const cairo_region_t *region,
- gint x_origin,
- gint y_origin);
+HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
+ gint x_origin,
+ gint y_origin);
cairo_region_t *_gdk_win32_hrgn_to_region (HRGN hrgn);
@@ -321,7 +321,7 @@ gchar *_gdk_win32_data_to_string (const guchar*data,
gchar *_gdk_win32_rect_to_string (const RECT *rect);
gchar *_gdk_win32_gdkrectangle_to_string (const GdkRectangle *rect);
-gchar *_gdk_win32_gdkregion_to_string (const cairo_region_t *box);
+gchar *_gdk_win32_cairo_region_to_string (const cairo_region_t *box);
void _gdk_win32_print_event (const GdkEvent *event);
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 83e467e05a..53676b7364 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -3149,7 +3149,7 @@ gdk_win32_window_shape_combine_region (GdkWindow *window,
{
HRGN hrgn;
- hrgn = _gdk_win32_gdkregion_to_hrgn (shape_region, 0, 0);
+ hrgn = _gdk_win32_cairo_region_to_hrgn (shape_region, 0, 0);
GDK_NOTE (MISC, g_print ("gdk_win32_window_shape_combine_region: %p: %p\n",
GDK_WINDOW_HWND (window),
@@ -3269,11 +3269,11 @@ static gboolean
_gdk_win32_window_queue_antiexpose (GdkWindow *window,
cairo_region_t *area)
{
- HRGN hrgn = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);
+ HRGN hrgn = _gdk_win32_cairo_region_to_hrgn (area, 0, 0);
GDK_NOTE (EVENTS, g_print ("_gdk_windowing_window_queue_antiexpose: ValidateRgn %p %s\n",
GDK_WINDOW_HWND (window),
- _gdk_win32_gdkregion_to_string (area)));
+ _gdk_win32_cairo_region_to_string (area)));
ValidateRgn (GDK_WINDOW_HWND (window), hrgn);
@@ -3306,7 +3306,7 @@ _gdk_win32_window_queue_translation (GdkWindow *window,
else if (ret != NULLREGION)
{
/* Get current updateregion, move any part of it that intersects area by dx,dy */
- HRGN update = _gdk_win32_gdkregion_to_hrgn (area, 0, 0);
+ HRGN update = _gdk_win32_cairo_region_to_hrgn (area, 0, 0);
ret = CombineRgn (update, hrgn, update, RGN_AND);
if (ret == ERROR)
WIN32_API_FAILED ("CombineRgn");