diff options
author | Richard Hult <richard@imendio.com> | 2006-08-07 16:45:16 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2006-08-07 16:45:16 +0000 |
commit | d2014a6084bb5f3c4fb0cc0e74f189b088e6f577 (patch) | |
tree | 3e628a034708bb2313133dba72216e00bc4c97c0 /gdk | |
parent | 5d2863cb8525696ceaa870d24ec295f5e3772322 (diff) | |
download | gtk+-d2014a6084bb5f3c4fb0cc0e74f189b088e6f577.tar.gz |
Don't get and release the context for each point, just once, speeds up
2006-08-07 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c (gdk_quartz_draw_points): Don't
get and release the context for each point, just once, speeds up
drawing many points a lot.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/quartz/gdkdrawable-quartz.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index f256262555..94b68c8e36 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -326,15 +326,24 @@ gdk_quartz_draw_points (GdkDrawable *drawable, GdkPoint *points, gint npoints) { + CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE); int i; + if (!context) + return; + + gdk_quartz_update_context_from_gc (context, gc); + gdk_quartz_set_context_fill_color_from_pixel (context, gdk_drawable_get_colormap (drawable), + _gdk_gc_get_fg_pixel (gc)); + /* Just draw 1x1 rectangles */ for (i = 0; i < npoints; i++) { - gdk_draw_rectangle (drawable, gc, TRUE, - points[i].x, points[i].y, - 1, 1); + CGRect rect = CGRectMake (points[i].x + 0.5, points[i].y + 0.5, 1, 1); + CGContextFillRect (context, rect); } + + gdk_quartz_drawable_release_context (drawable, context); } static void |