[Libreoffice-commits] core.git: 3 commits - drawinglayer/Library_drawinglayer.mk drawinglayer/source include/drawinglayer vcl/source writerfilter/source

Armin Le Grand alg at apache.org
Wed Jun 12 12:32:16 PDT 2013


 drawinglayer/Library_drawinglayer.mk                       |    1 
 drawinglayer/source/processor2d/vclhelpergradient.cxx      |  253 -------------
 drawinglayer/source/processor2d/vclhelpergradient.hxx      |   54 --
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   22 -
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx    |   39 +-
 drawinglayer/source/processor2d/vclprocessor2d.cxx         |  130 ------
 include/drawinglayer/processor2d/vclprocessor2d.hxx        |    2 
 vcl/source/gdi/bitmap3.cxx                                 |   30 -
 writerfilter/source/dmapper/DomainMapper.cxx               |    2 
 writerfilter/source/dmapper/PropertyMap.cxx                |    2 
 10 files changed, 44 insertions(+), 491 deletions(-)

New commits:
commit 529ab257f10490a3e7d4f13ddabbc9374b84d529
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Jun 12 20:27:24 2013 +0100

    Small correction in scaling code seen while debugging something else
    
    (cherry picked from commit 101e1cced456f1effd5b4daaa469c2817e34a448)
    
    Change-Id: Ib373406a44c00d812dc754d8091c94cb6a64a1b0

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 5bcdb9f..250f188 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -2395,39 +2395,43 @@ sal_Bool Bitmap::ImplScaleConvolution(
     {
         const sal_uInt32 nInBetweenSizeHorFirst(nHeight * nNewWidth);
         const sal_uInt32 nInBetweenSizeVerFirst(nNewHeight * nWidth);
+        Bitmap aSource(*this);
 
-        Bitmap aInterm;
         if(nInBetweenSizeHorFirst < nInBetweenSizeVerFirst)
         {
             if(bScaleHor)
             {
-                bResult = ImplScaleConvolutionHor(*this, aInterm, fScaleX, aKernel);
+                bResult = ImplScaleConvolutionHor(aSource, aResult, fScaleX, aKernel);
             }
-            else
-                aInterm = *this;
 
             if(bResult && bScaleVer)
             {
-                bResult = ImplScaleConvolutionVer(aInterm, aResult, fScaleY, aKernel);
+                if(bScaleHor)
+                {
+                    // copy partial result, independent of color depth
+                    aSource = aResult;
+                }
+
+                bResult = ImplScaleConvolutionVer(aSource, aResult, fScaleY, aKernel);
             }
-            else
-                aResult = aInterm;
         }
         else
         {
             if(bScaleVer)
             {
-                bResult = ImplScaleConvolutionVer(*this, aInterm, fScaleY, aKernel);
+                bResult = ImplScaleConvolutionVer(aSource, aResult, fScaleY, aKernel);
             }
-            else
-                aInterm = *this;
 
             if(bResult && bScaleHor)
             {
-                bResult = ImplScaleConvolutionHor(aInterm, aResult, fScaleX, aKernel);
+                if(bScaleVer)
+                {
+                    // copy partial result, independent of color depth
+                    aSource = aResult;
+                }
+
+                bResult = ImplScaleConvolutionHor(aSource, aResult, fScaleX, aKernel);
             }
-            else
-                aResult = aInterm;
         }
     }
 
commit 4696292b9a9c7096b7ee6c98711bdcdfb7af7101
Author: Pavel Janík <paveljanik at apache.org>
Date:   Thu Nov 29 15:34:35 2012 +0000

    Fix typo
    
    (cherry picked from commit 497e0d2ce2169a70aa2d2182fa1cf3096b8b2fbc)
    
    Change-Id: I9cf246c94236382bc9d58e3a76c855951dd5166a

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 2e571d9..8b7f7e8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2424,7 +2424,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     case NS_sprm::LN_SBkc: // sprmSBkc
         /* break type
           0 - No break
-          1 - New Colunn
+          1 - New Column
           2 - New page
           3 - Even page
           4 - odd page
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index ebd5497..05fcfe2 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1035,7 +1035,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
                 //now apply this break at the first paragraph of this section
                 uno::Reference<beans::XPropertySet> xRangeProperties(lcl_GetRangeProperties(m_bIsFirstSection, rDM_Impl, m_xStartingRange));
             /* break type
-            0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
+            0 - No break 1 - New Column 2 - New page 3 - Even page 4 - odd page */
                 if ((m_bTitlePage && m_bIsFirstSection) || !m_bTitlePage)
                 {
                     if (xRangeProperties.is())
commit f69df53b316b53931e10d35402a70f533399398c
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Nov 29 11:34:59 2012 +0000

    Resolves: #i121297# corrected non-AAed gradient rendering...
    
    when in rotated metafiles
    
    (cherry picked from commit 2a063da1614a8044fdd2c64a55f4f402b69e2fcd)
    
    Conflicts:
    	drawinglayer/Library_drawinglayer.mk
    	drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
    	drawinglayer/source/processor2d/vclhelpergradient.cxx
    	drawinglayer/source/processor2d/vclhelpergradient.hxx
    	drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
    	drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
    
    Change-Id: I0e4ff1d3bebbc738fb6d301da19747faa2efbe3d

diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 93014a8..a8e92b1 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -145,7 +145,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/processor2d/vclhelperbitmaprender \
     drawinglayer/source/processor2d/vclhelperbitmaptransform \
     drawinglayer/source/processor2d/vclhelperbufferdevice \
-    drawinglayer/source/processor2d/vclhelpergradient \
     drawinglayer/source/processor2d/vclmetafileprocessor2d \
     drawinglayer/source/processor2d/vclpixelprocessor2d \
     drawinglayer/source/processor2d/vclprocessor2d \
diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx
deleted file mode 100644
index 245e850..0000000
--- a/drawinglayer/source/processor2d/vclhelpergradient.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <vclhelpergradient.hxx>
-#include <basegfx/range/b2drange.hxx>
-#include <vcl/outdev.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <drawinglayer/texture/texture.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// support methods for vcl direct gradient renderering
-
-namespace drawinglayer
-{
-    namespace
-    {
-        sal_uInt32 impCalcGradientSteps(OutputDevice& rOutDev, sal_uInt32 nSteps, const basegfx::B2DRange& rRange, sal_uInt32 nMaxDist)
-        {
-            if(nSteps == 0L)
-            {
-                const Size aSize(rOutDev.LogicToPixel(Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight()))));
-                nSteps = (aSize.getWidth() + aSize.getHeight()) >> 3L;
-            }
-
-            if(nSteps < 2L)
-            {
-                nSteps = 2L;
-            }
-
-            if(nSteps > nMaxDist)
-            {
-                nSteps = nMaxDist;
-            }
-
-            return nSteps;
-        }
-
-        void impDrawGradientToOutDevSimple(
-            OutputDevice& rOutDev,
-            const basegfx::B2DPolyPolygon& rTargetForm,
-            const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
-            const basegfx::BColor& rOutmostColor,
-            const basegfx::B2DPolygon& rUnitPolygon)
-        {
-            rOutDev.SetLineColor();
-            rOutDev.SetFillColor(Color(rOutmostColor));
-            rOutDev.DrawPolyPolygon(rTargetForm);
-            const sal_uInt32 nCount(rEntries.size());
-
-            for(sal_uInt32 a(0); a < nCount; a++)
-            {
-                // create part polygon
-                basegfx::B2DPolygon aNewPoly(rUnitPolygon);
-
-                aNewPoly.transform(rEntries[a].maB2DHomMatrix);
-
-                // create solid fill
-                rOutDev.SetFillColor(Color(rEntries[a].maBColor));
-                rOutDev.DrawPolygon(aNewPoly);
-            }
-        }
-
-        void impDrawGradientToOutDevComplex(
-            OutputDevice& rOutDev,
-            const basegfx::B2DPolyPolygon& rTargetForm,
-            const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries,
-            const basegfx::BColor& rOutmostColor,
-            const basegfx::B2DPolygon& rUnitPolygon)
-        {
-            PolyPolygon aVclTargetForm(rTargetForm);
-            ::std::vector< Polygon > aVclPolygons;
-            const sal_uInt32 nCount(rEntries.size());
-            sal_uInt32 a;
-
-            // reserve when possible
-            aVclPolygons.reserve(nCount);
-
-            // remember and set to XOR
-            rOutDev.SetLineColor();
-            rOutDev.Push(PUSH_RASTEROP);
-            rOutDev.SetRasterOp(ROP_XOR);
-
-            // draw gradient PolyPolygons
-            for(a = 0; a < nCount; a++)
-            {
-                // create polygon and remember
-                basegfx::B2DPolygon aNewPoly(rUnitPolygon);
-                aNewPoly.transform(rEntries[a].maB2DHomMatrix);
-                aVclPolygons.push_back(Polygon(aNewPoly));
-
-                // create vcl PolyPolygon and draw it
-                if(a)
-                {
-                    rOutDev.SetFillColor(Color(rEntries[a - 1].maBColor));
-                    PolyPolygon aVclPolyPoly(aVclPolygons[a - 1]);
-                    aVclPolyPoly.Insert(aVclPolygons[a]);
-                    rOutDev.DrawPolyPolygon(aVclPolyPoly);
-                }
-                else
-                {
-                    rOutDev.SetFillColor(Color(rOutmostColor));
-                    PolyPolygon aVclPolyPoly(aVclTargetForm);
-                    aVclPolyPoly.Insert(aVclPolygons[0]);
-                    rOutDev.DrawPolyPolygon(aVclPolyPoly);
-                }
-            }
-
-            // draw last poly in last color
-            if(nCount)
-            {
-                rOutDev.SetFillColor(Color(rEntries[nCount - 1].maBColor));
-                rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1]);
-            }
-
-            // draw object form in black and go back to XOR
-            rOutDev.SetFillColor(COL_BLACK);
-            rOutDev.SetRasterOp(ROP_0);
-            rOutDev.DrawPolyPolygon(aVclTargetForm);
-            rOutDev.SetRasterOp(ROP_XOR);
-
-            // draw gradient PolyPolygons again
-            for(a = 0; a < nCount; a++)
-            {
-                // create vcl PolyPolygon and draw it
-                if(a)
-                {
-                    rOutDev.SetFillColor(Color(rEntries[a - 1].maBColor));
-                    PolyPolygon aVclPolyPoly(aVclPolygons[a - 1]);
-                    aVclPolyPoly.Insert(aVclPolygons[a]);
-                    rOutDev.DrawPolyPolygon(aVclPolyPoly);
-                }
-                else
-                {
-                    rOutDev.SetFillColor(Color(rOutmostColor));
-                    PolyPolygon aVclPolyPoly(aVclTargetForm);
-                    aVclPolyPoly.Insert(aVclPolygons[0]);
-                    rOutDev.DrawPolyPolygon(aVclPolyPoly);
-                }
-            }
-
-            // draw last poly in last color
-            if(nCount)
-            {
-                rOutDev.SetFillColor(Color(rEntries[nCount - 1].maBColor));
-                rOutDev.DrawPolygon(aVclPolygons[aVclPolygons.size() - 1]);
-            }
-
-            // reset drawmode
-            rOutDev.Pop();
-        }
-    } // end of anonymous namespace
-} // end of namespace drawinglayer
-
-namespace drawinglayer
-{
-    void impDrawGradientToOutDev(
-        OutputDevice& rOutDev,
-        const basegfx::B2DPolyPolygon& rTargetForm,
-        attribute::GradientStyle eGradientStyle,
-        sal_uInt32 nSteps,
-        const basegfx::BColor& rStart,
-        const basegfx::BColor& rEnd,
-        double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple)
-    {
-        const basegfx::B2DRange aOutlineRange(basegfx::tools::getRange(rTargetForm));
-        std::vector< drawinglayer::texture::B2DHomMatrixAndBColor > aEntries;
-        basegfx::BColor aOutmostColor;
-        basegfx::B2DPolygon aUnitPolygon;
-
-        // make sure steps is not too high/low
-        nSteps = impCalcGradientSteps(rOutDev, nSteps, aOutlineRange, sal_uInt32((rStart.getMaximumDistance(rEnd) * 127.5) + 0.5));
-
-        // create geometries
-        switch(eGradientStyle)
-        {
-            case attribute::GRADIENTSTYLE_LINEAR:
-            {
-                texture::GeoTexSvxGradientLinear aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
-                break;
-            }
-            case attribute::GRADIENTSTYLE_AXIAL:
-            {
-                texture::GeoTexSvxGradientAxial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fAngle);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
-                break;
-            }
-            case attribute::GRADIENTSTYLE_RADIAL:
-            {
-                texture::GeoTexSvxGradientRadial aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetY);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1);
-                break;
-            }
-            case attribute::GRADIENTSTYLE_ELLIPTICAL:
-            {
-                texture::GeoTexSvxGradientElliptical aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0,0), 1);
-                break;
-            }
-            case attribute::GRADIENTSTYLE_SQUARE:
-            {
-                texture::GeoTexSvxGradientSquare aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
-                break;
-            }
-            case attribute::GRADIENTSTYLE_RECT:
-            {
-                texture::GeoTexSvxGradientRect aGradient(aOutlineRange, rStart, rEnd, nSteps, fBorder, fOffsetX, fOffsetX, fAngle);
-                aGradient.appendTransformationsAndColors(aEntries, aOutmostColor);
-                aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(-1, -1, 1, 1));
-                break;
-            }
-        }
-
-        // paint them with mask using the XOR method
-        if(aEntries.size())
-        {
-            if(bSimple)
-            {
-                impDrawGradientToOutDevSimple(rOutDev, rTargetForm, aEntries, aOutmostColor, aUnitPolygon);
-            }
-            else
-            {
-                impDrawGradientToOutDevComplex(rOutDev, rTargetForm, aEntries, aOutmostColor, aUnitPolygon);
-            }
-        }
-    }
-} // end of namespace drawinglayer
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx
deleted file mode 100644
index 053886c..0000000
--- a/drawinglayer/source/processor2d/vclhelpergradient.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX
-#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX
-
-#include <sal/types.h>
-#include <drawinglayer/attribute/fillgradientattribute.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// predefines
-
-class OutputDevice;
-namespace basegfx {
-    class B2DPolyPolygon;
-    class BColor;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-// support methods for vcl direct gradient renderering
-
-namespace drawinglayer
-{
-    void impDrawGradientToOutDev(
-        OutputDevice& rOutDev,
-        const basegfx::B2DPolyPolygon& rTargetForm,
-        attribute::GradientStyle eGradientStyle,
-        sal_uInt32 nSteps,
-        const basegfx::BColor& rStart,
-        const basegfx::BColor& rEnd,
-        double fBorder, double fAngle, double fOffsetX, double fOffsetY, bool bSimple);
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 3511e57..acf1a7e 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -27,7 +27,6 @@
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
 #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
-#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
 #include <basegfx/polygon/b2dpolygonclipper.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
@@ -1645,9 +1644,6 @@ namespace drawinglayer
                         impStartSvtGraphicFill(pSvtGraphicFill);
                         mpOutputDevice->DrawGradient(aToolsPolyPolygon, aVCLGradient);
                         impEndSvtGraphicFill(pSvtGraphicFill);
-
-                        // NO usage of common own gradient randerer, not used ATM for VCL MetaFile, see text above
-                        // RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate));
                     }
 
                     break;
@@ -1712,24 +1708,6 @@ namespace drawinglayer
 
                     break;
                 }
