Author: alg
Date: Thu Jan  9 15:58:41 2014
New Revision: 1556850

URL: http://svn.apache.org/r1556850
Log:
i124002 use own logical size for graphics, do not adapt PrefSize of these in 
rendering stack

Modified:
    
openoffice/trunk/main/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
    
openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
    openoffice/trunk/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx

Modified: 
openoffice/trunk/main/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx?rev=1556850&r1=1556849&r2=1556850&view=diff
==============================================================================
--- 
openoffice/trunk/main/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
 (original)
+++ 
openoffice/trunk/main/drawinglayer/inc/drawinglayer/attribute/sdrfillgraphicattribute.hxx
 Thu Jan  9 15:58:41 2014
@@ -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;

Modified: 
openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx?rev=1556850&r1=1556849&r2=1556850&view=diff
==============================================================================
--- 
openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx 
(original)
+++ 
openoffice/trunk/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx 
Thu Jan  9 15:58:41 2014
@@ -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()
@@ -105,6 +110,7 @@ namespace drawinglayer
                                    Graphic(),
                         basegfx::B2DVector(),
                         basegfx::B2DVector(),
+                        basegfx::B2DVector(),
                                    basegfx::B2DVector(),
                         basegfx::B2DVector(),
                                    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

Modified: 
openoffice/trunk/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx?rev=1556850&r1=1556849&r2=1556850&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
(original)
+++ openoffice/trunk/main/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
Thu Jan  9 15:58:41 2014
@@ -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,


Reply via email to