Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,
please find attached a patch that removes the ImplDraw2ColorFrame support function from OutputDevice and moves it into DecorationView, which is its only caller. This function did not logically fit into OutputDevice, anyway.

The attached patch is contributed under LGPL3+/MPL1.1 license.

Matteo
From d485e0fcd8132ddd503f5acb20dd9c0864f08cc5 Mon Sep 17 00:00:00 2001
From: Matteo Casalin <matteo.casalin@poste.it>
Date: Sun, 4 Dec 2011 15:25:04 +0100
Subject: [PATCH 3/4] DecoView cleanup - Embed
 OutputDevice::ImplDraw2ColorFrame

---
 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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.