Kaydet (Commit) 11ccf88e authored tarafından Christina Rossmanith's avatar Christina Rossmanith Kaydeden (comit) Fridrich Štrba

SVG import: keep aspect ratio when transforming viewbox to viewport

üst 7d7e2c36
...@@ -293,12 +293,13 @@ struct AnnotatingVisitor ...@@ -293,12 +293,13 @@ struct AnnotatingVisitor
maCurrState.maViewBox.getWidth() != 0.0 && maCurrState.maViewBox.getWidth() != 0.0 &&
maCurrState.maViewBox.getHeight() != 0.0 ) maCurrState.maViewBox.getHeight() != 0.0 )
{ {
// transform aViewBox into viewport, such that they // transform aViewBox into viewport, keep aspect ratio
// coincide
aLocalTransform.translate(-maCurrState.maViewBox.getMinX(), aLocalTransform.translate(-maCurrState.maViewBox.getMinX(),
-maCurrState.maViewBox.getMinY()); -maCurrState.maViewBox.getMinY());
aLocalTransform.scale(maCurrState.maViewport.getWidth()/maCurrState.maViewBox.getWidth(), double scaleW = maCurrState.maViewport.getWidth()/maCurrState.maViewBox.getWidth();
maCurrState.maViewport.getHeight()/maCurrState.maViewBox.getHeight()); double scaleH = maCurrState.maViewport.getHeight()/maCurrState.maViewBox.getHeight();
double scale = (scaleW < scaleH) ? scaleW : scaleH;
aLocalTransform.scale(scale,scale);
} }
maCurrState.maCTM = maCurrState.maCTM*maCurrState.maTransform*aLocalTransform; maCurrState.maCTM = maCurrState.maCTM*maCurrState.maTransform*aLocalTransform;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment