From 165aa67187ef6e5b61515d08891ab9f42333f2c8 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Fri, 16 May 2014 14:54:52 +0200 Subject: Fix crash in preview widget for files containing objectBoundingBox related patterns (bzr r13341.1.31) --- src/sp-pattern.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-pattern.cpp') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index e465565c4..9e9ce85f3 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -593,7 +593,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 (pattern_patternUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX && bbox) { tile_x *= bbox->width(); tile_y *= bbox->height(); tile_width *= bbox->width(); @@ -614,7 +614,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 (pattern_patternContentUnits (this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX && bbox) { content2ps = Geom::Affine(bbox->width(), 0.0, 0.0, bbox->height(), 0,0); } } -- cgit v1.2.3 From a8ed8893594a2e0f609beba7dc9bee86df408b01 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 16 May 2014 19:31:40 +0200 Subject: don't rely on operator precedence (rev. 13372) (bzr r13341.1.32) --- src/sp-pattern.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-pattern.cpp') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 9e9ce85f3..cc82c637e 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -593,7 +593,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 && bbox) { + if ( bbox && (pattern_patternUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) ) { tile_x *= bbox->width(); tile_y *= bbox->height(); tile_width *= bbox->width(); @@ -614,7 +614,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 && bbox) { + if (bbox && (pattern_patternContentUnits(this) == SP_PATTERN_UNITS_OBJECTBOUNDINGBOX) ) { content2ps = Geom::Affine(bbox->width(), 0.0, 0.0, bbox->height(), 0,0); } } -- cgit v1.2.3 From b4c6736390839c53251011ab5c536e020c02bda0 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Fri, 16 May 2014 22:53:46 +0200 Subject: fix compliance test pservers-pattern-03-f - using fallback when pattern is empty (bzr r13341.1.34) --- src/sp-pattern.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/sp-pattern.cpp') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index cc82c637e..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; -- cgit v1.2.3 From 344da57dece53a28426168c50d5802670bc9e4b9 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Sat, 17 May 2014 11:27:41 +0200 Subject: fix compliance test pservers-pattern-04-f - inheriting pattern viewBox (bzr r13341.1.36) --- src/sp-pattern.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/sp-pattern.cpp') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 9aa54eadf..9b7330a24 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -615,9 +615,10 @@ cairo_pattern_t* SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b // Content to tile (pattern space) Geom::Affine content2ps; - if (this->viewBox_set) { + Geom::OptRect effective_view_box = pattern_viewBox(this); + if (effective_view_box) { // viewBox to pattern server (using SPViewBox) - viewBox = *pattern_viewBox(this); + viewBox = *effective_view_box; c2p.setIdentity(); apply_viewbox( pattern_tile ); content2ps = c2p; -- cgit v1.2.3 From a5e84125b62bf41871b57d93e457db81ee139485 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Mon, 18 Aug 2014 17:18:05 -0400 Subject: Fix build (not pretty). (bzr r13341.1.146) --- src/sp-pattern.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/sp-pattern.cpp') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 9b7330a24..961ab0f84 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -18,7 +18,9 @@ #include #include +#include #include <2geom/transforms.h> + #include "macros.h" #include "svg/svg.h" #include "display/cairo-utils.h" -- cgit v1.2.3