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

Chris Sherlock chris.sherlock79 at gmail.com
Mon Apr 7 06:17:16 PDT 2014


 include/vcl/outdev.hxx    |    4 ++
 include/vcl/print.hxx     |   14 +++++-----
 vcl/source/gdi/print2.cxx |   64 ++++++++++++++++++++++++----------------------
 3 files changed, 45 insertions(+), 37 deletions(-)

New commits:
commit e6997a8e40325903c857eb3c83c8da530a3b7bc9
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Apr 7 23:11:35 2014 +1000

    Bring static functions into OutputDevice as private functions
    
    Also rename them to something saner. ImplIsActionSpecial in particular
    is not a particularly useful function name, so updating this for
    clarity.
    
    Functions renamed:
    + ImplIsActionHandlingTransparency() -> DoesActionHandleTransparency()
    + ImplIsActionSpecial() -> IsTransparentAction()
    
    I've also updated some of the comments to clarify.
    
    Change-Id: I6c9d0c33d96ce40af2c877b52da66de17ed8ce78

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 5c09082..dbd1317 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -29,6 +29,7 @@
 #include <vcl/region.hxx>
 #include <vcl/mapmod.hxx>
 #include <vcl/wall.hxx>
+#include <vcl/metaact.hxx>
 #include <vcl/salnativewidgets.hxx>
 #include <tools/poly.hxx>
 #include <basegfx/vector/b2enums.hxx>
@@ -866,6 +867,9 @@ private:
 
     bool                        DrawTransparentNatively( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
 
+    bool                        DoesActionHandleTransparency( const MetaAction& rAct );
+    bool                        IsTransparentAction( const MetaAction& rAct );
+
     Color                       GetSingleColorGradientFill();
     void                        SetGrayscaleColors( Gradient &rGradient );
 
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 4ad4207..723d734 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -97,20 +97,20 @@ private:
     OUString                   maDriver;
     OUString                   maLocation;
     OUString                   maComment;
-    sal_uInt32                  mnStatus;
-    sal_uInt32                  mnJobs;
+    sal_uInt32                 mnStatus;
+    sal_uInt32                 mnJobs;
 
 public:
-                                QueueInfo();
-                                QueueInfo( const QueueInfo& rInfo );
-                                ~QueueInfo();
+                               QueueInfo();
+                               QueueInfo( const QueueInfo& rInfo );
+                               ~QueueInfo();
 
     const OUString&            GetPrinterName() const { return maPrinterName; }
     const OUString&            GetDriver() const { return maDriver; }
     const OUString&            GetLocation() const { return maLocation; }
     const OUString&            GetComment() const { return maComment; }
-    sal_uInt32                  GetStatus() const { return mnStatus; }
-    sal_uInt32                  GetJobs() const { return mnJobs; }
+    sal_uInt32                 GetStatus() const { return mnStatus; }
+    sal_uInt32                 GetJobs() const { return mnJobs; }
 
     bool operator==( const QueueInfo& rInfo ) const;
 
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index c16e702..5ff22c8 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -67,10 +67,9 @@ struct ConnectedComponents
 typedef ::std::list< ConnectedComponents > ConnectedComponentsList;
 
 /** \#i10613# Extracted from Printer::GetPreparedMetaFile. Returns true
-    if given action requires special handling (usually because of
-    transparency)
+    if given action requires special transparency handling
 */
-static bool ImplIsActionSpecial( const MetaAction& rAct )
+bool OutputDevice::IsTransparentAction( const MetaAction& rAct )
 {
     switch( rAct.GetType() )
     {
@@ -94,6 +93,33 @@ static bool ImplIsActionSpecial( const MetaAction& rAct )
     }
 }
 
+
+/** Determines whether the action can handle transparency correctly
+  (i.e. when painted on white background, does the action still look
+  correct)?
+ */
+bool OutputDevice::DoesActionHandleTransparency( const MetaAction& rAct )
+{
+    // META_FLOATTRANSPARENT_ACTION can contain a whole metafile,
+    // which is to be rendered with the given transparent gradient. We
+    // currently cannot emulate transparent painting on a white
+    // background reliably.
+
+    // the remainder can handle printing itself correctly on a uniform
+    // white background.
+    switch( rAct.GetType() )
+    {
+        case META_TRANSPARENT_ACTION:
+        case META_BMPEX_ACTION:
+        case META_BMPEXSCALE_ACTION:
+        case META_BMPEXSCALEPART_ACTION:
+            return true;
+
+        default:
+            return false;
+    }
+}
+
 /** Check whether rCurrRect rectangle fully covers io_rPrevRect - if
     yes, return true and update o_rBgColor
  */
@@ -622,28 +648,6 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
         return Rectangle();
 }
 
-static bool ImplIsActionHandlingTransparency( const MetaAction& rAct )
-{
-    // META_FLOATTRANSPARENT_ACTION can contain a whole metafile,
-    // which is to be rendered with the given transparent gradient. We
-    // currently cannot emulate transparent painting on a white
-    // background reliably.
-
-    // the remainder can handle printing itself correctly on a uniform
-    // white background.
-    switch( rAct.GetType() )
-    {
-        case META_TRANSPARENT_ACTION:
-        case META_BMPEX_ACTION:
-        case META_BMPEXSCALE_ACTION:
-        case META_BMPEXSCALEPART_ACTION:
-            return true;
-
-        default:
-            return false;
-    }
-}
-
 bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
                                                      long nMaxBmpDPIX, long nMaxBmpDPIY,
                                                      bool bReduceTransparency, bool bTransparencyAutoMode,
@@ -663,7 +667,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
              pCurrAct && !bTransparent;
              pCurrAct = ( (GDIMetaFile&) rInMtf ).NextAction() )
         {
-            // #i10613# Extracted "specialness" predicate into extra method
+            // #i10613# determine if the action is a transparency capable
 
             // #107169# Also examine metafiles with masked bitmaps in
             // detail. Further down, this is optimized in such a way
@@ -672,7 +676,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
             // of uniform opacity): if a masked bitmap is printed over
             // empty background, we convert to a plain bitmap with
             // white background.
-            if( ImplIsActionSpecial( *pCurrAct ) )
+            if( IsTransparentAction( *pCurrAct ) )
             {
                 bTransparent = true;
             }
@@ -994,7 +998,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
                 // prev component(s) special -> this one, too
                 aTotalComponents.bIsSpecial = true;
             }
-            else if( !ImplIsActionSpecial( *pCurrAct ) )
+            else if( !IsTransparentAction( *pCurrAct ) )
             {
                 // added action and none of prev components special ->
                 // this one normal, too
@@ -1008,7 +1012,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
                 // can the action handle transparency correctly
                 // (i.e. when painted on white background, does the
                 // action still look correct)?
-                if( !ImplIsActionHandlingTransparency( *pCurrAct ) )
+                if( !DoesActionHandleTransparency( *pCurrAct ) )
                 {
                     // no, action cannot handle its transparency on
                     // a printer device, render to bitmap
@@ -1294,7 +1298,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
                 // are the first (or sole) action in their bounds
                 // list. Note that we previously ensured that no
                 // fully-transparent objects are before us here.
-                if( ImplIsActionHandlingTransparency( *pCurrAct ) &&
+                if( DoesActionHandleTransparency( *pCurrAct ) &&
                     pCurrAssociatedComponent->aComponentList.begin()->first == pCurrAct )
                 {
                     // convert actions, where masked-out parts are of


More information about the Libreoffice-commits mailing list