diff options
| author | David Mathog <mathog@caltech.edu> | 2014-02-08 08:44:12 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-02-08 08:44:12 +0000 |
| commit | d4ba8eaa4a621ac60d99a4aad7531d080cece2cd (patch) | |
| tree | e1cb3d0319806f78837415284b3c22d2c2b5fb9c /src | |
| parent | EMF/WMF support: Various changes (see bug #1263242 c35 for details) (diff) | |
| download | inkscape-d4ba8eaa4a621ac60d99a4aad7531d080cece2cd.tar.gz inkscape-d4ba8eaa4a621ac60d99a4aad7531d080cece2cd.zip | |
DrawingContext: change variable names ct to dc (bug #1272073)
Fixed bugs:
- https://launchpad.net/bugs/1272073
(bzr r13009)
Diffstat (limited to 'src')
32 files changed, 283 insertions, 283 deletions
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp index 8e25c1843..404a94828 100644 --- a/src/display/canvas-arena.cpp +++ b/src/display/canvas-arena.cpp @@ -216,10 +216,10 @@ sp_canvas_arena_render (SPCanvasItem *item, SPCanvasBuf *buf) Geom::OptIntRect r = buf->rect; if (!r || r->hasZeroArea()) return; - Inkscape::DrawingContext ct(buf->ct, r->min()); + Inkscape::DrawingContext dc(buf->ct, r->min()); arena->drawing.update(Geom::IntRect::infinite(), arena->ctx); - arena->drawing.render(ct, *r); + arena->drawing.render(dc, *r); } static double @@ -386,9 +386,9 @@ sp_canvas_arena_render_surface (SPCanvasArena *ca, cairo_surface_t *surface, Geo g_return_if_fail (ca != NULL); g_return_if_fail (SP_IS_CANVAS_ARENA (ca)); - Inkscape::DrawingContext ct(surface, r.min()); + Inkscape::DrawingContext dc(surface, r.min()); ca->drawing.update(Geom::IntRect::infinite(), ca->ctx); - ca->drawing.render(ct, r); + ca->drawing.render(dc, r); } /* diff --git a/src/display/drawing-context.cpp b/src/display/drawing-context.cpp index de5beb0f6..319136e06 100644 --- a/src/display/drawing-context.cpp +++ b/src/display/drawing-context.cpp @@ -25,27 +25,27 @@ using Geom::Y; */ DrawingContext::Save::Save() - : _ct(NULL) + : _dc(NULL) {} -DrawingContext::Save::Save(DrawingContext &ct) - : _ct(&ct) +DrawingContext::Save::Save(DrawingContext &dc) + : _dc(&dc) { - _ct->save(); + _dc->save(); } DrawingContext::Save::~Save() { - if (_ct) { - _ct->restore(); + if (_dc) { + _dc->restore(); } } -void DrawingContext::Save::save(DrawingContext &ct) +void DrawingContext::Save::save(DrawingContext &dc) { - if (_ct) { + if (_dc) { // TODO: it might be better to treat this occurence as a bug - _ct->restore(); + _dc->restore(); } - _ct = &ct; - _ct->save(); + _dc = &dc; + _dc->save(); } /** diff --git a/src/display/drawing-context.h b/src/display/drawing-context.h index 35be9a86b..d990bcb73 100644 --- a/src/display/drawing-context.h +++ b/src/display/drawing-context.h @@ -31,11 +31,11 @@ public: class Save { public: Save(); - Save(DrawingContext &ct); + Save(DrawingContext &dc); ~Save(); - void save(DrawingContext &ct); + void save(DrawingContext &dc); private: - DrawingContext *_ct; + DrawingContext *_dc; }; DrawingContext(cairo_t *ct, Geom::Point const &origin); diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index b5ce18891..38ace001f 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -98,12 +98,12 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u } unsigned -DrawingGroup::_renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) +DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) { if (stop_at == NULL) { // normal rendering for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { - i->render(ct, area, flags, stop_at); + i->render(dc, area, flags, stop_at); } } else { // background rendering @@ -111,11 +111,11 @@ DrawingGroup::_renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigne if (&*i == stop_at) return RENDER_OK; // do not render the stop_at item at all if (i->isAncestorOf(stop_at)) { // render its ancestors without masks, opacity or filters - i->render(ct, area, flags | RENDER_FILTER_BACKGROUND, stop_at); + i->render(dc, area, flags | RENDER_FILTER_BACKGROUND, stop_at); // stop further rendering return RENDER_OK; } else { - i->render(ct, area, flags, stop_at); + i->render(dc, area, flags, stop_at); } } } @@ -123,10 +123,10 @@ DrawingGroup::_renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigne } void -DrawingGroup::_clipItem(DrawingContext &ct, Geom::IntRect const &area) +DrawingGroup::_clipItem(DrawingContext &dc, Geom::IntRect const &area) { for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { - i->clip(ct, area); + i->clip(dc, area); } } diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h index 775fec8c4..651e9d8af 100644 --- a/src/display/drawing-group.h +++ b/src/display/drawing-group.h @@ -34,9 +34,9 @@ public: protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset); - virtual unsigned _renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, + virtual unsigned _renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at); - virtual void _clipItem(DrawingContext &ct, Geom::IntRect const &area); + virtual void _clipItem(DrawingContext &dc, Geom::IntRect const &area); virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); virtual bool _canClip(); diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index 1b9214c49..8fd81caac 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -102,22 +102,22 @@ DrawingImage::_updateItem(Geom::IntRect const &, UpdateContext const &, unsigned return STATE_ALL; } -unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) +unsigned DrawingImage::_renderItem(DrawingContext &dc, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) { bool outline = _drawing.outline(); if (!outline) { if (!_pixbuf) return RENDER_OK; - Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); - ct.newPath(); - ct.rectangle(_clipbox); - ct.clip(); + Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); + dc.newPath(); + dc.rectangle(_clipbox); + dc.clip(); - ct.translate(_origin); - ct.scale(_scale); - ct.setSource(_pixbuf->getSurfaceRaw(), 0, 0); + dc.translate(_origin); + dc.scale(_scale); + dc.setSource(_pixbuf->getSurfaceRaw(), 0, 0); if (_style) { // See: http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty @@ -128,24 +128,24 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar // Do nothing break; case SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY: - ct.patternSetFilter( CAIRO_FILTER_BEST ); + dc.patternSetFilter( CAIRO_FILTER_BEST ); break; case SP_CSS_COLOR_RENDERING_OPTIMIZESPEED: default: - ct.patternSetFilter( CAIRO_FILTER_NEAREST ); + dc.patternSetFilter( CAIRO_FILTER_NEAREST ); break; } } - ct.paint(_opacity); + dc.paint(_opacity); } else { // outline; draw a rect instead Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 rgba = prefs->getInt("/options/wireframecolors/images", 0xff0000ff); - { Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); - ct.newPath(); + { Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); + dc.newPath(); Geom::Rect r = bounds(); Geom::Point c00 = r.corner(0); @@ -153,21 +153,21 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar Geom::Point c11 = r.corner(2); Geom::Point c10 = r.corner(1); - ct.moveTo(c00); + dc.moveTo(c00); // the box - ct.lineTo(c10); - ct.lineTo(c11); - ct.lineTo(c01); - ct.lineTo(c00); + dc.lineTo(c10); + dc.lineTo(c11); + dc.lineTo(c01); + dc.lineTo(c00); // the diagonals - ct.lineTo(c11); - ct.moveTo(c10); - ct.lineTo(c01); + dc.lineTo(c11); + dc.moveTo(c10); + dc.lineTo(c01); } - ct.setLineWidth(0.5); - ct.setSource(rgba); - ct.stroke(); + dc.setLineWidth(0.5); + dc.setSource(rgba); + dc.stroke(); } return RENDER_OK; } diff --git a/src/display/drawing-image.h b/src/display/drawing-image.h index cebaafc85..64e4517b0 100644 --- a/src/display/drawing-image.h +++ b/src/display/drawing-image.h @@ -38,7 +38,7 @@ public: protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset); - virtual unsigned _renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, + virtual unsigned _renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at); virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index a9b07bb6e..13e7b61eb 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -24,60 +24,60 @@ namespace Inkscape { #ifdef WITH_CSSBLEND -void set_cairo_blend_operator( DrawingContext &ct, unsigned blend_mode ) { +void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { // All of the blend modes are implemented in Cairo as of 1.10. // For a detailed description, see: // http://cairographics.org/operators/ switch (blend_mode) { case SP_CSS_BLEND_MULTIPLY: - ct.setOperator(CAIRO_OPERATOR_MULTIPLY); + dc.setOperator(CAIRO_OPERATOR_MULTIPLY); break; case SP_CSS_BLEND_SCREEN: - ct.setOperator(CAIRO_OPERATOR_SCREEN); + dc.setOperator(CAIRO_OPERATOR_SCREEN); break; case SP_CSS_BLEND_DARKEN: - ct.setOperator(CAIRO_OPERATOR_DARKEN); + dc.setOperator(CAIRO_OPERATOR_DARKEN); break; case SP_CSS_BLEND_LIGHTEN: - ct.setOperator(CAIRO_OPERATOR_LIGHTEN); + dc.setOperator(CAIRO_OPERATOR_LIGHTEN); break; case SP_CSS_BLEND_OVERLAY: - ct.setOperator(CAIRO_OPERATOR_OVERLAY); + dc.setOperator(CAIRO_OPERATOR_OVERLAY); break; case SP_CSS_BLEND_COLORDODGE: - ct.setOperator(CAIRO_OPERATOR_COLOR_DODGE); + dc.setOperator(CAIRO_OPERATOR_COLOR_DODGE); break; case SP_CSS_BLEND_COLORBURN: - ct.setOperator(CAIRO_OPERATOR_COLOR_BURN); + dc.setOperator(CAIRO_OPERATOR_COLOR_BURN); break; case SP_CSS_BLEND_HARDLIGHT: - ct.setOperator(CAIRO_OPERATOR_HARD_LIGHT); + dc.setOperator(CAIRO_OPERATOR_HARD_LIGHT); break; case SP_CSS_BLEND_SOFTLIGHT: - ct.setOperator(CAIRO_OPERATOR_SOFT_LIGHT); + dc.setOperator(CAIRO_OPERATOR_SOFT_LIGHT); break; case SP_CSS_BLEND_DIFFERENCE: - ct.setOperator(CAIRO_OPERATOR_DIFFERENCE); + dc.setOperator(CAIRO_OPERATOR_DIFFERENCE); break; case SP_CSS_BLEND_EXCLUSION: - ct.setOperator(CAIRO_OPERATOR_EXCLUSION); + dc.setOperator(CAIRO_OPERATOR_EXCLUSION); break; case SP_CSS_BLEND_HUE: - ct.setOperator(CAIRO_OPERATOR_HSL_HUE); + dc.setOperator(CAIRO_OPERATOR_HSL_HUE); break; case SP_CSS_BLEND_SATURATION: - ct.setOperator(CAIRO_OPERATOR_HSL_SATURATION); + dc.setOperator(CAIRO_OPERATOR_HSL_SATURATION); break; case SP_CSS_BLEND_COLOR: - ct.setOperator(CAIRO_OPERATOR_HSL_COLOR); + dc.setOperator(CAIRO_OPERATOR_HSL_COLOR); break; case SP_CSS_BLEND_LUMINOSITY: - ct.setOperator(CAIRO_OPERATOR_HSL_LUMINOSITY); + dc.setOperator(CAIRO_OPERATOR_HSL_LUMINOSITY); break; case SP_CSS_BLEND_NORMAL: default: - ct.setOperator(CAIRO_OPERATOR_OVER); + dc.setOperator(CAIRO_OPERATOR_OVER); break; } } @@ -545,7 +545,7 @@ struct MaskLuminanceToAlpha { * @param flags Rendering options. This deals mainly with cache control. */ unsigned -DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) +DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) { bool outline = _drawing.outline(); bool render_filters = _drawing.renderFilters(); @@ -560,7 +560,7 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag // TODO convert outline rendering to a separate virtual function if (outline) { - _renderOutline(ct, area, flags); + _renderOutline(dc, area, flags); return RENDER_OK; } @@ -573,9 +573,9 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag if (_cache) { _cache->prepare(); #ifdef WITH_CSSBLEND - set_cairo_blend_operator( ct, _blend_mode ); + set_cairo_blend_operator( dc, _blend_mode ); #endif - _cache->paintFromCache(ct, carea); + _cache->paintFromCache(dc, carea); if (!carea) return RENDER_OK; } else { // There is no cache. This could be because caching of this item @@ -625,7 +625,7 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag // filters and opacity do not apply when rendering the ancestors of the filtered // element if ((flags & RENDER_FILTER_BACKGROUND) || !needs_intermediate_rendering) { - return _renderItem(ct, *carea, flags & ~RENDER_FILTER_BACKGROUND, stop_at); + return _renderItem(dc, *carea, flags & ~RENDER_FILTER_BACKGROUND, stop_at); } // iarea is the bounding box for intermediate rendering @@ -688,9 +688,9 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag } if (bg_root) { DrawingSurface bg(*iarea); - DrawingContext bgct(bg); - bg_root->render(bgct, *iarea, flags | RENDER_FILTER_BACKGROUND, this); - _filter->render(this, ict, &bgct); + DrawingContext bgdc(bg); + bg_root->render(bgdc, *iarea, flags | RENDER_FILTER_BACKGROUND, this); + _filter->render(this, ict, &bgdc); rendered = true; } } @@ -716,20 +716,20 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag cachect.fill(); _cache->markClean(*carea); } - ct.rectangle(*carea); - ct.setSource(&intermediate); + dc.rectangle(*carea); + dc.setSource(&intermediate); #ifdef WITH_CSSBLEND - set_cairo_blend_operator( ct, _blend_mode ); + set_cairo_blend_operator( dc, _blend_mode ); #endif - ct.fill(); - ct.setSource(0,0,0,0); - // the call above is to clear a ref on the intermediate surface held by ct + dc.fill(); + dc.setSource(0,0,0,0); + // the call above is to clear a ref on the intermediate surface held by dc return render_result; } void -DrawingItem::_renderOutline(DrawingContext &ct, Geom::IntRect const &area, unsigned flags) +DrawingItem::_renderOutline(DrawingContext &dc, Geom::IntRect const &area, unsigned flags) { // intersect with bbox rather than drawbox, as we want to render things outside // of the clipping path as well @@ -738,7 +738,7 @@ DrawingItem::_renderOutline(DrawingContext &ct, Geom::IntRect const &area, unsig // just render everything: item, clip, mask // First, render the object itself - _renderItem(ct, *carea, flags, NULL); + _renderItem(dc, *carea, flags, NULL); // render clip and mask, if any guint32 saved_rgba = _drawing.outlinecolor; // save current outline color @@ -746,12 +746,12 @@ DrawingItem::_renderOutline(DrawingContext &ct, Geom::IntRect const &area, unsig Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (_clip) { _drawing.outlinecolor = prefs->getInt("/options/wireframecolors/clips", 0x00ff00ff); // green clips - _clip->render(ct, *carea, flags); + _clip->render(dc, *carea, flags); } // render mask as an object, using a different color if (_mask) { _drawing.outlinecolor = prefs->getInt("/options/wireframecolors/masks", 0x0000ffff); // blue masks - _mask->render(ct, *carea, flags); + _mask->render(dc, *carea, flags); } _drawing.outlinecolor = saved_rgba; // restore outline color } @@ -765,31 +765,31 @@ DrawingItem::_renderOutline(DrawingContext &ct, Geom::IntRect const &area, unsig * of render() for details. */ void -DrawingItem::clip(Inkscape::DrawingContext &ct, Geom::IntRect const &area) +DrawingItem::clip(Inkscape::DrawingContext &dc, Geom::IntRect const &area) { // don't bother if the object does not implement clipping (e.g. DrawingImage) if (!_canClip()) return; if (!_visible) return; if (!area.intersects(_bbox)) return; - ct.setSource(0,0,0,1); - ct.pushGroup(); + dc.setSource(0,0,0,1); + dc.pushGroup(); // rasterize the clipping path - _clipItem(ct, area); + _clipItem(dc, area); if (_clip) { // The item used as the clipping path itself has a clipping path. // Render this item's clipping path onto a temporary surface, then composite it // with the item using the IN operator - ct.pushGroup(); - _clip->clip(ct, area); - ct.popGroupToSource(); - ct.setOperator(CAIRO_OPERATOR_IN); - ct.paint(); + dc.pushGroup(); + _clip->clip(dc, area); + dc.popGroupToSource(); + dc.setOperator(CAIRO_OPERATOR_IN); + dc.paint(); } - ct.popGroupToSource(); - ct.setOperator(CAIRO_OPERATOR_OVER); - ct.paint(); - ct.setSource(0,0,0,0); + dc.popGroupToSource(); + dc.setOperator(CAIRO_OPERATOR_OVER); + dc.paint(); + dc.setSource(0,0,0,0); } /** diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 1796d29d6..913706021 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -123,8 +123,8 @@ public: void *data() const { return _user_data; } void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = STATE_ALL, unsigned reset = 0); - unsigned render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = NULL); - void clip(DrawingContext &ct, Geom::IntRect const &area); + unsigned render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, DrawingItem *stop_at = NULL); + void clip(DrawingContext &dc, Geom::IntRect const &area); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0); protected: @@ -141,7 +141,7 @@ protected: RENDER_OK = 0, RENDER_STOP = 1 }; - void _renderOutline(DrawingContext &ct, Geom::IntRect const &area, unsigned flags); + void _renderOutline(DrawingContext &dc, Geom::IntRect const &area, unsigned flags); void _markForUpdate(unsigned state, bool propagate); void _markForRendering(); void _invalidateFilterBackground(Geom::IntRect const &area); @@ -150,9 +150,9 @@ protected: Geom::OptIntRect _cacheRect(); virtual unsigned _updateItem(Geom::IntRect const &/*area*/, UpdateContext const &/*ctx*/, unsigned /*flags*/, unsigned /*reset*/) { return 0; } - virtual unsigned _renderItem(DrawingContext &/*ct*/, Geom::IntRect const &/*area*/, unsigned /*flags*/, + virtual unsigned _renderItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) { return RENDER_OK; } - virtual void _clipItem(DrawingContext &/*ct*/, Geom::IntRect const &/*area*/) {} + virtual void _clipItem(DrawingContext &/*dc*/, Geom::IntRect const &/*area*/) {} virtual DrawingItem *_pickItem(Geom::Point const &/*p*/, double /*delta*/, unsigned /*flags*/) { return NULL; } virtual bool _canClip() { return false; } diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 03d7f51b5..f99f9442f 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -150,7 +150,7 @@ DrawingShape::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u } unsigned -DrawingShape::_renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) +DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) { if (!_curve || !_style) return RENDER_OK; if (!area.intersects(_bbox)) return RENDER_OK; // skip if not within bounding box @@ -160,67 +160,67 @@ DrawingShape::_renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigne if (outline) { guint32 rgba = _drawing.outlinecolor; - { Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); - ct.path(_curve->get_pathvector()); + { Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); + dc.path(_curve->get_pathvector()); } - { Inkscape::DrawingContext::Save save(ct); - ct.setSource(rgba); - ct.setLineWidth(0.5); - ct.setTolerance(0.5); - ct.stroke(); + { Inkscape::DrawingContext::Save save(dc); + dc.setSource(rgba); + dc.setLineWidth(0.5); + dc.setTolerance(0.5); + dc.stroke(); } } else { bool has_stroke, has_fill; // we assume the context has no path - Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); + Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); // update fill and stroke paints. // this cannot be done during nr_arena_shape_update, because we need a Cairo context // to render svg:pattern - has_fill = _nrstyle.prepareFill(ct, _item_bbox); - has_stroke = _nrstyle.prepareStroke(ct, _item_bbox); + has_fill = _nrstyle.prepareFill(dc, _item_bbox); + has_stroke = _nrstyle.prepareStroke(dc, _item_bbox); has_stroke &= (_nrstyle.stroke_width != 0); if (has_fill || has_stroke) { // TODO: remove segments outside of bbox when no dashes present - ct.path(_curve->get_pathvector()); + dc.path(_curve->get_pathvector()); if (has_fill) { - _nrstyle.applyFill(ct); - ct.fillPreserve(); + _nrstyle.applyFill(dc); + dc.fillPreserve(); } if (has_stroke) { - _nrstyle.applyStroke(ct); - ct.strokePreserve(); + _nrstyle.applyStroke(dc); + dc.strokePreserve(); } - ct.newPath(); // clear path + dc.newPath(); // clear path } // has fill or stroke pattern } // marker rendering for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { - i->render(ct, area, flags, stop_at); + i->render(dc, area, flags, stop_at); } return RENDER_OK; } -void DrawingShape::_clipItem(DrawingContext &ct, Geom::IntRect const & /*area*/) +void DrawingShape::_clipItem(DrawingContext &dc, Geom::IntRect const & /*area*/) { if (!_curve) return; - Inkscape::DrawingContext::Save save(ct); + Inkscape::DrawingContext::Save save(dc); // handle clip-rule if (_style) { if (_style->clip_rule.computed == SP_WIND_RULE_EVENODD) { - ct.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); + dc.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); } else { - ct.setFillRule(CAIRO_FILL_RULE_WINDING); + dc.setFillRule(CAIRO_FILL_RULE_WINDING); } } - ct.transform(_ctm); - ct.path(_curve->get_pathvector()); - ct.fill(); + dc.transform(_ctm); + dc.path(_curve->get_pathvector()); + dc.fill(); } DrawingItem * diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index 52496d86e..47b9e807e 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -33,9 +33,9 @@ public: protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset); - virtual unsigned _renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, + virtual unsigned _renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at); - virtual void _clipItem(DrawingContext &ct, Geom::IntRect const &area); + virtual void _clipItem(DrawingContext &dc, Geom::IntRect const &area); virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); virtual bool _canClip(); diff --git a/src/display/drawing-surface.cpp b/src/display/drawing-surface.cpp index bddccbd96..94e0e1ab5 100644 --- a/src/display/drawing-surface.cpp +++ b/src/display/drawing-surface.cpp @@ -267,7 +267,7 @@ DrawingCache::prepare() * parameter to the bounds of the region that must be repainted. */ void -DrawingCache::paintFromCache(DrawingContext &ct, Geom::OptIntRect &area) +DrawingCache::paintFromCache(DrawingContext &dc, Geom::OptIntRect &area) { if (!area) return; @@ -296,10 +296,10 @@ DrawingCache::paintFromCache(DrawingContext &ct, Geom::OptIntRect &area) cairo_rectangle_int_t tmp; for (int i = 0; i < nr; ++i) { cairo_region_get_rectangle(cache_region, i, &tmp); - ct.rectangle(_convertRect(tmp)); + dc.rectangle(_convertRect(tmp)); } - ct.setSource(this); - ct.fill(); + dc.setSource(this); + dc.fill(); } cairo_region_destroy(cache_region); } @@ -310,21 +310,21 @@ DrawingCache::_dumpCache(Geom::OptIntRect const &area) { static int dumpnr = 0; cairo_surface_t *surface = ink_cairo_surface_copy(_surface); - DrawingContext ct(surface, _origin); + DrawingContext dc(surface, _origin); if (!cairo_region_is_empty(_clean_region)) { - Inkscape::DrawingContext::Save save(ct); + Inkscape::DrawingContext::Save save(dc); int nr = cairo_region_num_rectangles(_clean_region); cairo_rectangle_int_t tmp; for (int i = 0; i < nr; ++i) { cairo_region_get_rectangle(_clean_region, i, &tmp); - ct.rectangle(_convertRect(tmp)); + dc.rectangle(_convertRect(tmp)); } - ct.setSource(0,1,0,0.1); - ct.fill(); + dc.setSource(0,1,0,0.1); + dc.fill(); } - ct.rectangle(*area); - ct.setSource(1,0,0,0.1); - ct.fill(); + dc.rectangle(*area); + dc.setSource(1,0,0,0.1); + dc.fill(); char *fn = g_strdup_printf("dump%d.png", dumpnr++); cairo_surface_write_to_png(surface, fn); cairo_surface_destroy(surface); diff --git a/src/display/drawing-surface.h b/src/display/drawing-surface.h index 1ec848405..e937cca55 100644 --- a/src/display/drawing-surface.h +++ b/src/display/drawing-surface.h @@ -65,7 +65,7 @@ public: void markClean(Geom::IntRect const &area = Geom::IntRect::infinite()); void scheduleTransform(Geom::IntRect const &new_area, Geom::Affine const &trans); void prepare(); - void paintFromCache(DrawingContext &ct, Geom::OptIntRect &area); + void paintFromCache(DrawingContext &dc, Geom::OptIntRect &area); protected: cairo_region_t *_clean_region; diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index f652a2970..f5a0f0af5 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -195,7 +195,7 @@ DrawingText::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, un return DrawingGroup::_updateItem(area, ctx, flags, reset); } -void DrawingText::decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2) +void DrawingText::decorateStyle(DrawingContext &dc, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2) { double wave[16]={ 0.000000, 0.382499, 0.706825, 0.923651, 1.000000, 0.923651, 0.706825, 0.382499, @@ -235,12 +235,12 @@ pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]); if(_nrstyle.text_decoration_style & TEXT_DECORATION_STYLE_ISDOUBLE){ ps -= Geom::Point(0, vextent/12.0); pf -= Geom::Point(0, vextent/12.0); - ct.moveTo(ps); - ct.lineTo(pf); + dc.moveTo(ps); + dc.lineTo(pf); ps += Geom::Point(0, vextent/6.0); pf += Geom::Point(0, vextent/6.0); - ct.moveTo(ps); - ct.lineTo(pf); + dc.moveTo(ps); + dc.lineTo(pf); } /* The next three have a problem in that they are phase dependent. The bits of a line are not necessarily passing through this routine in order, so we have to use the xphase information @@ -251,14 +251,14 @@ pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]); while(1){ if(dots[i]>0){ if(ps[Geom::X]> pf[Geom::X])break; - ct.moveTo(ps); + dc.moveTo(ps); ps += Geom::Point(step * (double)dots[i], 0.0); if(ps[Geom::X]>= pf[Geom::X]){ - ct.lineTo(pf); + dc.lineTo(pf); break; } else { - ct.lineTo(ps); + dc.lineTo(ps); } ps += Geom::Point(step * 4.0, 0.0); } @@ -272,14 +272,14 @@ pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]); while(1){ if(dashes[i]>0){ if(ps[Geom::X]> pf[Geom::X])break; - ct.moveTo(ps); + dc.moveTo(ps); ps += Geom::Point(step * (double)dashes[i], 0.0); if(ps[Geom::X]>= pf[Geom::X]){ - ct.lineTo(pf); + dc.lineTo(pf); break; } else { - ct.lineTo(ps); + dc.lineTo(ps); } ps += Geom::Point(step * 8.0, 0.0); } @@ -293,23 +293,23 @@ pf = Geom::Point(step * round(p2[Geom::X]/step),p2[Geom::Y]); double amp = vextent/10.0; double x = ps[Geom::X]; double y = ps[Geom::Y]; - ct.moveTo(Geom::Point(x, y + amp * wave[i])); + dc.moveTo(Geom::Point(x, y + amp * wave[i])); while(1){ i = ((i + 1) & 15); x += step; - ct.lineTo(Geom::Point(x, y + amp * wave[i])); + dc.lineTo(Geom::Point(x, y + amp * wave[i])); if(x >= pf[Geom::X])break; } } else { // TEXT_DECORATION_STYLE_SOLID, also default in case it was not set for some reason - ct.moveTo(ps); - ct.lineTo(pf); -// ct.revrectangle(Geom::Rect(ps,pf)); + dc.moveTo(ps); + dc.lineTo(pf); +// dc.revrectangle(Geom::Rect(ps,pf)); } } /* returns scaled line thickness */ -double DrawingText::decorateItem(DrawingContext &ct, Geom::Affine const &aff, double phase_length) +double DrawingText::decorateItem(DrawingContext &dc, Geom::Affine const &aff, double phase_length) { double tsp_width_adj = _nrstyle.tspan_width / _nrstyle.font_size; double tsp_asc_adj = _nrstyle.ascender / _nrstyle.font_size; @@ -321,8 +321,8 @@ double DrawingText::decorateItem(DrawingContext &ct, Geom::Affine const &aff, do double scale = aff.descrim(); double xphase = phase_length/ _nrstyle.font_size; // used to figure out phase of patterns - Inkscape::DrawingContext::Save save(ct); - ct.transform(aff); // must be leftmost affine in span + Inkscape::DrawingContext::Save save(dc); + dc.transform(aff); // must be leftmost affine in span Geom::Point p1; Geom::Point p2; @@ -331,52 +331,52 @@ double DrawingText::decorateItem(DrawingContext &ct, Geom::Affine const &aff, do if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_UNDERLINE){ p1 = Geom::Point(0.0, -_nrstyle.underline_position); p2 = Geom::Point(tsp_width_adj,-_nrstyle.underline_position); - decorateStyle(ct, tsp_size_adj, xphase, p1, p2); + decorateStyle(dc, tsp_size_adj, xphase, p1, p2); } if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_OVERLINE){ p1 = Geom::Point(0.0, tsp_asc_adj -_nrstyle.underline_position + 1 * final_underline_thickness); p2 = Geom::Point(tsp_width_adj,tsp_asc_adj -_nrstyle.underline_position + 1 * final_underline_thickness); - decorateStyle(ct, tsp_size_adj, xphase, p1, p2); + decorateStyle(dc, tsp_size_adj, xphase, p1, p2); } if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_LINETHROUGH){ thickness = final_line_through_thickness; p1 = Geom::Point(0.0, _nrstyle.line_through_position); p2 = Geom::Point(tsp_width_adj,_nrstyle.line_through_position); - decorateStyle(ct, tsp_size_adj, xphase, p1, p2); + decorateStyle(dc, tsp_size_adj, xphase, p1, p2); } // Obviously this does not blink, but it does indicate which text has been set with that attribute if(_nrstyle.text_decoration_line & TEXT_DECORATION_LINE_BLINK){ thickness = final_line_through_thickness; p1 = Geom::Point(0.0, _nrstyle.line_through_position - 2*final_line_through_thickness); p2 = Geom::Point(tsp_width_adj,_nrstyle.line_through_position - 2*final_line_through_thickness); - decorateStyle(ct, tsp_size_adj, xphase, p1, p2); + decorateStyle(dc, tsp_size_adj, xphase, p1, p2); p1 = Geom::Point(0.0, _nrstyle.line_through_position + 2*final_line_through_thickness); p2 = Geom::Point(tsp_width_adj,_nrstyle.line_through_position + 2*final_line_through_thickness); - decorateStyle(ct, tsp_size_adj, xphase, p1, p2); + decorateStyle(dc, tsp_size_adj, xphase, p1, p2); } thickness *= scale; return(thickness); } -unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) +unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*area*/, unsigned /*flags*/, DrawingItem * /*stop_at*/) { if (_drawing.outline()) { guint32 rgba = _drawing.outlinecolor; - Inkscape::DrawingContext::Save save(ct); - ct.setSource(rgba); - ct.setTolerance(0.5); // low quality, but good enough for outline mode + Inkscape::DrawingContext::Save save(dc); + dc.setSource(rgba); + dc.setTolerance(0.5); // low quality, but good enough for outline mode for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { DrawingGlyphs *g = dynamic_cast<DrawingGlyphs *>(&*i); if (!g) throw InvalidItemException(); - Inkscape::DrawingContext::Save save(ct); + Inkscape::DrawingContext::Save save(dc); // skip glyphs with singular transforms if (g->_ctm.isSingular()) continue; - ct.transform(g->_ctm); + dc.transform(g->_ctm); if(g->_drawable){ - ct.path(*g->_font->PathVector(g->_glyph)); - ct.fill(); + dc.path(*g->_font->PathVector(g->_glyph)); + dc.fill(); } } return RENDER_OK; @@ -398,11 +398,11 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are // Therefore, only apply this ctm temporarily. bool has_stroke, has_fill; { - Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); + Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); - has_fill = _nrstyle.prepareFill( ct, _item_bbox); - has_stroke = _nrstyle.prepareStroke(ct, _item_bbox); + has_fill = _nrstyle.prepareFill( dc, _item_bbox); + has_stroke = _nrstyle.prepareStroke(dc, _item_bbox); } if (has_fill || has_stroke) { @@ -418,11 +418,11 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are invset = true; } - Inkscape::DrawingContext::Save save(ct); + Inkscape::DrawingContext::Save save(dc); if (g->_ctm.isSingular()) continue; - ct.transform(g->_ctm); + dc.transform(g->_ctm); if (g->_drawable) { - ct.path(*g->_font->PathVector(g->_glyph)); + dc.path(*g->_font->PathVector(g->_glyph)); } // get the leftmost affine transform (leftmost defined with respect to the x axis of the first transform). // That way the decoration will work no matter what mix of L->R, R->L text is in the span. @@ -448,17 +448,17 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are // draw the text itself // we need to apply this object's ctm again - Inkscape::DrawingContext::Save save(ct); - ct.transform(_ctm); + Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); if (has_fill) { - _nrstyle.applyFill(ct); - ct.fillPreserve(); + _nrstyle.applyFill(dc); + dc.fillPreserve(); } if (has_stroke) { - _nrstyle.applyStroke(ct); - ct.strokePreserve(); + _nrstyle.applyStroke(dc); + dc.strokePreserve(); } - ct.newPath(); // clear path + dc.newPath(); // clear path // draw text decoration if (_nrstyle.text_decoration_line != TEXT_DECORATION_LINE_CLEAR && decorate) { @@ -477,27 +477,27 @@ unsigned DrawingText::_renderItem(DrawingContext &ct, Geom::IntRect const &/*are _nrstyle.fill.color.v.c[2], 1.0); } - ct.setSource(ergba); - ct.setTolerance(0.5); - double thickness = decorateItem(ct, aff, phase_length); - ct.setLineWidth(thickness); - ct.strokePreserve(); - ct.newPath(); // clear path + dc.setSource(ergba); + dc.setTolerance(0.5); + double thickness = decorateItem(dc, aff, phase_length); + dc.setLineWidth(thickness); + dc.strokePreserve(); + dc.newPath(); // clear path } } return RENDER_OK; } -void DrawingText::_clipItem(DrawingContext &ct, Geom::IntRect const &/*area*/) +void DrawingText::_clipItem(DrawingContext &dc, Geom::IntRect const &/*area*/) { - Inkscape::DrawingContext::Save save(ct); + Inkscape::DrawingContext::Save save(dc); // handle clip-rule if (_style) { if (_style->clip_rule.computed == SP_WIND_RULE_EVENODD) { - ct.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); + dc.setFillRule(CAIRO_FILL_RULE_EVEN_ODD); } else { - ct.setFillRule(CAIRO_FILL_RULE_WINDING); + dc.setFillRule(CAIRO_FILL_RULE_WINDING); } } @@ -507,13 +507,13 @@ void DrawingText::_clipItem(DrawingContext &ct, Geom::IntRect const &/*area*/) throw InvalidItemException(); } - Inkscape::DrawingContext::Save save(ct); - ct.transform(g->_ctm); + Inkscape::DrawingContext::Save save(dc); + dc.transform(g->_ctm); if(g->_drawable){ - ct.path(*g->_font->PathVector(g->_glyph)); + dc.path(*g->_font->PathVector(g->_glyph)); } } - ct.fill(); + dc.fill(); } DrawingItem * diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index fd122b54b..b863ca2a4 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -62,14 +62,14 @@ public: protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset); - virtual unsigned _renderItem(DrawingContext &ct, Geom::IntRect const &area, unsigned flags, + virtual unsigned _renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at); - virtual void _clipItem(DrawingContext &ct, Geom::IntRect const &area); + virtual void _clipItem(DrawingContext &dc, Geom::IntRect const &area); virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); virtual bool _canClip(); - double decorateItem(DrawingContext &ct, Geom::Affine const &aff, double phase_length); - void decorateStyle(DrawingContext &ct, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2); + double decorateItem(DrawingContext &dc, Geom::Affine const &aff, double phase_length); + void decorateStyle(DrawingContext &dc, double vextent, double xphase, Geom::Point const &p1, Geom::Point const &p2); NRStyle _nrstyle; friend class DrawingGlyphs; diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp index c192e4565..6e728b03d 100644 --- a/src/display/drawing.cpp +++ b/src/display/drawing.cpp @@ -167,22 +167,22 @@ Drawing::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned fl } void -Drawing::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags) +Drawing::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags) { if (_root) { - _root->render(ct, area, flags); + _root->render(dc, area, flags); } if (colorMode() == COLORMODE_GRAYSCALE) { // apply grayscale filter on top of everything - cairo_surface_t *input = ct.rawTarget(); + cairo_surface_t *input = dc.rawTarget(); cairo_surface_t *out = ink_cairo_surface_create_identical(input); ink_cairo_surface_filter(input, out, _grayscale_colormatrix); - Geom::Point origin = ct.targetLogicalBounds().min(); - ct.setSource(out, origin[Geom::X], origin[Geom::Y]); - ct.setOperator(CAIRO_OPERATOR_SOURCE); - ct.paint(); - ct.setOperator(CAIRO_OPERATOR_OVER); + Geom::Point origin = dc.targetLogicalBounds().min(); + dc.setSource(out, origin[Geom::X], origin[Geom::Y]); + dc.setOperator(CAIRO_OPERATOR_SOURCE); + dc.paint(); + dc.setOperator(CAIRO_OPERATOR_OVER); cairo_surface_destroy(out); } diff --git a/src/display/drawing.h b/src/display/drawing.h index 74ab57fae..cc74833ba 100644 --- a/src/display/drawing.h +++ b/src/display/drawing.h @@ -68,7 +68,7 @@ public: void setGrayscaleMatrix(gdouble value_matrix[20]); void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = DrawingItem::STATE_ALL, unsigned reset = 0); - void render(DrawingContext &ct, Geom::IntRect const &area, unsigned flags = 0); + void render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags); sigc::signal<void, DrawingItem *> signal_request_update; diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 92bb9dcaa..154d1ab32 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -108,17 +108,17 @@ void FilterImage::render_cairo(FilterSlot &slot) Geom::Rect sa = slot.get_slot_area(); cairo_surface_t *out = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sa.width(), sa.height()); - Inkscape::DrawingContext ct(out, sa.min()); - ct.transform(user2pb); // we are now in primitive units - ct.translate(feImageX, feImageY); -// ct.scale(scaleX, scaleY); No scaling should be done + Inkscape::DrawingContext dc(out, sa.min()); + dc.transform(user2pb); // we are now in primitive units + dc.translate(feImageX, feImageY); +// dc.scale(scaleX, scaleY); No scaling should be done Geom::IntRect render_rect = area.roundOutwards(); - ct.translate(render_rect.min()); + dc.translate(render_rect.min()); // Update to renderable state drawing.update(render_rect); - drawing.render(ct, render_rect); + drawing.render(dc, render_rect); SVGElem->invoke_hide(key); // For the moment, we'll assume that any image is in sRGB color space diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 755a30a74..e4c2f048e 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -25,13 +25,13 @@ namespace Inkscape { namespace Filters { -FilterSlot::FilterSlot(DrawingItem *item, DrawingContext *bgct, +FilterSlot::FilterSlot(DrawingItem *item, DrawingContext *bgdc, DrawingContext &graphic, FilterUnits const &u) : _item(item) , _source_graphic(graphic.rawTarget()) - , _background_ct(bgct ? bgct->raw() : NULL) + , _background_ct(bgdc ? bgdc->raw() : NULL) , _source_graphic_area(graphic.targetLogicalBounds().roundOutwards()) // fixme - , _background_area(bgct ? bgct->targetLogicalBounds().roundOutwards() : Geom::IntRect()) // fixme + , _background_area(bgdc ? bgdc->targetLogicalBounds().roundOutwards() : Geom::IntRect()) // fixme , _units(u) , _last_out(NR_FILTER_SOURCEGRAPHIC) , filterquality(FILTER_QUALITY_BEST) diff --git a/src/display/nr-filter-slot.h b/src/display/nr-filter-slot.h index 805027bfe..f3c98b8d9 100644 --- a/src/display/nr-filter-slot.h +++ b/src/display/nr-filter-slot.h @@ -28,7 +28,7 @@ namespace Filters { class FilterSlot { public: /** Creates a new FilterSlot object. */ - FilterSlot(DrawingItem *item, DrawingContext *bgct, + FilterSlot(DrawingItem *item, DrawingContext *bgdc, DrawingContext &graphic, FilterUnits const &u); /** Destroys the FilterSlot object and all its contents */ virtual ~FilterSlot(); diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index af9c15cd8..11984ba76 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -98,7 +98,7 @@ Filter::~Filter() } -int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, DrawingContext *bgct) +int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, DrawingContext *bgdc) { if (_primitive.empty()) { // when no primitives are defined, clear source graphic @@ -150,7 +150,7 @@ int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, D } } - FilterSlot slot(const_cast<Inkscape::DrawingItem*>(item), bgct, graphic, units); + FilterSlot slot(const_cast<Inkscape::DrawingItem*>(item), bgdc, graphic, units); slot.set_quality(filterquality); slot.set_blurquality(blurquality); diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index 5df38ffe9..f9dcf1d84 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -28,12 +28,12 @@ namespace Filters { class Filter { public: - /** Given background state from @a bgct and an intermediate rendering from the surface + /** Given background state from @a bgdc and an intermediate rendering from the surface * backing @a graphic, modify the contents of the surface backing @a graphic to represent * the results of filter rendering. @a bgarea and @a area specify bounding boxes * of both surfaces in world coordinates; Cairo contexts are assumed to be in default state * (0,0 = surface origin, no path, OVER operator) */ - int render(Inkscape::DrawingItem const *item, DrawingContext &graphic, DrawingContext *bgct); + int render(Inkscape::DrawingItem const *item, DrawingContext &graphic, DrawingContext *bgdc); /** * Creates a new filter primitive under this filter object. diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 317f38635..403b139e0 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -207,14 +207,14 @@ void NRStyle::set(SPStyle *style) update(); } -bool NRStyle::prepareFill(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox) +bool NRStyle::prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox) { // update fill pattern if (!fill_pattern) { switch (fill.type) { case PAINT_SERVER: { - //fill_pattern = sp_paint_server_create_pattern(fill.server, ct.raw(), paintbox, fill.opacity); - fill_pattern = fill.server->pattern_new(ct.raw(), paintbox, fill.opacity); + //fill_pattern = sp_paint_server_create_pattern(fill.server, dc.raw(), paintbox, fill.opacity); + fill_pattern = fill.server->pattern_new(dc.raw(), paintbox, fill.opacity); } break; case PAINT_COLOR: { @@ -229,19 +229,19 @@ bool NRStyle::prepareFill(Inkscape::DrawingContext &ct, Geom::OptRect const &pai return true; } -void NRStyle::applyFill(Inkscape::DrawingContext &ct) +void NRStyle::applyFill(Inkscape::DrawingContext &dc) { - ct.setSource(fill_pattern); - ct.setFillRule(fill_rule); + dc.setSource(fill_pattern); + dc.setFillRule(fill_rule); } -bool NRStyle::prepareStroke(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox) +bool NRStyle::prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox) { if (!stroke_pattern) { switch (stroke.type) { case PAINT_SERVER: { - //stroke_pattern = sp_paint_server_create_pattern(stroke.server, ct.raw(), paintbox, stroke.opacity); - stroke_pattern = stroke.server->pattern_new(ct.raw(), paintbox, stroke.opacity); + //stroke_pattern = sp_paint_server_create_pattern(stroke.server, dc.raw(), paintbox, stroke.opacity); + stroke_pattern = stroke.server->pattern_new(dc.raw(), paintbox, stroke.opacity); } break; case PAINT_COLOR: { @@ -256,14 +256,14 @@ bool NRStyle::prepareStroke(Inkscape::DrawingContext &ct, Geom::OptRect const &p return true; } -void NRStyle::applyStroke(Inkscape::DrawingContext &ct) +void NRStyle::applyStroke(Inkscape::DrawingContext &dc) { - ct.setSource(stroke_pattern); - ct.setLineWidth(stroke_width); - ct.setLineCap(line_cap); - ct.setLineJoin(line_join); - ct.setMiterLimit(miter_limit); - cairo_set_dash(ct.raw(), dash, n_dash, dash_offset); // fixme + dc.setSource(stroke_pattern); + dc.setLineWidth(stroke_width); + dc.setLineCap(line_cap); + dc.setLineJoin(line_join); + dc.setMiterLimit(miter_limit); + cairo_set_dash(dc.raw(), dash, n_dash, dash_offset); // fixme } void NRStyle::update() diff --git a/src/display/nr-style.h b/src/display/nr-style.h index 8fd736cc3..e54eef547 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -28,10 +28,10 @@ struct NRStyle { ~NRStyle(); void set(SPStyle *); - bool prepareFill(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox); - bool prepareStroke(Inkscape::DrawingContext &ct, Geom::OptRect const &paintbox); - void applyFill(Inkscape::DrawingContext &ct); - void applyStroke(Inkscape::DrawingContext &ct); + bool prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox); + bool prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox); + void applyFill(Inkscape::DrawingContext &dc); + void applyStroke(Inkscape::DrawingContext &dc); void update(); enum PaintType { diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index cd4f539ec..1ba6628c5 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -140,10 +140,10 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); if (cairo_surface_status(surface) == CAIRO_STATUS_SUCCESS) { - Inkscape::DrawingContext ct(surface, Geom::Point(0,0)); + Inkscape::DrawingContext dc(surface, Geom::Point(0,0)); // render items - drawing.render(ct, final_bbox, Inkscape::DrawingItem::RENDER_BYPASS_CACHE); + drawing.render(dc, final_bbox, Inkscape::DrawingItem::RENDER_BYPASS_CACHE); inkpb = new Inkscape::Pixbuf(surface); } diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index a16fe8e12..a7ebe7423 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -335,14 +335,14 @@ sp_export_get_rows(guchar const **rows, void **to_free, int row, int num_rows, v cairo_surface_t *s = cairo_image_surface_create_for_data( px, CAIRO_FORMAT_ARGB32, ebp->width, num_rows, stride); - Inkscape::DrawingContext ct(s, bbox.min()); - ct.setSource(ebp->background); - ct.setOperator(CAIRO_OPERATOR_SOURCE); - ct.paint(); - ct.setOperator(CAIRO_OPERATOR_OVER); + Inkscape::DrawingContext dc(s, bbox.min()); + dc.setSource(ebp->background); + dc.setOperator(CAIRO_OPERATOR_SOURCE); + dc.paint(); + dc.setOperator(CAIRO_OPERATOR_OVER); /* Render */ - ebp->drawing->render(ct, bbox); + ebp->drawing->render(dc, bbox); cairo_surface_destroy(s); *to_free = px; diff --git a/src/sp-mesh-array.cpp b/src/sp-mesh-array.cpp index 5a204e8b0..ab14e75d2 100644 --- a/src/sp-mesh-array.cpp +++ b/src/sp-mesh-array.cpp @@ -1925,10 +1925,10 @@ guint SPMeshNodeArray::color_pick( std::vector<guint> icorners, SPItem* item ) { /* Find visible area */ cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, ibox.width(), ibox.height()); - Inkscape::DrawingContext ct(s, ibox.min()); + Inkscape::DrawingContext dc(s, ibox.min()); /* Render copy and pick color */ - pick_drawing->render(ct, ibox); + pick_drawing->render(dc, ibox); double R = 0, G = 0, B = 0, A = 0; ink_cairo_surface_average_color(s, R, G, B, A); cairo_surface_destroy(s); diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 711f26428..425ca9efa 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -639,25 +639,25 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b // Create drawing surface with size of pattern tile (in tile space) but with number of pixels // based on required resolution (c). Inkscape::DrawingSurface pattern_surface(pattern_tile, c.ceil()); - Inkscape::DrawingContext ct(pattern_surface); + Inkscape::DrawingContext dc(pattern_surface); pattern_tile *= pattern_surface.drawingTransform(); Geom::IntRect one_tile = pattern_tile.roundOutwards(); // render pattern. if (needs_opacity) { - ct.pushGroup(); // this group is for pattern + opacity + dc.pushGroup(); // this group is for pattern + opacity } // TODO: make sure there are no leaks. Inkscape::UpdateContext ctx; // UpdateContext is structure with only ctm! ctx.ctm = vb2ps * pattern_surface.drawingTransform(); - ct.transform( pattern_surface.drawingTransform().inverse() ); + dc.transform( pattern_surface.drawingTransform().inverse() ); drawing.update(Geom::IntRect::infinite(), ctx); // Render drawing to pattern_surface via drawing context, this calls root->render // which is really DrawingItem->render(). - drawing.render(ct, one_tile); + drawing.render(dc, one_tile); for (SPObject *child = shown->firstChild() ; child != NULL; child = child->getNext() ) { if (SP_IS_ITEM (child)) { SP_ITEM(child)->invoke_hide(dkey); @@ -673,8 +673,8 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b // cairo_surface_write_to_png( pattern_surface.raw(), "sp-pattern.png" ); if (needs_opacity) { - ct.popGroupToSource(); // pop raw pattern - ct.paint(opacity); // apply opacity + dc.popGroupToSource(); // pop raw pattern + dc.paint(opacity); // apply opacity } cairo_pattern_t *cp = cairo_pattern_create_for_surface(pattern_surface.raw()); diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp index a09489f6d..f1d6304cb 100644 --- a/src/ui/cache/svg_preview_cache.cpp +++ b/src/ui/cache/svg_preview_cache.cpp @@ -56,9 +56,9 @@ GdkPixbuf* render_pixbuf(Inkscape::Drawing &drawing, double scale_factor, Geom:: /* Render */ cairo_surface_t *s = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, psize, psize); - Inkscape::DrawingContext ct(s, area.min()); + Inkscape::DrawingContext dc(s, area.min()); - drawing.render(ct, area, Inkscape::DrawingItem::RENDER_BYPASS_CACHE); + drawing.render(dc, area, Inkscape::DrawingItem::RENDER_BYPASS_CACHE); cairo_surface_flush(s); GdkPixbuf* pixbuf = ink_pixbuf_create_from_cairo_surface(s); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 87c399339..fb131d8da 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -2063,9 +2063,9 @@ guint32 CloneTiler::clonetiler_trace_pick(Geom::Rect box) /* Find visible area */ cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, ibox.width(), ibox.height()); - Inkscape::DrawingContext ct(s, ibox.min()); + Inkscape::DrawingContext dc(s, ibox.min()); /* Render */ - trace_drawing->render(ct, ibox); + trace_drawing->render(dc, ibox); double R = 0, G = 0, B = 0, A = 0; ink_cairo_surface_average_color(s, R, G, B, A); cairo_surface_destroy(s); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 0b72bc9f2..4e29b8856 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -794,7 +794,7 @@ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, boo cairo_surface_t *s = cairo_image_surface_create_for_data( px, CAIRO_FORMAT_ARGB32, width, height, stride); - Inkscape::DrawingContext ct(s, Geom::Point(0,0)); + Inkscape::DrawingContext dc(s, Geom::Point(0,0)); // cairo_translate not necessary here - surface origin is at 0,0 SPNamedView *nv = sp_desktop_namedview(desktop); @@ -802,12 +802,12 @@ static void sp_flood_do_flood_fill(ToolBase *event_context, GdkEvent *event, boo // bgcolor is 0xrrggbbaa, we need 0xaarrggbb dtc = (bgcolor >> 8) | (bgcolor << 24); - ct.setSource(bgcolor); - ct.setOperator(CAIRO_OPERATOR_SOURCE); - ct.paint(); - ct.setOperator(CAIRO_OPERATOR_OVER); + dc.setSource(bgcolor); + dc.setOperator(CAIRO_OPERATOR_SOURCE); + dc.paint(); + dc.setOperator(CAIRO_OPERATOR_OVER); - drawing.render(ct, final_bbox); + drawing.render(dc, final_bbox); //cairo_surface_write_to_png( s, "cairo.png" ); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index a9c30ee8f..eb16cfece 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -1190,9 +1190,9 @@ sp_icon_doc_icon( SPDocument *doc, Inkscape::Drawing &drawing, /* Render */ cairo_surface_t *s = cairo_image_surface_create_for_data(px, CAIRO_FORMAT_ARGB32, psize, psize, stride); - Inkscape::DrawingContext ct(s, ua.min()); + Inkscape::DrawingContext dc(s, ua.min()); - drawing.render(ct, ua); + drawing.render(dc, ua); cairo_surface_destroy(s); // convert to GdkPixbuf format |
