drawinglayer/source/attribute/sdrfillgraphicattribute.cxx | 22 ++++++++++- include/drawinglayer/attribute/sdrfillgraphicattribute.hxx | 2 + svx/source/sdr/primitive2d/sdrattributecreator.cxx | 24 ++++++++----- 3 files changed, 36 insertions(+), 12 deletions(-)
New commits: commit 01541c21b61fc1f26e452196b79324344c868f8e Author: Armin Le Grand <a...@apache.org> Date: Thu Jan 9 15:58:41 2014 +0000 Resolves: #i124002# use own logical size for graphics... do not adapt PrefSize of these in rendering stack (cherry picked from commit b57f921795c7249d82ca739884c0116574426194) Conflicts: drawinglayer/source/attribute/sdrfillgraphicattribute.cxx Change-Id: I3eff4438a42209ad4c259dfdbed4869ae046bfc6 diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index 0b1af9c..217e7ab 100755 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -33,6 +33,7 @@ namespace drawinglayer public: // data definitions Graphic maFillGraphic; + basegfx::B2DVector maGraphicLogicSize; basegfx::B2DVector maSize; basegfx::B2DVector maOffset; basegfx::B2DVector maOffsetPosition; @@ -45,6 +46,7 @@ namespace drawinglayer ImpSdrFillGraphicAttribute( const Graphic& rFillGraphic, + const basegfx::B2DVector& rGraphicLogicSize, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, const basegfx::B2DVector& rOffsetPosition, @@ -53,6 +55,7 @@ namespace drawinglayer bool bStretch, bool bLogSize) : maFillGraphic(rFillGraphic), + maGraphicLogicSize(rGraphicLogicSize), maSize(rSize), maOffset(rOffset), maOffsetPosition(rOffsetPosition), @@ -65,6 +68,7 @@ namespace drawinglayer ImpSdrFillGraphicAttribute() : maFillGraphic(Graphic()), + maGraphicLogicSize(basegfx::B2DVector()), maSize(basegfx::B2DVector()), maOffset(basegfx::B2DVector()), maOffsetPosition(basegfx::B2DVector()), @@ -77,6 +81,7 @@ namespace drawinglayer // data read access const Graphic& getFillGraphic() const { return maFillGraphic; } + const basegfx::B2DVector& getGraphicLogicSize() const { return maGraphicLogicSize; } const basegfx::B2DVector& getSize() const { return maSize; } const basegfx::B2DVector& getOffset() const { return maOffset; } const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; } @@ -88,6 +93,7 @@ namespace drawinglayer bool operator==(const ImpSdrFillGraphicAttribute& rCandidate) const { return (getFillGraphic() == rCandidate.getFillGraphic() + && getGraphicLogicSize() == rCandidate.getGraphicLogicSize() && getSize() == rCandidate.getSize() && getOffset() == rCandidate.getOffset() && getOffsetPosition() == rCandidate.getOffsetPosition() @@ -106,6 +112,7 @@ namespace drawinglayer SdrFillGraphicAttribute::SdrFillGraphicAttribute( const Graphic& rFillGraphic, + const basegfx::B2DVector& rGraphicLogicSize, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, const basegfx::B2DVector& rOffsetPosition, @@ -116,6 +123,7 @@ namespace drawinglayer : mpSdrFillGraphicAttribute( ImpSdrFillGraphicAttribute( rFillGraphic, + rGraphicLogicSize, rSize, rOffset, rOffsetPosition, @@ -161,6 +169,11 @@ namespace drawinglayer return mpSdrFillGraphicAttribute->getFillGraphic(); } + const basegfx::B2DVector& SdrFillGraphicAttribute::getGraphicLogicSize() const + { + return mpSdrFillGraphicAttribute->getGraphicLogicSize(); + } + const basegfx::B2DVector& SdrFillGraphicAttribute::getSize() const { return mpSdrFillGraphicAttribute->getSize(); @@ -200,7 +213,6 @@ namespace drawinglayer { // get logical size of bitmap (before expanding eventually) Graphic aGraphic(getFillGraphic()); - const basegfx::B2DVector aLogicalSize(aGraphic.GetPrefSize().getWidth(), aGraphic.GetPrefSize().getHeight()); // init values with defaults basegfx::B2DPoint aBitmapSize(1.0, 1.0); @@ -228,7 +240,9 @@ namespace drawinglayer } else { - aBitmapSize.setX(aLogicalSize.getX()); + // #i124002# use GraphicLogicSize directly, do not try to use GetPrefSize + // of the graphic, that may not be adapted to the MapMode of the target + aBitmapSize.setX(getGraphicLogicSize().getX()); } if(0.0 != getSize().getY()) @@ -244,7 +258,9 @@ namespace drawinglayer } else { - aBitmapSize.setY(aLogicalSize.getY()); + // #i124002# use GraphicLogicSize directly, do not try to use GetPrefSize + // of the graphic, that may not be adapted to the MapMode of the target + aBitmapSize.setY(getGraphicLogicSize().getY()); } // get values, force to centered if necessary diff --git a/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx index 600db24..67aacd4 100644 --- a/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx +++ b/include/drawinglayer/attribute/sdrfillgraphicattribute.hxx @@ -55,6 +55,7 @@ namespace drawinglayer /// constructors/assignmentoperator/destructor SdrFillGraphicAttribute( const Graphic& rFillGraphic, + const basegfx::B2DVector& rGraphicLogicSize, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, const basegfx::B2DVector& rOffsetPosition, @@ -75,6 +76,7 @@ namespace drawinglayer // data read access const Graphic& getFillGraphic() const; + const basegfx::B2DVector& getGraphicLogicSize() const; const basegfx::B2DVector& getSize() const; const basegfx::B2DVector& getOffset() const; const basegfx::B2DVector& getOffsetPosition() const; diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index fcfba85..240cc8c 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -642,26 +642,31 @@ namespace drawinglayer // convert size and MapMode to destination logical size and MapMode const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0)); + basegfx::B2DVector aGraphicLogicSize(aGraphic.GetPrefSize().Width(), aGraphic.GetPrefSize().Height()); if(aGraphic.GetPrefMapMode() != aDestinationMapUnit) { // #i100360# for MAP_PIXEL, LogicToLogic will not work properly, // so fallback to Application::GetDefaultDevice() + Size aNewSize(0, 0); + if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit()) { - aGraphic.SetPrefSize( - Application::GetDefaultDevice()->PixelToLogic( - aGraphic.GetPrefSize(), - aDestinationMapUnit)); + aNewSize = Application::GetDefaultDevice()->PixelToLogic( + aGraphic.GetPrefSize(), + aDestinationMapUnit); } else { - aGraphic.SetPrefSize( - OutputDevice::LogicToLogic( - aGraphic.GetPrefSize(), - aGraphic.GetPrefMapMode(), - aDestinationMapUnit)); + aNewSize = OutputDevice::LogicToLogic( + aGraphic.GetPrefSize(), + aGraphic.GetPrefMapMode(), + aDestinationMapUnit); } + + // #i124002# do not set new size using SetPrefSize at the graphic, this will lead to problems. + // Instead, adapt the GraphicLogicSize which will be used for further decompositions + aGraphicLogicSize = basegfx::B2DVector(aNewSize.Width(), aNewSize.Height()); } // get size @@ -677,6 +682,7 @@ namespace drawinglayer return attribute::SdrFillGraphicAttribute( aGraphic, + aGraphicLogicSize, aSize, aOffset, aOffsetPosition, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits