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.
This commit is contained in:
Richard Hult 2006-08-07 16:45:16 +00:00 committed by Richard Hult
parent 5d2863cb85
commit d2014a6084
3 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,9 @@
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.
2006-08-07 Michael Natterer <mitch@imendio.com>
* gtk/gtkdnd-quartz.c (gtk_drag_dest_unset): need to disconnect

View File

@ -1,3 +1,9 @@
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.
2006-08-07 Michael Natterer <mitch@imendio.com>
* gtk/gtkdnd-quartz.c (gtk_drag_dest_unset): need to disconnect

View File

@ -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