[Libreoffice-commits] core.git: Branch 'aoo/trunk' - drawinglayer/inc drawinglayer/source svx/source

Armin Le Grand alg at apache.org
Thu Jan 9 08:08:10 PST 2014


 drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx |    2 
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx           |   22 +++++++--
 svx/source/sdr/primitive2d/sdrattributecreator.cxx                  |   24 ++++++----
 3 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit b57f921795c7249d82ca739884c0116574426194
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Jan 9 15:58:41 2014 +0000

    i124002 use own logical size for graphics, do not adapt PrefSize of these in rendering stack

diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
index 3a4acac..095d407 100755
--- a/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
+++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
@@ -56,6 +56,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,
@@ -76,6 +77,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/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index 77fa080..aeba381 100755
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -42,6 +42,7 @@ namespace drawinglayer
 
             // data definitions
             Graphic                                 maFillGraphic;
+            basegfx::B2DVector                      maGraphicLogicSize;
             basegfx::B2DVector                      maSize;
             basegfx::B2DVector                      maOffset;
             basegfx::B2DVector                      maOffsetPosition;
@@ -54,6 +55,7 @@ namespace drawinglayer
 
             ImpSdrFillGraphicAttribute(
                 const Graphic& rFillGraphic,
+                const basegfx::B2DVector& rGraphicLogicSize,
                 const basegfx::B2DVector& rSize,
                 const basegfx::B2DVector& rOffset,
                 const basegfx::B2DVector& rOffsetPosition,
@@ -63,6 +65,7 @@ namespace drawinglayer
                 bool bLogSize)
             :   mnRefCount(0),
                 maFillGraphic(rFillGraphic),
+                maGraphicLogicSize(rGraphicLogicSize),
                 maSize(rSize),
                 maOffset(rOffset),
                 maOffsetPosition(rOffsetPosition),
@@ -75,6 +78,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; }
@@ -86,6 +90,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()
@@ -107,6 +112,7 @@ namespace drawinglayer
                         basegfx::B2DVector(),
                         basegfx::B2DVector(),
                         basegfx::B2DVector(),
+                        basegfx::B2DVector(),
                         false,
                         false,
                         false);
@@ -121,6 +127,7 @@ namespace drawinglayer
 
         SdrFillGraphicAttribute::SdrFillGraphicAttribute(
             const Graphic& rFillGraphic,
+            const basegfx::B2DVector& rGraphicLogicSize,
             const basegfx::B2DVector& rSize,
             const basegfx::B2DVector& rOffset,
             const basegfx::B2DVector& rOffsetPosition,
@@ -131,6 +138,7 @@ namespace drawinglayer
         :   mpSdrFillGraphicAttribute(
                 new ImpSdrFillGraphicAttribute(
                     rFillGraphic,
+                    rGraphicLogicSize,
                     rSize,
                     rOffset,
                     rOffsetPosition,
@@ -210,6 +218,11 @@ namespace drawinglayer
             return mpSdrFillGraphicAttribute->getFillGraphic();
         }
 
+        const basegfx::B2DVector& SdrFillGraphicAttribute::getGraphicLogicSize() const
+        {
+            return mpSdrFillGraphicAttribute->getGraphicLogicSize();
+        }
+
         const basegfx::B2DVector& SdrFillGraphicAttribute::getSize() const
         {
             return mpSdrFillGraphicAttribute->getSize();
@@ -249,7 +262,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);
@@ -277,7 +289,9 @@ namespace drawinglayer
                 }
                 else
                 {
-                    aBitmapSize.setX(aLogicalSize.getX());
+                    // #124002# 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())
@@ -293,7 +307,9 @@ namespace drawinglayer
                 }
                 else
                 {
-                    aBitmapSize.setY(aLogicalSize.getY());
+                    // #124002# 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/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index a218bc9..2c0b511 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -647,26 +647,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);
                 }
+
+                // #124002# 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
@@ -682,6 +687,7 @@ namespace drawinglayer
 
             return attribute::SdrFillGraphicAttribute(
                 aGraphic,
+                aGraphicLogicSize,
                 aSize,
                 aOffset,
                 aOffsetPosition,


More information about the Libreoffice-commits mailing list