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, ®ion_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;
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);
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)
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)
{
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);
}
* 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));
* 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)));
}
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);
{
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
}
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);
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;
{
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),
_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);
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");