summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-07-21 20:45:21 +0200
committerBenjamin Otte <otte@redhat.com>2010-08-10 21:02:28 +0200
commit0cef9c2bbea9a2475f7eea3837375fe4d2879aef (patch)
tree1c0f98ef440f38cee5703644715345d3f29d5758
parent65ac54bb23b351e5df786c1eadeac771d4bf23b6 (diff)
downloadgtk+-0cef9c2bbea9a2475f7eea3837375fe4d2879aef.tar.gz
quartz: Do repeated fill with Cairo
Some things are so easy with Cairo... XXX: I did not compile this, this is just proof of concept.
-rw-r--r--gdk/quartz/gdkwindow-quartz.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 6e72baa768..de0ca408ad 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -290,7 +290,7 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
int x_offset, y_offset;
int width, height;
cairo_rectangle_int_t rect;
- GdkGC *gc;
+ cairo_t *cr;
x_offset = y_offset = 0;
@@ -314,32 +314,16 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
goto done;
}
- /* Note: There should be a CG API to draw tiled images, we might
- * want to look into that for this.
- */
- gc = gdk_gc_new (GDK_DRAWABLE (impl));
-
gdk_drawable_get_size (GDK_DRAWABLE (bg_pixmap), &width, &height);
- x = -x_offset;
- cairo_region_get_rectangle (clipped_and_offset_region, 0, &rect);
- while (x < (rect.x + rect.width))
- {
- if (x + width >= rect.x)
- {
- y = -y_offset;
- while (y < (rect.y + rect.height))
- {
- if (y + height >= rect.y)
- gdk_draw_drawable (GDK_DRAWABLE (impl), gc, bg_pixmap, 0, 0, x, y, width, height);
-
- y += height;
- }
- }
- x += width;
- }
+ cr = gdk_cairo_create (impl);
+
+ gdk_cairo_set_source_pixmap (cr, bg_pixmap, x_offset, y_offset);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+ gdk_cairo_region (cr, clipped_and_offset_region);
+ cairo_fill (cr);
- g_object_unref (gc);
+ cairo_destroy (cr);
}
done: