From: buliabyak Date: Fri, 2 Mar 2007 06:56:10 +0000 (+0000) Subject: outline mode: render into the passed cairo_t X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=af8d2404ed87b64d2fbd83794c360fd9b09bd83a;p=inkscape.git outline mode: render into the passed cairo_t --- diff --git a/src/display/nr-arena-glyphs.cpp b/src/display/nr-arena-glyphs.cpp index b061e9acd..b4bf81c8d 100644 --- a/src/display/nr-arena-glyphs.cpp +++ b/src/display/nr-arena-glyphs.cpp @@ -430,7 +430,7 @@ nr_arena_glyphs_group_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint s static unsigned int -nr_arena_glyphs_group_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags) +nr_arena_glyphs_group_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags) { NRArenaItem *child; @@ -442,8 +442,6 @@ nr_arena_glyphs_group_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRP if (item->arena->rendermode == RENDERMODE_OUTLINE) { - cairo_t *ct = nr_create_cairo_context (area, pb); - if (!ct) return item->state; @@ -458,22 +456,16 @@ nr_arena_glyphs_group_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRP cairo_new_path(ct); NR::Matrix g_t(g->g_transform); - feed_curve_to_cairo (ct, bpath, g_t * group->ctm, NR::Point(area->x0, area->y0)); + feed_curve_to_cairo (ct, bpath, g_t * group->ctm, NR::Point(pb->area.x0, pb->area.y0)); cairo_fill(ct); + pb->empty = FALSE; } - cairo_surface_t *cst = cairo_get_target(ct); - cairo_destroy (ct); - cairo_surface_finish (cst); - cairo_surface_destroy (cst); - - pb->empty = FALSE; return ret; } - /* Fill */ if (style->fill.type != SP_PAINT_TYPE_NONE || item->arena->rendermode == RENDERMODE_OUTLINE) { NRPixBlock m; diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 7b8a2c281..bd6ca1df8 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -728,12 +728,10 @@ nr_arena_shape_add_bboxes(NRArenaShape* shape, NRRect &bbox) // cairo outline rendering: static unsigned int -cairo_arena_shape_render_outline(NRArenaItem *item, NRRectL *area, NRPixBlock *pb) +cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Point shift) { NRArenaShape *shape = NR_ARENA_SHAPE(item); - cairo_t *ct = nr_create_cairo_context (area, pb); - if (!ct) return item->state; @@ -744,17 +742,10 @@ cairo_arena_shape_render_outline(NRArenaItem *item, NRRectL *area, NRPixBlock *p cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode cairo_new_path(ct); - feed_curve_to_cairo (ct, SP_CURVE_BPATH(shape->curve), NR::Matrix(shape->ctm), NR::Point(area->x0, area->y0)); + feed_curve_to_cairo (ct, SP_CURVE_BPATH(shape->curve), NR::Matrix(shape->ctm), shift); cairo_stroke(ct); - cairo_surface_t *cst = cairo_get_target(ct); - cairo_destroy (ct); - cairo_surface_finish (cst); - cairo_surface_destroy (cst); - - pb->empty = FALSE; - return item->state; } @@ -850,7 +841,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb * Renders the item. Markers are just composed into the parent buffer. */ static unsigned int -nr_arena_shape_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags) +nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags) { NRArenaShape *shape = NR_ARENA_SHAPE(item); @@ -860,7 +851,8 @@ nr_arena_shape_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRPixBlock bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == RENDERMODE_OUTLINE); if (outline) { - return cairo_arena_shape_render_outline (item, area, pb); + pb->empty = FALSE; + return cairo_arena_shape_render_outline (ct, item, NR::Point(pb->area.x0, pb->area.y0)); } if ( shape->delayed_shp ) { @@ -980,7 +972,7 @@ nr_arena_shape_render(cairo_t *ctt, NRArenaItem *item, NRRectL *area, NRPixBlock /* Just compose children into parent buffer */ for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) { unsigned int ret; - ret = nr_arena_item_invoke_render(ctt, child, area, pb, flags); + ret = nr_arena_item_invoke_render(ct, child, area, pb, flags); if (ret & NR_ARENA_ITEM_STATE_INVALID) return ret; }