[Libreoffice-commits] core.git: canvas/source include/vcl vcl/generic vcl/headless vcl/inc vcl/quartz vcl/source vcl/unx vcl/win

Caolán McNamara caolanm at redhat.com
Thu Mar 19 06:18:09 PDT 2015


 canvas/source/cairo/cairo_cairo.hxx        |    5 +++--
 canvas/source/cairo/cairo_devicehelper.cxx |   15 +++++++--------
 canvas/source/cairo/cairo_quartz_cairo.cxx |   15 ---------------
 canvas/source/cairo/cairo_quartz_cairo.hxx |    2 --
 canvas/source/cairo/cairo_win32_cairo.cxx  |   14 --------------
 canvas/source/cairo/cairo_win32_cairo.hxx  |    2 --
 canvas/source/cairo/cairo_xlib_cairo.cxx   |    5 +++--
 canvas/source/cairo/cairo_xlib_cairo.hxx   |    2 +-
 include/vcl/outdev.hxx                     |    1 -
 vcl/generic/print/genpspgraphics.cxx       |    5 -----
 vcl/headless/svpgdi.cxx                    |    5 -----
 vcl/inc/generic/genpspgraphics.h           |    1 -
 vcl/inc/headless/svpgdi.hxx                |    1 -
 vcl/inc/quartz/salgdi.h                    |    1 -
 vcl/inc/salgdi.hxx                         |    1 -
 vcl/inc/unx/salgdi.h                       |    1 -
 vcl/inc/win/salgdi.h                       |    1 -
 vcl/quartz/salgdicommon.cxx                |    5 -----
 vcl/source/outdev/outdev.cxx               |   11 -----------
 vcl/unx/generic/gdi/salgdi.cxx             |    5 -----
 vcl/win/source/gdi/salgdi.cxx              |    5 -----
 21 files changed, 14 insertions(+), 89 deletions(-)

New commits:
commit 6c806749421caf9267325cd86372c488f585ab5a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 19 10:13:57 2015 +0000

    reorganize resizing surfaces logic
    
    the only case where we don't just create a new surface is the X11 case
    
    Change-Id: I98a3c8f227e208ac9db969ed7711e293fb237c2e
    Reviewed-on: https://gerrit.libreoffice.org/14902
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/canvas/source/cairo/cairo_cairo.hxx b/canvas/source/cairo/cairo_cairo.hxx
index ab73a56..e256610 100644
--- a/canvas/source/cairo/cairo_cairo.hxx
+++ b/canvas/source/cairo/cairo_cairo.hxx
@@ -63,8 +63,9 @@ namespace cairo {
         /// factory for VirDev on this surface
         virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
 
-        /// Resize the surface (possibly destroying content)
-        virtual void Resize( int width, int height ) = 0;
+        /// Resize the surface (possibly destroying content), only possible for X11 typically
+        /// so on failure create a new surface instead
+        virtual bool Resize( int /*width*/, int /*height*/ ) { return false; }
 
         /// Flush all pending output to surface
         virtual void flush() const = 0;
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 920481e..c5296b7 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -90,15 +90,14 @@ namespace cairocanvas
         if( !mpRefDevice )
             return; // disposed
 
-        OutputDevice* pOutDev=getOutputDevice();
+        OutputDevice* pOutDev = getOutputDevice();
 
-        if (mpSurface && pOutDev->CanResizeCairoSurface())
-        {
-            // X11 only
-            mpSurface->Resize( rSize.getX() + pOutDev->GetOutOffXPixel(),
-                               rSize.getY() + pOutDev->GetOutOffYPixel() );
-        }
-        else
+        // X11 only
+        bool bReuseSurface = mpSurface &&
+                             mpSurface->Resize(rSize.getX() + pOutDev->GetOutOffXPixel(),
+                                               rSize.getY() + pOutDev->GetOutOffYPixel());
+
+        if (!bReuseSurface)
         {
             mpSurface = cairo::createSurface(
                 *pOutDev,
diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx
index f4456aa..8da24f3 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.cxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.cxx
@@ -163,21 +163,6 @@ namespace cairo
     }
 
     /**
-     * QuartzSurface::Resize:  Resizes the Canvas surface.
-     * @param width new width of the surface
-     * @param height new height of the surface
-     *
-     * Only used on X11.
-     *
-     * @return The new surface or NULL
-     **/
-    void QuartzSurface::Resize( int /* width */, int /* height */ )
-    {
-        OSL_FAIL("not supposed to be called!");
-    }
-
-
-    /**
      * QuartzSurface::flush:  Draw the data to screen
      **/
     void QuartzSurface::flush() const
diff --git a/canvas/source/cairo/cairo_quartz_cairo.hxx b/canvas/source/cairo/cairo_quartz_cairo.hxx
index cbcbf27..a3f94d2 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.hxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.hxx
@@ -57,8 +57,6 @@ namespace cairo {
 
         virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
 
-        virtual void Resize( int width, int height );
-
         virtual void flush() const;
 
         int getDepth() const;
diff --git a/canvas/source/cairo/cairo_win32_cairo.cxx b/canvas/source/cairo/cairo_win32_cairo.cxx
index 20efd33..a54c7e1 100644
--- a/canvas/source/cairo/cairo_win32_cairo.cxx
+++ b/canvas/source/cairo/cairo_win32_cairo.cxx
@@ -139,20 +139,6 @@ namespace cairo
                     &cairo_surface_destroy )));
     }
 
