summaryrefslogtreecommitdiffstats
path: root/src/object/sp-hatch.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-05-13 09:35:32 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-05-13 09:35:32 +0000
commit050e61fd30a14e72b65fb198e078c05441779893 (patch)
treec79745336e77378f3dd65a1b4bd28d2a5f9ae856 /src/object/sp-hatch.cpp
parentAllow embed on SVG imports (diff)
downloadinkscape-050e61fd30a14e72b65fb198e078c05441779893.tar.gz
inkscape-050e61fd30a14e72b65fb198e078c05441779893.zip
Fix rendering of hatches when hatchContentUnits and hatchUnits have different values.
Diffstat (limited to 'src/object/sp-hatch.cpp')
-rw-r--r--src/object/sp-hatch.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/object/sp-hatch.cpp b/src/object/sp-hatch.cpp
index f1958a53b..ce6384a74 100644
--- a/src/object/sp-hatch.cpp
+++ b/src/object/sp-hatch.cpp
@@ -611,6 +611,10 @@ SPHatch::RenderInfo SPHatch::_calculateRenderInfo(View const &view) const
tile_x *= view.bbox->width();
tile_y *= view.bbox->height();
tile_width *= view.bbox->width();
+ }
+
+ // Extent calculated using content units, need to correct.
+ if (view.bbox && (hatchContentUnits() == UNITS_OBJECTBOUNDINGBOX)) {
tile_height *= view.bbox->height();
tile_render_y *= view.bbox->height();
}
@@ -634,6 +638,14 @@ SPHatch::RenderInfo SPHatch::_calculateRenderInfo(View const &view) const
if (style->overflow.computed == SP_CSS_OVERFLOW_VISIBLE) {
Geom::Interval bounds = this->bounds();
gdouble pitch = this->pitch();
+ if (view.bbox) {
+ if (hatchUnits() == UNITS_OBJECTBOUNDINGBOX) {
+ pitch *= view.bbox->width();
+ }
+ if (hatchContentUnits() == UNITS_OBJECTBOUNDINGBOX) {
+ bounds *= view.bbox->width();
+ }
+ }
gdouble overflow_right_strip = floor(bounds.max() / pitch) * pitch;
info.overflow_steps = ceil((overflow_right_strip - bounds.min()) / pitch) + 1;
info.overflow_step_transform = Geom::Translate(pitch, 0.0);
@@ -671,7 +683,7 @@ Geom::OptInterval SPHatch::_calculateStripExtents(Geom::OptRect const &bbox) con
}
}
- if (hatchUnits() == UNITS_OBJECTBOUNDINGBOX) {
+ if (hatchContentUnits() == UNITS_OBJECTBOUNDINGBOX) {
extents /= bbox->height();
}