[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
Wed Mar 18 05:33:00 PDT 2015


 canvas/source/cairo/cairo_cairo.hxx        |    3 ---
 canvas/source/cairo/cairo_canvas.cxx       |    4 ++--
 canvas/source/cairo/cairo_quartz_cairo.cxx |    6 ------
 canvas/source/cairo/cairo_spritecanvas.cxx |    6 +++---
 canvas/source/cairo/cairo_win32_cairo.cxx  |    6 ------
 canvas/source/cairo/cairo_xlib_cairo.cxx   |   15 ---------------
 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                         |    3 +++
 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             |    7 +++++++
 vcl/win/source/gdi/salgdi.cxx              |    5 +++++
 19 files changed, 52 insertions(+), 35 deletions(-)

New commits:
commit 34dc97c79165a038fd1262902a414fe78882aaba
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 09:46:04 2015 +0000

    move IsCairoWorking to vclplug level and rename
    
    Change-Id: Id31de932afa61df6933d61ddba971f5d7060f0c1

diff --git a/canvas/source/cairo/cairo_cairo.hxx b/canvas/source/cairo/cairo_cairo.hxx
index 10c9203..ab73a56 100644
--- a/canvas/source/cairo/cairo_cairo.hxx
+++ b/canvas/source/cairo/cairo_cairo.hxx
@@ -81,9 +81,6 @@ namespace cairo {
     SurfaceSharedPtr createBitmapSurface( const OutputDevice&     rRefDevice,
                                           const BitmapSystemData& rData,
                                           const Size&             rSize );
-
-    /// Check whether cairo will work on given window
-    bool IsCairoWorking( OutputDevice* );
 }
 
 #endif
diff --git a/canvas/source/cairo/cairo_canvas.cxx b/canvas/source/cairo/cairo_canvas.cxx
index 74da4c9..58bd7f0 100644
--- a/canvas/source/cairo/cairo_canvas.cxx
+++ b/canvas/source/cairo/cairo_canvas.cxx
@@ -92,8 +92,8 @@ namespace cairocanvas
         if( !pSysData || !pSysData->nSize )
             throw lang::NoSupportException( "Passed SystemGraphicsData invalid!" );
 
-        bool bHasXRender = IsCairoWorking(pOutDev);
-        ENSURE_ARG_OR_THROW( bHasXRender == true, "SpriteCanvas::SpriteCanvas: No RENDER extension" );
+        bool bHasCairo = pOutDev->SupportsCairo();
+        ENSURE_ARG_OR_THROW(bHasCairo == true, "SpriteCanvas::SpriteCanvas: No Cairo capability");
 
         // setup helper
         maDeviceHelper.init( *this, *pOutDev );
diff --git a/canvas/source/cairo/cairo_quartz_cairo.cxx b/canvas/source/cairo/cairo_quartz_cairo.cxx
index 006bfc7..f4456aa 100644
--- a/canvas/source/cairo/cairo_quartz_cairo.cxx
+++ b/canvas/source/cairo/cairo_quartz_cairo.cxx
@@ -35,12 +35,6 @@
 
 namespace cairo
 {
-    bool IsCairoWorking( OutputDevice* )
-    {
-        // trivially true for Mac
-        return true;
-    }
-
     /**
      * QuartzSurface::Surface:     Create generic Canvas surface using given Cairo Surface
      *
diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx
index 782d043..4e7be17 100644
--- a/canvas/source/cairo/cairo_spritecanvas.cxx
+++ b/canvas/source/cairo/cairo_spritecanvas.cxx
@@ -85,9 +85,9 @@ namespace cairocanvas
             throw lang::NoSupportException(
                 "Parent window not VCL window, or canvas out-of-process!", NULL);
 
-        bool bHasXRender = IsCairoWorking(pParentWindow);
-        ENSURE_ARG_OR_THROW( bHasXRender == true,
-                             "CairoSpriteCanvas::SpriteCanvas: No RENDER extension" );
+        bool bHasCairo = pParentWindow->SupportsCairo();
+        ENSURE_ARG_OR_THROW(bHasCairo == true,
+                            "CairoSpriteCanvas::SpriteCanvas: No Cairo capability");
 
         Size aPixelSize( pParentWindow->GetOutputSizePixel() );
         const ::basegfx::B2ISize aSize( aPixelSize.Width(),
diff --git a/canvas/source/cairo/cairo_win32_cairo.cxx b/canvas/source/cairo/cairo_win32_cairo.cxx
index d00cc38..20efd33 100644
--- a/canvas/source/cairo/cairo_win32_cairo.cxx
+++ b/canvas/source/cairo/cairo_win32_cairo.cxx
@@ -36,12 +36,6 @@ namespace cairo
 
 #include <cairo-win32.h>
 
-    bool IsCairoWorking( OutputDevice* )
-    {
-        // trivially true for Windows
-        return true;
-    }
-
     /**
      * Surface::Surface:     Create generic Canvas surface using given Cairo Surface
      *
diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index 171d105..a4665e1 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -57,21 +57,6 @@ namespace cairo
 #include <cairo-xlib.h>
 #include <cairo-xlib-xrender.h>
 
-    // TODO(F3): svp headless case!
-
-    bool IsCairoWorking( OutputDevice* pOutDev )
-    {
-        if( !pOutDev )
-            return false;
-
-        Display* pDisplay = (Display*)pOutDev->GetSystemGfxData().pDisplay;
-        if( !pDisplay )
-            return false;
-
-        int nDummy;
-        return XQueryExtension( pDisplay, "RENDER", &nDummy, &nDummy, &nDummy );
-    }
-
     X11SysData::X11SysData() :
         pDisplay(NULL),
         hDrawable(0),
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ec1063b..30c8c83 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -376,6 +376,7 @@ public:
     const AllSettings&          GetSettings() const { return *mxSettings; }
 
     SystemGraphicsData          GetSystemGfxData() const;
+    bool                        SupportsCairo() const;
     css::uno::Any               GetSystemGfxDataAny() const;
 
     void                        SetRefPoint();
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index a2cdf8b..a5457ce 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1209,6 +1209,11 @@ SystemGraphicsData GenPspGraphics::GetGraphicsData() const
     return SystemGraphicsData();
 }
 
+bool GenPspGraphics::SupportsCairo() const
+{
+    return false;
+}
+
 SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
 {
     return SystemFontData();
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index ea043b1..f63ae47 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -733,4 +733,9 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
 
 #endif
 
+bool SvpSalGraphics::SupportsCairo() 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 2982c83..25de868 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -201,6 +201,7 @@ public:
                                            sal_uInt8 nTransparency ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
+    virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void BeginPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index e9f5110..5bbf816 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -199,6 +199,7 @@ public:
     virtual bool        drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
+    virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual SystemFontData  GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void            BeginPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 737f8d4..54bd2a9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -418,6 +418,7 @@ public:
 
     virtual SystemGraphicsData
                             GetGraphicsData() const SAL_OVERRIDE;
+    virtual bool            SupportsCairo() 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 114a5c2..ef18120 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -438,6 +438,9 @@ public:
 
     virtual SystemGraphicsData  GetGraphicsData() const = 0;
 
+    /// Check whether cairo will work
+    virtual bool                SupportsCairo() const = 0;
+
     virtual SystemFontData      GetSysFontData( int nFallbacklevel ) const = 0;
 
 protected:
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 5f04d79..b8a2a60 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -262,6 +262,7 @@ public:
                                         long nHeight, sal_uInt8 nTransparency ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData      GetGraphicsData() const SAL_OVERRIDE;
+    virtual bool                    SupportsCairo() 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 b6036f5..287daf4 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -445,6 +445,7 @@ public:
     virtual bool            IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
+    virtual bool               SupportsCairo() 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 4ee18f5..b982dd4 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -1445,6 +1445,11 @@ SystemGraphicsData AquaSalGraphics::GetGraphicsData() const
     return aRes;
 }
 
+bool AquaSalGraphics::SupportsCairo() const
+{
+    return true;
+}
+
 long AquaSalGraphics::GetGraphicsWidth() const
 {
     long w = 0;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 0305c94..c64fbff 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -297,6 +297,17 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
     return mpGraphics->GetGraphicsData();
 }
 
+bool OutputDevice::SupportsCairo() const
+{
+    if (!mpGraphics)
+    {
+        if (!AcquireGraphics())
+            return false;
+    }
+
+    return mpGraphics->SupportsCairo();
+}
+
 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 375a9dd..2a76110 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -455,6 +455,13 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
     return aRes;
 }
 
+bool X11SalGraphics::SupportsCairo() const
+{
+    Display *pDisplay = GetXDisplay();
+    int nDummy;
+    return XQueryExtension(pDisplay, "RENDER", &nDummy, &nDummy, &nDummy);
+}
+
 // 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 c2d644d..fc74d05 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -1072,6 +1072,11 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const
     return aRes;
 }
 
+bool WinSalGraphics::SupportsCairo() const
+{
+    return true;
+}
+
 void WinSalGraphics::BeginPaint()
 {
     return mpImpl->beginPaint();


More information about the Libreoffice-commits mailing list