[Libreoffice-commits] core.git: Branch 'feature/vclref' - 2 commits - canvas/source vcl/source

Michael Meeks michael.meeks at collabora.com
Thu Mar 19 06:09:40 PDT 2015


 canvas/source/vcl/backbuffer.cxx         |   10 ++++++++--
 canvas/source/vcl/backbuffer.hxx         |    3 ++-
 canvas/source/vcl/spritecanvashelper.cxx |    6 ++++++
 canvas/source/vcl/spritecanvashelper.hxx |    4 +++-
 vcl/source/outdev/outdevstate.cxx        |    1 +
 vcl/source/outdev/text.cxx               |    8 ++++----
 6 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit e821e10c7c605845968604831eb0ffbc30c5682c
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Mar 19 13:14:32 2015 +0000

    remove un-necessary type punning.
    
    Change-Id: I4f05929daa8b78b309d8a0498a2bb3246af9e18a

diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index a71c7d6..bc6bd4a 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -641,6 +641,7 @@ void OutputDevice::InitFillColor()
 void OutputDevice::ImplReleaseFonts()
 {
     mpGraphics->ReleaseFonts();
+
     mbNewFont = true;
     mbInitFont = true;
 
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 7a2973c..1409a5a 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2706,8 +2706,8 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
     if (pSalLayout == 0)
         return false;
     long nWidth = pSalLayout->GetTextWidth();
-    long nHeight = ((OutputDevice*)&aVDev)->mpFontEntry->mnLineHeight + ((OutputDevice*)&aVDev)->mnEmphasisAscent
-        + ((OutputDevice*)&aVDev)->mnEmphasisDescent;
+    long nHeight = aVDev->mpFontEntry->mnLineHeight + aVDev->mnEmphasisAscent +
+                   aVDev->mnEmphasisDescent;
     pSalLayout->Release();
 
     if( !nWidth || !nHeight )
@@ -2756,8 +2756,8 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
             // draw glyph into virtual device
             aVDev->Erase();
             pSalLayout->DrawBase() += aOffset;
-            pSalLayout->DrawBase() += Point( ((OutputDevice*)&aVDev)->mnTextOffX, ((OutputDevice*)&aVDev)->mnTextOffY );
-            pSalLayout->DrawText( *((OutputDevice*)&aVDev)->mpGraphics );
+            pSalLayout->DrawBase() += Point( aVDev->mnTextOffX, aVDev->mnTextOffY );
+            pSalLayout->DrawText( *aVDev->mpGraphics );
             pSalLayout->Release();
 
             // convert character image into outline
commit bc7ea2108ec1cdde1b02d7cd972d7127658d5a24
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Mar 19 13:13:47 2015 +0000

    Unwind VCLObject bits for OutputDevice derivatives.
    
    Change-Id: I1abdf0a6d43029fb29e5cbc6c3f788aa98f55a1f

diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 73d6320..216b5eb 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -43,14 +43,20 @@ namespace vclcanvas
         }
     }
 
+    BackBuffer::~BackBuffer()
+    {
+        SolarMutexGuard aGuard;
+        maVDev.disposeAndClear();
+    }
+
     OutputDevice& BackBuffer::getOutDev()
     {
-        return maVDev.get();
+        return *maVDev.get();
     }
 
     const OutputDevice& BackBuffer::getOutDev() const
     {
-        return maVDev.get();
+        return *maVDev.get();
     }
 
     void BackBuffer::setSize( const ::Size& rNewSize )
diff --git a/canvas/source/vcl/backbuffer.hxx b/canvas/source/vcl/backbuffer.hxx
index 0fea559..479f4dd 100644
--- a/canvas/source/vcl/backbuffer.hxx
+++ b/canvas/source/vcl/backbuffer.hxx
@@ -43,6 +43,7 @@ namespace vclcanvas
          */
         BackBuffer( const OutputDevice& rRefDevice,
                     bool                bMonochromeBuffer=false );
+        ~BackBuffer();
 
         virtual OutputDevice&       getOutDev() SAL_OVERRIDE;
         virtual const OutputDevice& getOutDev() const SAL_OVERRIDE;
@@ -50,7 +51,7 @@ namespace vclcanvas
         void setSize( const ::Size& rNewSize );
 
     private:
-        ::canvas::vcltools::VCLObject<VirtualDevice>    maVDev;
+        VclPtr< VirtualDevice > maVDev;
     };
 
     typedef ::boost::shared_ptr< BackBuffer > BackBufferSharedPtr;
diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx
index 037bc48..9164d86 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -189,6 +189,12 @@ namespace vclcanvas
 #endif
     }
 
+    SpriteCanvasHelper::~SpriteCanvasHelper()
+    {
+        SolarMutexGuard aGuard;
+        maVDev.disposeAndClear();
+    }
+
     void SpriteCanvasHelper::init( const OutDevProviderSharedPtr& rOutDev,
                                    SpriteCanvas&                  rOwningSpriteCanvas,
                                    ::canvas::SpriteRedrawManager& rManager,
diff --git a/canvas/source/vcl/spritecanvashelper.hxx b/canvas/source/vcl/spritecanvashelper.hxx
index dc165d4..0396217 100644
--- a/canvas/source/vcl/spritecanvashelper.hxx
+++ b/canvas/source/vcl/spritecanvashelper.hxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
 
+#include <vcl/vclptr.hxx>
 #include <vcl/virdev.hxx>
 
 #include <canvas/spriteredrawmanager.hxx>
@@ -40,6 +41,7 @@ namespace vclcanvas
     {
     public:
         SpriteCanvasHelper();
+        ~SpriteCanvasHelper()
 
         void init( const OutDevProviderSharedPtr& rOutDev,
                    SpriteCanvas&                  rOwningSpriteCanvas,
@@ -150,7 +152,7 @@ namespace vclcanvas
             Typically, sprites will be composited in the background,
             before pushing them to screen. This happens here.
          */
-        ::canvas::vcltools::VCLObject< VirtualDevice >  maVDev;
+        VclPtr< VirtualDevice > maVDev;
 
         /// For the frame counter timings
         ::canvas::tools::ElapsedTime                    maLastUpdate;


More information about the Libreoffice-commits mailing list