[PATCH 3/4] DecoView cleanup - Embed OutputDevice::ImplDraw2ColorFrame

Matteo Casalin matteo.casalin at poste.it
Sun Dec 4 06:25:04 PST 2011


---
 vcl/inc/vcl/outdev.hxx         |    1 -
 vcl/source/gdi/outdev6.cxx     |   14 -------
 vcl/source/window/decoview.cxx |   76 +++++++++++++++++++++++-----------------
 3 files changed, 44 insertions(+), 47 deletions(-)

diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index 17b94db..d2d3809 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -489,7 +489,6 @@ public:
     SAL_DLLPRIVATE void         ImplDrawColorWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
     SAL_DLLPRIVATE void         ImplDrawBitmapWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
     SAL_DLLPRIVATE void         ImplDrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
-    SAL_DLLPRIVATE void         ImplDraw2ColorFrame( const Rectangle& rRect, const Color& rLeftTopColor, const Color& rRightBottomColor );
 
     SAL_DLLPRIVATE void         ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pPosAry );
     SAL_DLLPRIVATE void         ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 8800fd4..098d36d 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -1170,20 +1170,6 @@ void OutputDevice::Erase()
 
 // -----------------------------------------------------------------------
 
-void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect,
-                                        const Color& rLeftTopColor,
-                                        const Color& rRightBottomColor )
-{
-    SetFillColor( rLeftTopColor );
-    DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
-    DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
-    SetFillColor( rRightBottomColor );
-    DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
-    DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
-}
-
-// -----------------------------------------------------------------------
-
 bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
                             const GfxLink& rGfxLink, GDIMetaFile* pSubst )
 {
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 452bbb4..58f425c 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -481,6 +481,18 @@ void ImplDrawDPILineRect( OutputDevice *const pDev, Rectangle& rRect,
 }
 
 
+void ImplDraw2ColorFrame( OutputDevice *const pDev, const Rectangle& rRect,
+                          const Color& rLeftTopColor, const Color& rRightBottomColor )
+{
+    pDev->SetFillColor( rLeftTopColor );
+    pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
+    pDev->DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
+    pDev->SetFillColor( rRightBottomColor );
+    pDev->DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
+    pDev->DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
+}
+
+
 void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
                      const sal_uInt16 nStyle )
 {
@@ -599,7 +611,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
 
         pDev->SetLineColor();
 
-        pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+        ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
         ++aFillRect.Left();
         ++aFillRect.Top();
         --aFillRect.Right();
@@ -620,7 +632,7 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
                     aColor1 = rStyleSettings.GetLightBorderColor();
                 aColor2 = rStyleSettings.GetShadowColor();
             }
-            pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+            ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
             ++aFillRect.Left();
             ++aFillRect.Top();
             --aFillRect.Right();
@@ -698,7 +710,7 @@ void DecorationView::DrawFrame( const Rectangle& rRect,
     sal_Bool        bOldMapMode     = mpOutDev->IsMapModeEnabled();
     mpOutDev->EnableMapMode( sal_False );
     mpOutDev->SetLineColor();
-    mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
+    ImplDraw2ColorFrame( mpOutDev, aRect, rLeftTopColor, rRightBottomColor );
     mpOutDev->SetLineColor( aOldLineColor );
     mpOutDev->SetFillColor( aOldFillColor );
     mpOutDev->EnableMapMode( bOldMapMode );
@@ -903,15 +915,15 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
                 {
                     if ( nFrameStyle == FRAME_DRAW_IN )
                     {
-                        pDev->ImplDraw2ColorFrame( rRect,
-                                                   rStyleSettings.GetShadowColor(),
-                                                   rStyleSettings.GetLightColor() );
+                        ImplDraw2ColorFrame( pDev, rRect,
+                                             rStyleSettings.GetShadowColor(),
+                                             rStyleSettings.GetLightColor() );
                     }
                     else
                     {
-                        pDev->ImplDraw2ColorFrame( rRect,
-                                                   rStyleSettings.GetLightColor(),
-                                                   rStyleSettings.GetShadowColor() );
+                        ImplDraw2ColorFrame( pDev, rRect,
+                                             rStyleSettings.GetLightColor(),
+                                             rStyleSettings.GetShadowColor() );
                     }
 
                     rRect.Left()++;
@@ -924,26 +936,26 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
                     if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
                     {
                         if( bFlatBorders ) // no 3d effect
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                    rStyleSettings.GetShadowColor(),
-                                                    rStyleSettings.GetShadowColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetShadowColor(),
+                                                 rStyleSettings.GetShadowColor() );
                         else
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                    rStyleSettings.GetShadowColor(),
-                                                    rStyleSettings.GetLightColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetShadowColor(),
+                                                 rStyleSettings.GetLightColor() );
                     }
                     else
                     {
                         if( bMenuStyle )
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                   rStyleSettings.GetMenuBorderColor(),
-                                                   rStyleSettings.GetDarkShadowColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetMenuBorderColor(),
+                                                 rStyleSettings.GetDarkShadowColor() );
                         else
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                   bFlatBorders ? // no 3d effect
-                                                   rStyleSettings.GetDarkShadowColor() :
-                                                   rStyleSettings.GetLightBorderColor(),
-                                                   rStyleSettings.GetDarkShadowColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 bFlatBorders ? // no 3d effect
+                                                 rStyleSettings.GetDarkShadowColor() :
+                                                 rStyleSettings.GetLightBorderColor(),
+                                                 rStyleSettings.GetDarkShadowColor() );
 
                     }
 
@@ -956,21 +968,21 @@ static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
                     if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
                     {
                         if( bFlatBorders ) // no 3d effect
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                    rStyleSettings.GetFaceColor(),
-                                                    rStyleSettings.GetFaceColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetFaceColor(),
+                                                 rStyleSettings.GetFaceColor() );
                         else
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                    rStyleSettings.GetDarkShadowColor(),
-                                                    rStyleSettings.GetLightBorderColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetDarkShadowColor(),
+                                                 rStyleSettings.GetLightBorderColor() );
                     }
                     else
                     {
                         // flat menues have no shadow border
                         if( !bMenuStyle || !rStyleSettings.GetUseFlatMenues() )
-                            pDev->ImplDraw2ColorFrame( rRect,
-                                                    rStyleSettings.GetLightColor(),
-                                                    rStyleSettings.GetShadowColor() );
+                            ImplDraw2ColorFrame( pDev, rRect,
+                                                 rStyleSettings.GetLightColor(),
+                                                 rStyleSettings.GetShadowColor() );
                         else
                             bDrawn = sal_False;
                     }
-- 
1.7.5.4


--------------090702070007010403030503--


More information about the LibreOffice mailing list