diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2014-10-18 00:03:52 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2014-10-18 00:03:52 +0000 |
| commit | 74d18f102cb65a67ac5d8640085878284362eaeb (patch) | |
| tree | 2909e8f61cdd955c928684bc7fdeb6b831190f8f /src/sp-hatch-path.h | |
| parent | Port inkscape to librevenge framework for WPG, CDR and VSD imports (diff) | |
| download | inkscape-74d18f102cb65a67ac5d8640085878284362eaeb.tar.gz inkscape-74d18f102cb65a67ac5d8640085878284362eaeb.zip | |
Refactoring hatch to remove memory leaks (bad GTKish casting macros) and uninitialized value.
(bzr r13622)
Diffstat (limited to 'src/sp-hatch-path.h')
| -rw-r--r-- | src/sp-hatch-path.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/sp-hatch-path.h b/src/sp-hatch-path.h index 57b3a8237..11fc274ec 100644 --- a/src/sp-hatch-path.h +++ b/src/sp-hatch-path.h @@ -1,8 +1,11 @@ -/** @file +/** + * @file * SVG <hatchPath> implementation - *//* + */ +/* * Author: * Tomasz Boczkowski <penginsbacon@gmail.com> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2014 Tomasz Boczkowski * @@ -26,43 +29,44 @@ class DrawingShape; } -#define SP_HATCH_PATH(obj) (dynamic_cast<SPHatchPath*>((SPObject*)obj)) -#define SP_IS_HATCH_PATH(obj) (dynamic_cast<const SPHatchPath*>((SPObject*)obj) != NULL) - class SPHatchPath : public SPObject { public: SPHatchPath(); - virtual ~SPHatchPath(); + virtual ~SPHatchPath(); - SVGLength offset; + SVGLength offset; - void setCurve(SPCurve *curve, bool owner); + void setCurve(SPCurve *curve, bool owner); bool isValid() const; Inkscape::DrawingItem *show(Inkscape::Drawing &drawing, unsigned int key, Geom::OptInterval extents); void hide(unsigned int key); - void setStripExtents(unsigned int key, Geom::OptInterval const &extents); - Geom::Interval bounds() const; + void setStripExtents(unsigned int key, Geom::OptInterval const &extents); + Geom::Interval bounds() const; - SPCurve *calculateRenderCurve(unsigned key) const; + SPCurve *calculateRenderCurve(unsigned key) const; protected: - virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void release(); - virtual void set(unsigned int key, const gchar* value); - virtual void update(SPCtx* ctx, unsigned int flags); + virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); + virtual void release(); + virtual void set(unsigned int key, const gchar* value); + virtual void update(SPCtx* ctx, unsigned int flags); private: - struct View { + class View { + public: View(Inkscape::DrawingShape *arenaitem, int key); //Do not delete arenaitem in destructor. + ~View(); + Inkscape::DrawingShape *arenaitem; Geom::OptInterval extents; unsigned int key; }; + typedef std::list<SPHatchPath::View>::iterator ViewIterator; typedef std::list<SPHatchPath::View>::const_iterator ConstViewIterator; std::list<View> _display; |