-                case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
-                {
-                    static bool bUseMetaFilePrimitiveDecomposition(true);
-                    const primitive2d::MetafilePrimitive2D& aMetafile = static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate);
-
-                    if(bUseMetaFilePrimitiveDecomposition && !aMetafile.getMetaFile().GetUseCanvas())
-                    {
-                        // use new Metafile decomposition
-                        process(rCandidate.get2DDecomposition(getViewInformation2D()));
-                    }
-                    else
-                    {
-                        // direct draw of MetaFile, use default pocessing
-                        RenderMetafilePrimitive2D(aMetafile);
-                    }
-
-                    break;
-                }
                 case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
                 {
                     // mask group. Special handling for MetaFiles.
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 1f2d518..fdf3e68 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -188,7 +188,29 @@ namespace drawinglayer
                 case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D :
                 {
                     // direct draw of gradient
-                    RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate));
+                    const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate);
+                    const attribute::FillGradientAttribute& rGradient(rPolygonCandidate.getFillGradient());
+                    basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor()));
+                    basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor()));
+                    basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
+
+                    if(aLocalPolyPolygon.count())
+                    {
+                        aLocalPolyPolygon.transform(maCurrentTransformation);
+
+                        if(aStartColor == aEndColor)
+                        {
+                            // no gradient at all, draw as polygon in AA and non-AA case
+                            mpOutputDevice->SetLineColor();
+                            mpOutputDevice->SetFillColor(Color(aStartColor));
+                            mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
+                        }
+                        else
+                        {
+                            // use the primitive decomposition of the metafile
+                            process(rPolygonCandidate.get2DDecomposition(getViewInformation2D()));
+                        }
+                    }
                     break;
                 }
                 case PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D :
@@ -214,19 +236,8 @@ namespace drawinglayer
                         mpOutputDevice->SetAntialiasing(nOldAntiAliase | ANTIALIASING_PIXELSNAPHAIRLINE);
                     }
 
-                    const primitive2d::MetafilePrimitive2D& rMetafilePrimitive( static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate) );
-
-                    static bool bTestMetaFilePrimitiveDecomposition( true );
-                    if( bTestMetaFilePrimitiveDecomposition && !rMetafilePrimitive.getMetaFile().GetUseCanvas() )
-                    {
-                        // use new Metafile decomposition
-                        process(rCandidate.get2DDecomposition(getViewInformation2D()));
-                    }
-                    else
-                    {
-                        // direct draw of MetaFile
-                        RenderMetafilePrimitive2D( rMetafilePrimitive );
-                    }
+                    // use new Metafile decomposition
+                    process(rCandidate.get2DDecomposition(getViewInformation2D()));
 
                     if(bForceLineSnap)
                     {
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 8a2ddcc..f67b982 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -31,7 +31,6 @@
 #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
 #include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx>
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <vclhelpergradient.hxx>
 #include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
@@ -696,44 +695,6 @@ namespace drawinglayer
             }
         }
 
-        // direct draw of gradient
-        void VclProcessor2D::RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate)
-        {
-            const attribute::FillGradientAttribute& rGradient(rPolygonCandidate.getFillGradient());
-            basegfx::BColor aStartColor(maBColorModifierStack.getModifiedColor(rGradient.getStartColor()));
-            basegfx::BColor aEndColor(maBColorModifierStack.getModifiedColor(rGradient.getEndColor()));
-            basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
-
-            if(aLocalPolyPolygon.count())
-            {
-                aLocalPolyPolygon.transform(maCurrentTransformation);
-
-                if(aStartColor == aEndColor)
-                {
-                    // no gradient at all, draw as polygon in AA and non-AA case
-                    mpOutputDevice->SetLineColor();
-                    mpOutputDevice->SetFillColor(Color(aStartColor));
-                    mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
-                }
-                else if(getOptionsDrawinglayer().IsAntiAliasing())
-                {
-                    // For AA, direct render has to be avoided since it uses XOR maskings which will not
-                    // work with AA. Instead, the decompose which uses MaskPrimitive2D with fillings is
-                    // used
-                    process(rPolygonCandidate.get2DDecomposition(getViewInformation2D()));
-                }
-                else
-                {
-                    static bool bSimple = false; // allow testing simple paint in debugger
-
-                    impDrawGradientToOutDev(
-                        *mpOutputDevice, aLocalPolyPolygon, rGradient.getStyle(), rGradient.getSteps(),
-                        aStartColor, aEndColor, rGradient.getBorder(),
-                        rGradient.getAngle(), rGradient.getOffsetX(), rGradient.getOffsetY(), bSimple);
-                }
-            }
-        }
-
         // direct draw of Graphic
         void VclProcessor2D::RenderPolyPolygonGraphicPrimitive2D(const primitive2d::PolyPolygonGraphicPrimitive2D& rPolygonCandidate)
         {
@@ -921,97 +882,6 @@ namespace drawinglayer
             }
         }
 
-        // direct draw of MetaFile
-        void VclProcessor2D::RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate)
-        {
-            // decompose matrix to check for shear, rotate and mirroring
-            basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rMetaCandidate.getTransform());
-            basegfx::B2DVector aScale, aTranslate;
-            double fRotate, fShearX;
-            aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
-            if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
-            {
-                // #i102175# handle special case: If scale is negative in (x,y) (3rd quadrant), it can
-                // be expressed as rotation by PI. This needs to be done for Metafiles since
-                // these can be rotated, but not really mirrored
-                aScale = basegfx::absolute(aScale);
-                fRotate += F_PI;
-            }
-
-            // get BoundRect
-            basegfx::B2DRange aOutlineRange(rMetaCandidate.getB2DRange(getViewInformation2D()));
-            aOutlineRange.transform(maCurrentTransformation);
-
-            // Due to the integer MapModes used from VCL aind inside MetaFiles errors of up to three
-            // pixels in size may happen. As long as there is no better way (e.g. convert the MetaFile
-            // to primitives) it is necessary to reduce maximum pixel size by 1 in X and Y and to use
-            // the inner pixel bounds accordingly (ceil resp. floor). This will also be done for logic
-            // units e.g. when creating a new MetaFile, but since much huger value ranges are used
-            // there typically will be okay for this compromize.
-            Rectangle aDestRectView(
-                // !!CAUTION!! Here, ceil and floor are exchanged BY PURPOSE, do NOT copy when
-                // looking for a standard conversion to rectangle (!)
-                (sal_Int32)ceil(aOutlineRange.getMinX()), (sal_Int32)ceil(aOutlineRange.getMinY()),
-                (sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY()));
-
-            // get metafile (copy it)
-            GDIMetaFile aMetaFile;
-
-            if(maBColorModifierStack.count())
-            {
-                const basegfx::BColor aRGBBaseColor(0, 0, 0);
-                const basegfx::BColor aRGBColor(maBColorModifierStack.getModifiedColor(aRGBBaseColor));
-                aMetaFile = rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
-            }
-            else
-            {
-                aMetaFile = rMetaCandidate.getMetaFile();
-            }
-
-            // rotation
-            if(!basegfx::fTools::equalZero(fRotate))
-            {
-                // #i103530#
-                // MetaFile::Rotate has no input parameter check, so the parameter needs to be
-                // well-aligned to the old range [0..3600] 10th degrees with inverse orientation
-                sal_Int16 nRotation((sal_Int16)((fRotate / F_PI180) * -10.0));
-
-                while(nRotation < 0)
-                    nRotation += 3600;
-
-                while(nRotation >= 3600)
-                    nRotation -= 3600;
-
-                aMetaFile.Rotate(nRotation);
-            }
-
-            // Prepare target output size
-            Size aDestSize(aDestRectView.GetSize());
-
-            if(aDestSize.getWidth() && aDestSize.getHeight())
-            {
-                // Get preferred Metafile output size. When it's very equal to the output size, it's probably
-                // a rounding error somewhere, so correct it to get a 1:1 output without single pixel scalings
-                // of the Metafile (esp. for contaned Bitmaps, e.g 3D charts)
-                const Size aPrefSize(mpOutputDevice->LogicToPixel(aMetaFile.GetPrefSize(), aMetaFile.GetPrefMapMode()));
-
-                if(aPrefSize.getWidth() && (aPrefSize.getWidth() - 1 == aDestSize.getWidth() || aPrefSize.getWidth() + 1 == aDestSize.getWidth()))
-                {
-                    aDestSize.setWidth(aPrefSize.getWidth());
-                }
-
-                if(aPrefSize.getHeight() && (aPrefSize.getHeight() - 1 == aDestSize.getHeight() || aPrefSize.getHeight() + 1 == aDestSize.getHeight()))
-                {
-                    aDestSize.setHeight(aPrefSize.getHeight());
-                }
-
-                // paint it
-                aMetaFile.WindStart();
-                aMetaFile.Play(mpOutputDevice, aDestRectView.TopLeft(), aDestSize);
-            }
-        }
-
         // mask group. Force output to VDev and create mask from given mask
         void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate)
         {
diff --git a/include/drawinglayer/processor2d/vclprocessor2d.hxx b/include/drawinglayer/processor2d/vclprocessor2d.hxx
index aa0d878..2995b34 100644
--- a/include/drawinglayer/processor2d/vclprocessor2d.hxx
+++ b/include/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -94,10 +94,8 @@ namespace drawinglayer
             void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
             void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
             void RenderFillGraphicPrimitive2D(const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate);
-            void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
             void RenderPolyPolygonGraphicPrimitive2D(const primitive2d::PolyPolygonGraphicPrimitive2D& rPolygonCandidate);
             void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate);
-            void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate);
             void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate);
             void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate);
             void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate);


More information about the Libreoffice-commits mailing list