mirror of https://github.com/GNOME/gimp.git
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
This commit is contained in:
parent
6a0e84fc5c
commit
6bdca50d0b
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
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>
|
2007-11-13 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
* gimptool-win32.c.in: Some cleanups, more coming.
|
* 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;
|
gint height = renderer->height + renderer->border_width;
|
||||||
gdouble x, y;
|
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_width (cr, renderer->border_width);
|
||||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||||
gimp_cairo_set_source_color (cr, &renderer->border_color);
|
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;
|
y = area->y + (area->height - renderer->height) / 2;
|
||||||
|
|
||||||
cairo_rectangle (cr, x, y, renderer->width, renderer->height);
|
cairo_rectangle (cr, x, y, renderer->width, renderer->height);
|
||||||
|
cairo_clip_preserve (cr);
|
||||||
cairo_fill (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;
|
xscale = (gdouble) GIMP_ITEM (vectors)->width / (gdouble) renderer->width;
|
||||||
yscale = (gdouble) GIMP_ITEM (vectors)->height / (gdouble) renderer->height;
|
yscale = (gdouble) GIMP_ITEM (vectors)->height / (gdouble) renderer->height;
|
||||||
|
@ -100,28 +102,27 @@ gimp_view_renderer_vectors_draw (GimpViewRenderer *renderer,
|
||||||
if (! coordinates)
|
if (! coordinates)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (coordinates->len > 0)
|
if (coordinates->len > 0)
|
||||||
{
|
{
|
||||||
GdkPoint *points = g_new (GdkPoint, coordinates->len);
|
GimpCoords *coords = &(g_array_index (coordinates, GimpCoords, 0));
|
||||||
gint i;
|
gdouble cx = x + ROUND (coords->x / xscale);
|
||||||
|
gdouble cy = y + ROUND (coords->y / yscale);
|
||||||
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < coordinates->len; i++)
|
cairo_move_to (cr, cx, cy);
|
||||||
|
|
||||||
|
for (i = 1; i < coordinates->len; i++)
|
||||||
{
|
{
|
||||||
GimpCoords *coords;
|
|
||||||
|
|
||||||
coords = &(g_array_index (coordinates, GimpCoords, i));
|
coords = &(g_array_index (coordinates, GimpCoords, i));
|
||||||
|
|
||||||
points[i].x = rect.x + ROUND (coords->x / xscale);
|
cx = x + ROUND (coords->x / xscale) + 0.5;
|
||||||
points[i].y = rect.y + ROUND (coords->y / yscale);
|
cy = y + ROUND (coords->y / yscale) + 0.5;
|
||||||
|
|
||||||
|
cairo_line_to (cr, cx, cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_draw_lines (window, widget->style->black_gc,
|
cairo_stroke (cr);
|
||||||
points, coordinates->len);
|
|
||||||
|
|
||||||
g_free (points);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
g_array_free (coordinates, TRUE);
|
g_array_free (coordinates, TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue