[Libreoffice-commits] core.git: vcl/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Fri May 15 13:44:33 UTC 2020


 vcl/source/gdi/print2.cxx |   97 +++++++++++++++++++++-------------------------
 1 file changed, 45 insertions(+), 52 deletions(-)

New commits:
commit 6fa6704a7e7c6970b7a7c695a4a548f8dc693d03
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue May 12 06:55:02 2020 +1000
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri May 15 15:43:54 2020 +0200

    vcl: move functionality out of checkRect(), rendering function obsolete
    
    Change-Id: Iabbc82d9b31438169351eca370ae42729babd10a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94022
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 481cafcf814e..e5ace36db0ac 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -100,25 +100,6 @@ bool doesRectCoverWithUniformColor(
         rMapModeVDev.IsFillColor());
 }
 
-/** Check whether rCurrRect rectangle fully covers io_rPrevRect - if
-    yes, return true and update o_rBgColor
- */
-bool checkRect( tools::Rectangle&       io_rPrevRect,
-                       Color&           o_rBgColor,
-                       const tools::Rectangle& rCurrRect,
-                       OutputDevice const &    rMapModeVDev )
-{
-    bool bRet = doesRectCoverWithUniformColor(io_rPrevRect, rCurrRect, rMapModeVDev);
-
-    if( bRet )
-    {
-        io_rPrevRect = rCurrRect;
-        o_rBgColor = rMapModeVDev.GetFillColor();
-    }
-
-    return bRet;
-}
-
 /** #107169# Convert BitmapEx to Bitmap with appropriately blended
     color. Convert MetaTransparentAction to plain polygon,
     appropriately colored
@@ -713,72 +694,84 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
             {
                 case MetaActionType::RECT:
                 {
-                    if( !checkRect(
-                            aBackgroundComponent.aBounds,
-                            aBackgroundComponent.aBgColor,
-                            static_cast<const MetaRectAction*>(pCurrAct)->GetRect(),
-                            *aMapModeVDev) )
+                    const tools::Rectangle aRect(
+                        static_cast<const MetaRectAction*>(pCurrAct)->GetRect());
+
+                    if (!doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+                    {
+                        aBackgroundComponent.aBounds = aRect;
+                        aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
                         bStillBackground=false; // incomplete occlusion of background
+                    }
                     else
+                    {
                         nLastBgAction=nActionNum; // this _is_ background
+                    }
                     break;
                 }
                 case MetaActionType::POLYGON:
                 {
                     const tools::Polygon aPoly(
                         static_cast<const MetaPolygonAction*>(pCurrAct)->GetPolygon());
-                    if( !basegfx::utils::isRectangle(
-                            aPoly.getB2DPolygon()) ||
-                        !checkRect(
-                            aBackgroundComponent.aBounds,
-                            aBackgroundComponent.aBgColor,
-                            aPoly.GetBoundRect(),
-                            *aMapModeVDev) )
+                    const tools::Rectangle aRect(aPoly.GetBoundRect());
+
+                    if (!basegfx::utils::isRectangle(aPoly.getB2DPolygon()) ||
+                        !doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+                    {
+                        aBackgroundComponent.aBounds = aRect;
+                        aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
                         bStillBackground=false; // incomplete occlusion of background
+                    }
                     else
+                    {
                         nLastBgAction=nActionNum; // this _is_ background
+                    }
                     break;
                 }
                 case MetaActionType::POLYPOLYGON:
                 {
                     const tools::PolyPolygon aPoly(
                         static_cast<const MetaPolyPolygonAction*>(pCurrAct)->GetPolyPolygon());
-                    if( aPoly.Count() != 1 ||
-                        !basegfx::utils::isRectangle(
-                            aPoly[0].getB2DPolygon()) ||
-                        !checkRect(
-                            aBackgroundComponent.aBounds,
-                            aBackgroundComponent.aBgColor,
-                            aPoly.GetBoundRect(),
-                            *aMapModeVDev) )
+                    const tools::Rectangle aRect(aPoly.GetBoundRect());
+
+                    if (aPoly.Count() != 1 ||
+                        !basegfx::utils::isRectangle(aPoly[0].getB2DPolygon()) ||
+                        !doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+                    {
+                        aBackgroundComponent.aBounds = aRect;
+                        aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
                         bStillBackground=false; // incomplete occlusion of background
+                    }
                     else
+                    {
                         nLastBgAction=nActionNum; // this _is_ background
+                    }
                     break;
                 }
                 case MetaActionType::WALLPAPER:
                 {
-                    if( !checkRect(
-                            aBackgroundComponent.aBounds,
-                            aBackgroundComponent.aBgColor,
-                            static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(),
-                            *aMapModeVDev) )
+                    const tools::Rectangle aRect(
+                        static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect());
+
+                    if (!doesRectCoverWithUniformColor(aBackgroundComponent.aBounds, aRect, *aMapModeVDev))
+                    {
+                        aBackgroundComponent.aBounds = aRect;
+                        aBackgroundComponent.aBgColor = aMapModeVDev->GetFillColor();
                         bStillBackground=false; // incomplete occlusion of background
+                    }
                     else
+                    {
                         nLastBgAction=nActionNum; // this _is_ background
+                    }
                     break;
                 }
                 default:
                 {
-                    if( ImplIsNotTransparent( *pCurrAct,
-                                              *aMapModeVDev ) )
-                        bStillBackground=false; // non-transparent action, possibly
-                                                // not uniform
+                    if (ImplIsNotTransparent( *pCurrAct, *aMapModeVDev))
+                        bStillBackground=false; // non-transparent action, possibly not uniform
                     else
-                        // extend current bounds (next uniform action
-                        // needs to fully cover this area)
-                        aBackgroundComponent.aBounds.Union(
-                            ImplCalcActionBounds(*pCurrAct, *aMapModeVDev) );
+                        // extend current bounds (next uniform action needs to fully cover this area)
+                        aBackgroundComponent.aBounds.Union(ImplCalcActionBounds(*pCurrAct, *aMapModeVDev));
                     break;
                 }
             }


More information about the Libreoffice-commits mailing list