Commit 6bdca50d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

naive port to Cairo. Somebody should check if this isn't better done with

2007-11-13  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpviewrenderervectors.c
	(gimp_view_renderer_vectors_draw): naive port to Cairo. Somebody
	should check if this isn't better done with proper curve_to()
	drawing using the original vectors data instead of interpolation.

	* app/widgets/gimpviewrenderer.c (gimp_view_renderer_draw): reset
	clipping before drawing the border because a subclass' draw()
	might have done additional clipping.


svn path=/trunk/; revision=24147
parent 6a0e84fc
2007-11-13 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpviewrenderervectors.c
(gimp_view_renderer_vectors_draw): naive port to Cairo. Somebody
should check if this isn't better done with proper curve_to()
drawing using the original vectors data instead of interpolation.
* app/widgets/gimpviewrenderer.c (gimp_view_renderer_draw): reset
clipping before drawing the border because a subclass' draw()
might have done additional clipping.
2007-11-13 Tor Lillqvist <tml@novell.com>
* gimptool-win32.c.in: Some cleanups, more coming.
......
......@@ -630,6 +630,16 @@ gimp_view_renderer_draw (GimpViewRenderer *renderer,
gint height = renderer->height + renderer->border_width;
gdouble x, y;
if (renderer->viewable)
{
/* reset clipping because the draw() implementation is
* allowed to do additional clipping
*/
cairo_reset_clip (cr);
gdk_cairo_rectangle (cr, &render_rect);
cairo_clip (cr);
}
cairo_set_line_width (cr, renderer->border_width);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
gimp_cairo_set_source_color (cr, &renderer->border_color);
......
......@@ -81,9 +81,11 @@ gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer,
y = area->y + (area->height - renderer->height) / 2;
cairo_rectangle (cr, x, y, renderer->width, renderer->height);
cairo_clip_preserve (cr);
cairo_fill (cr);
/* FIXME: port vector previews to Cairo */
cairo_set_line_width (cr, 1.0);
gdk_cairo_set_source_color (cr, &widget->style->black);
xscale = (gdouble) GIMP_ITEM (vectors)->width / (gdouble) renderer->width;
yscale = (gdouble) GIMP_ITEM (vectors)->height / (gdouble) renderer->height;
......@@ -100,28 +102,27 @@ gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer,
if (! coordinates)
continue;
#if 0
if (coordinates->len > 0)
{
GdkPoint *points = g_new (GdkPoint, coordinates->len);
gint i;
GimpCoords *coords = &(g_array_index (coordinates, GimpCoords, 0));
gdouble cx = x + ROUND (coords->x / xscale);
gdouble cy = y + ROUND (coords->y / yscale);
gint i;
for (i = 0; i < coordinates->len; i++)
{
GimpCoords *coords;
cairo_move_to (cr, cx, cy);
for (i = 1; i < coordinates->len; i++)
{
coords = &(g_array_index (coordinates, GimpCoords, i));
points[i].x = rect.x + ROUND (coords->x / xscale);
points[i].y = rect.y + ROUND (coords->y / yscale);
}
cx = x + ROUND (coords->x / xscale) + 0.5;
cy = y + ROUND (coords->y / yscale) + 0.5;
gdk_draw_lines (window, widget->style->black_gc,
points, coordinates->len);
cairo_line_to (cr, cx, cy);
}
g_free (points);
cairo_stroke (cr);
}
#endif
g_array_free (coordinates, TRUE);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment