diff options
| author | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-05-17 02:00:23 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-05-17 02:00:23 +0000 |
| commit | c418ce3ee56b7b31832fa801996439ce8256e5e7 (patch) | |
| tree | 8972313381d2e410aedf674d66fef812a455b457 /src/sp-pattern.cpp | |
| parent | Commit patch for "leaned" cap. Thanks Jabiertxof! (diff) | |
| parent | Fix GTK+ 3 build (diff) | |
| download | inkscape-c418ce3ee56b7b31832fa801996439ce8256e5e7.tar.gz inkscape-c418ce3ee56b7b31832fa801996439ce8256e5e7.zip | |
Update to experimental (r13376)
(bzr r13090.1.79)
Diffstat (limited to 'src/sp-pattern.cpp')
| -rw-r--r-- | src/sp-pattern.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index e465565c4..9aa54eadf 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -541,6 +541,16 @@ static bool pattern_hasItemChildren (SPPattern const *pat) return hasChildren; } +bool SPPattern::isValid() const +{ + double tile_width = pattern_width(this); + double tile_height = pattern_height(this); + + if (tile_width <= 0 || tile_height <= 0) + return false; + return true; +} + cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &bbox, double opacity) { bool needs_opacity = (1.0 - opacity) >= 1e-3; @@ -593,7 +603,7 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b double tile_y = pattern_y(this); double tile_width = pattern_width(this); double tile_height = pattern_height(this); - if (pattern_patternUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) { + if ( bbox && (pattern_patternUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) ) { tile_x *= bbox->width(); tile_y *= bbox->height(); tile_width *= bbox->width(); @@ -614,7 +624,7 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b } else { // Content to bbox - if (pattern_patternContentUnits (this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) { + if (bbox && (pattern_patternContentUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) ) { content2ps = Geom::Affine(bbox->width(), 0.0, 0.0, bbox->height(), 0,0); } } |