-    /**
-     * Surface::Resize:  Resizes the Canvas surface.
-     * @param width new width of the surface
-     * @param height new height of the surface
-     *
-     * Only used on X11.
-     *
-     * @return The new surface or NULL
-     **/
-    void Win32Surface::Resize( int /*width*/, int /*height*/ )
-    {
-        OSL_FAIL("not supposed to be called!");
-    }
-
     void Win32Surface::flush() const
     {
         GdiFlush();
diff --git a/canvas/source/cairo/cairo_win32_cairo.hxx b/canvas/source/cairo/cairo_win32_cairo.hxx
index c6f4d7e..50bd137 100644
--- a/canvas/source/cairo/cairo_win32_cairo.hxx
+++ b/canvas/source/cairo/cairo_win32_cairo.hxx
@@ -45,8 +45,6 @@ namespace cairo {
 
         virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const;
 
-        virtual void Resize( int width, int height );
-
         virtual void flush() const;
 
         int getDepth() const;
diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index a4665e1..f6720d3 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -281,9 +281,10 @@ namespace cairo
      *
      * @return The new surface or NULL
      **/
-    void X11Surface::Resize( int width, int height )
+    bool X11Surface::Resize(int width, int height)
     {
-        cairo_xlib_surface_set_size( mpSurface.get(), width, height );
+        cairo_xlib_surface_set_size(mpSurface.get(), width, height);
+        return true;
     }
 
     void X11Surface::flush() const
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index f040b9b..a7071ce 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -88,7 +88,7 @@ namespace cairo {
 
         virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
 
-        virtual void Resize( int width, int height ) SAL_OVERRIDE;
+        virtual bool Resize( int width, int height ) SAL_OVERRIDE;
 
         virtual void flush() const SAL_OVERRIDE;
 
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6e90d45..30c8c83 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -377,7 +377,6 @@ public:
 
     SystemGraphicsData          GetSystemGfxData() const;
     bool                        SupportsCairo() const;
-    bool                        CanResizeCairoSurface() const;
     css::uno::Any               GetSystemGfxDataAny() const;
 
     void                        SetRefPoint();
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index ea76cd3..a5457ce 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1214,11 +1214,6 @@ bool GenPspGraphics::SupportsCairo() const
     return false;
 }
 
-bool GenPspGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
 SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
 {
     return SystemFontData();
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 3dee490..f63ae47 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -738,9 +738,4 @@ bool SvpSalGraphics::SupportsCairo() const
     return false;
 }
 
-bool SvpSalGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index e682e3a..5e8bcf3 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -202,7 +202,6 @@ public:
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
-    virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
 
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 855dfff..9cc4dba 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -200,7 +200,6 @@ public:
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
-    virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
 
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 8ee3ccf..54bd2a9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -419,7 +419,6 @@ public:
     virtual SystemGraphicsData
                             GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
-    virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual SystemFontData  GetSysFontData( int /* nFallbacklevel */ ) const SAL_OVERRIDE;
 
     virtual void            BeginPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 6d7d787..ef18120 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -440,7 +440,6 @@ public:
 
     /// Check whether cairo will work
     virtual bool                SupportsCairo() const = 0;
-    virtual bool                CanResizeCairoSurface() const = 0;
 
     virtual SystemFontData      GetSysFontData( int nFallbacklevel ) const = 0;
 
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 7f9bff6..b8a2a60 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -263,7 +263,6 @@ public:
 
     virtual SystemGraphicsData      GetGraphicsData() const SAL_OVERRIDE;
     virtual bool                    SupportsCairo() const SAL_OVERRIDE;
-    virtual bool                    CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual SystemFontData          GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
 
     virtual void                    BeginPaint() SAL_OVERRIDE;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 107140b..287daf4 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -446,7 +446,6 @@ public:
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool               SupportsCairo() const SAL_OVERRIDE;
-    virtual bool               CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void               BeginPaint() SAL_OVERRIDE;
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index e04b558..b982dd4 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -1450,11 +1450,6 @@ bool AquaSalGraphics::SupportsCairo() const
     return true;
 }
 
-bool AquaSalGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
 long AquaSalGraphics::GetGraphicsWidth() const
 {
     long w = 0;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index c2ec14b..c64fbff 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -308,17 +308,6 @@ bool OutputDevice::SupportsCairo() const
     return mpGraphics->SupportsCairo();
 }
 
-bool OutputDevice::CanResizeCairoSurface() const
-{
-    if (!mpGraphics)
-    {
-        if (!AcquireGraphics())
-            return false;
-    }
-
-    return mpGraphics->CanResizeCairoSurface();
-}
-
 css::uno::Any OutputDevice::GetSystemGfxDataAny() const
 {
     const SystemGraphicsData aSysData = GetSystemGfxData();
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 9ea94b5..5b861ca 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -456,11 +456,6 @@ bool X11SalGraphics::SupportsCairo() const
     return XQueryExtension(pDisplay, "RENDER", &nDummy, &nDummy, &nDummy);
 }
 
-bool X11SalGraphics::CanResizeCairoSurface() const
-{
-    return true;
-}
-
 // draw a poly-polygon
 bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency )
 {
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 614ec27..fc74d05 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -1077,11 +1077,6 @@ bool WinSalGraphics::SupportsCairo() const
     return true;
 }
 
-bool WinSalGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
 void WinSalGraphics::BeginPaint()
 {
     return mpImpl->beginPaint();


More information about the Libreoffice-commits mailing list