[Libreoffice-commits] core.git: 5 commits - canvas/source icon-themes/breeze 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 10:33:10 PDT 2015


 canvas/source/cairo/cairo_devicehelper.cxx    |   12 +--
 canvas/source/cairo/cairo_xlib_cairo.cxx      |  102 +++++++++++++++++++++++---
 canvas/source/cairo/cairo_xlib_cairo.hxx      |   23 +++++
 icon-themes/breeze/links.txt                  |    6 -
 include/vcl/outdev.hxx                        |    4 +
 vcl/generic/print/genpspgraphics.cxx          |   14 +++
 vcl/headless/svpgdi.cxx                       |   14 +++
 vcl/inc/generic/genpspgraphics.h              |    4 +
 vcl/inc/headless/svpgdi.hxx                   |    4 +
 vcl/inc/quartz/salgdi.h                       |    3 
 vcl/inc/salgdi.hxx                            |    3 
 vcl/inc/unx/gtk/gtkgdi.hxx                    |    6 +
 vcl/inc/unx/salgdi.h                          |    3 
 vcl/inc/win/salgdi.h                          |    3 
 vcl/quartz/salgdicommon.cxx                   |    5 +
 vcl/source/outdev/outdev.cxx                  |   33 ++++++++
 vcl/unx/generic/gdi/salgdi.cxx                |   14 +++
 vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx      |    2 
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   15 +++
 vcl/win/source/gdi/salgdi.cxx                 |    5 +
 20 files changed, 253 insertions(+), 22 deletions(-)

New commits:
commit 4e46370938b1fde8cea5e8123d88a2290e60de8a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 17:32:37 2015 +0000

    more flawed links
    
    Change-Id: Ida9321e44c31ec694ee3c3ba035eb1c8662634bf

diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt
index 33e1fa8..3f86330 100644
--- a/icon-themes/breeze/links.txt
+++ b/icon-themes/breeze/links.txt
@@ -264,10 +264,10 @@ sw/imglst/sc20234.png sw/imglst/sc20244.png
 sw/imglst/sr20011.png sw/imglst/nc20000.png
 sw/imglst/sr20014.png sw/imglst/sc20183.png
 sw/imglst/sr20007.png cmd/sc_insertsection.png
-sw/imglst/sr20009.png sw/imglst/nc20011.png
+sw/imglst/sr20009.png cmd/sc_toggleobjectbeziermode.png
 sw/imglst/sr20010.png cmd/sc_insertobject.png
-sw/imglst/sr20005.png sw/imglst/sc20245.png
-sw/imglst/sr20002.png sw/imglst/nc20001.png
+sw/imglst/sr20005.png cmd/sc_editdoc.png
+sw/imglst/sr20002.png cmd/sc_inserttable.png
 sw/imglst/sr20012.png cmd/sc_insertreferencefield
 sw/imglst/sr20003.png cmd/sc_inserttextframe.png
 sw/imglst/sr20006.png cmd/sc_choosecontrols.png
commit 2beb8b2e6aef50b8a35da37a5d0caf2ee33d174d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 14:53:53 2015 +0000

    more thinking
    
    Change-Id: Ie349bd35b1fc92b77cc15f51eb886a1c9c92cbe1

diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index 24063a4..fe82cea 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -335,6 +335,7 @@ namespace cairo
      **/
     Gtk3Surface::Gtk3Surface(const OutputDevice& rRefDevice, int x, int y, int width, int height)
         : mpSurface(cairo_get_target(rRefDevice.GetCairoContext()), &cairo_surface_flush)
+        , mpDevice(&rRefDevice)
         , mnWidth(width)
         , mnHeight(height)
     {
@@ -353,6 +354,7 @@ namespace cairo
      **/
     Gtk3Surface::Gtk3Surface(const CairoSurfaceSharedPtr& pSurface, int width, int height)
         : mpSurface(pSurface)
+        , mpDevice(NULL)
         , mnWidth(width)
         , mnHeight(height)
     {
@@ -406,6 +408,8 @@ namespace cairo
     void Gtk3Surface::flush() const
     {
         cairo_surface_flush(mpSurface.get());
+        if (mpDevice)
+            mpDevice->FlushCairoContext(NULL);
     }
 
     boost::shared_ptr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index babebde..0cc4212 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -101,6 +101,7 @@ namespace cairo {
     class Gtk3Surface : public Surface
     {
         CairoSurfaceSharedPtr mpSurface;
+        const OutputDevice* mpDevice;
         int mnWidth;
         int mnHeight;
     public:
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 91dab6c..2019fcb 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -380,6 +380,7 @@ public:
     bool                        SupportsCairo() const;
     bool                        CanResizeCairoSurface() const;
     cairo_t*                    GetCairoContext() const;
+    void                        FlushCairoContext(cairo_t *cr) const;
     css::uno::Any               GetSystemGfxDataAny() const;
 
     void                        SetRefPoint();
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index d43e725b..53f6a57 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1224,6 +1224,10 @@ cairo_t* GenPspGraphics::GetCairoContext() const
     return NULL;
 }
 
+void GenPspGraphics::FlushCairoContext(cairo_t*) const
+{
+}
+
 SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
 {
     return SystemFontData();
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index de56306..d2822eb 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -748,4 +748,8 @@ cairo_t* SvpSalGraphics::GetCairoContext() const
     return NULL;
 }
 
+void SvpSalGraphics::FlushCairoContext(cairo_t *) const
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index b4a683c..094504c 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -204,6 +204,7 @@ public:
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual cairo_t*        GetCairoContext() const SAL_OVERRIDE;
+    virtual void            FlushCairoContext(cairo_t *) 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 e4ff74d..b6d2a74 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -200,7 +200,8 @@ public:
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
-    cairo_t*                GetCairoContext() const SAL_OVERRIDE;
+    virtual cairo_t*        GetCairoContext() const SAL_OVERRIDE;
+    virtual void            FlushCairoContext(cairo_t *cr) 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 451c582..7958af2 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -421,6 +421,7 @@ public:
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual cairo_t*        GetCairoContext() const SAL_OVERRIDE;
+    virtual void            FlushCairoContext(cairo_t*) 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 87971fd..1beebfa 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -442,6 +442,7 @@ public:
     virtual bool                SupportsCairo() const = 0;
     virtual bool                CanResizeCairoSurface() const = 0;
     virtual cairo_t*            GetCairoContext() const = 0;
+    virtual void                FlushCairoContext(cairo_t *cr) const = 0;
 
     virtual SystemFontData      GetSysFontData( int nFallbacklevel ) const = 0;
 
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 731b7f0..1a63e74 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -51,6 +51,7 @@ public:
                                                     Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
     virtual bool        SupportsCairo() const SAL_OVERRIDE;
     virtual cairo_t*    GetCairoContext() const SAL_OVERRIDE;
+    virtual void        FlushCairoContext(cairo_t *cr) const SAL_OVERRIDE;
 
     void updateSettings( AllSettings& rSettings );
     static void refreshFontconfig( GtkSettings *pSettings );
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 74ba77d..7851ca3 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -264,6 +264,7 @@ public:
     virtual SystemGraphicsData      GetGraphicsData() const SAL_OVERRIDE;
     virtual bool                    SupportsCairo() const SAL_OVERRIDE;
     virtual cairo_t*                GetCairoContext() const SAL_OVERRIDE;
+    virtual void                    FlushCairoContext(cairo_t*) const SAL_OVERRIDE;
     virtual bool                    CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual SystemFontData          GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
 
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index a4800ea..6502dac 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -448,6 +448,7 @@ public:
     virtual bool               SupportsCairo() const SAL_OVERRIDE;
     virtual bool               CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual cairo_t*           GetCairoContext() const SAL_OVERRIDE;
+    virtual void               FlushCairoContext(cairo_t *) const SAL_OVERRIDE;
     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void               BeginPaint() SAL_OVERRIDE;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 1ffa228..8c3820f 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -330,6 +330,17 @@ cairo_t* OutputDevice::GetCairoContext() const
     return mpGraphics->GetCairoContext();
 }
 
+void OutputDevice::FlushCairoContext(cairo_t* cr) const
+{
+    if (!mpGraphics)
+    {
+        if (!AcquireGraphics())
+            return;
+    }
+
+    mpGraphics->FlushCairoContext(cr);
+}
+
 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 91bfa59..1f70e9a 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -472,6 +472,10 @@ cairo_t* X11SalGraphics::GetCairoContext() const
     return NULL;
 }
 
+void X11SalGraphics::FlushCairoContext(cairo_t*) const
+{
+}
+
 // draw a poly-polygon
 bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency )
 {
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index eaf56ea..9123e58 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1561,6 +1561,12 @@ cairo_t* GtkSalGraphics::GetCairoContext() const
     return mpFrame->getCairoContext();
 }
 
+void GtkSalGraphics::FlushCairoContext(cairo_t *) const
+{
+    //request gtk to sync the entire contents
+    gtk_widget_queue_draw(mpWindow);
+}
+
 void GtkSalGraphics::clipRegion(cairo_t* cr)
 {
     if (!m_aClipRegion.IsEmpty())
commit dce032e3ac528cfe3b2199a7998ddc349b4a2eb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 14:23:52 2015 +0000

    thinking
    
    Change-Id: Ib1a086bed7f70e244db2a0bd32819560c6949d51

diff --git a/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index a4665e1..24063a4 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -324,17 +324,99 @@ namespace cairo
         return X11SysData( rVirDev.GetSystemGfxData() );
     }
 
+    /**
+     * Surface::Surface:   Create Canvas surface from Window reference.
+     * @param x horizontal location of the new surface
+     * @param y vertical location of the new surface
+     * @param width width of the new surface
+     * @param height height of the new surface
+     *
+     * Set the mpSurface to the new surface or NULL
+     **/
+    Gtk3Surface::Gtk3Surface(const OutputDevice& rRefDevice, int x, int y, int width, int height)
+        : mpSurface(cairo_get_target(rRefDevice.GetCairoContext()), &cairo_surface_flush)
+        , mnWidth(width)
+        , mnHeight(height)
+    {
+        cairo_surface_set_device_offset(mpSurface.get(), x, y );
+    }
+
+    /**
+     * Surface::Surface:     Create generic Canvas surface using given Cairo Surface
+     *
+     * @param pSurface Cairo Surface
+     *
+     * This constructor only stores data, it does no processing.
+     * It is used with e.g. cairo_image_surface_create_for_data()
+     *
+     * Set the mpSurface as pSurface
+     **/
+    Gtk3Surface::Gtk3Surface(const CairoSurfaceSharedPtr& pSurface, int width, int height)
+        : mpSurface(pSurface)
+        , mnWidth(width)
+        , mnHeight(height)
+    {
+    }
+
+    /**
+     * Surface::getCairo:  Create Cairo (drawing object) for the Canvas surface
+     *
+     * @return new Cairo or NULL
+     **/
+    CairoSharedPtr Gtk3Surface::getCairo() const
+    {
+        return CairoSharedPtr(cairo_create(mpSurface.get()),
+                              &cairo_destroy);
+    }
+
+    /**
+     * Surface::getSimilar:  Create new similar Canvas surface
+     * @param aContent format of the new surface (cairo_content_t from cairo/src/cairo.h)
+     * @param width width of the new surface
+     * @param height height of the new surface
+     *
+     * Creates a new Canvas surface.
+     *
+     * Cairo surface from aContent (cairo_content_t)
+     *
+     * @return new surface or NULL
+     **/
+    SurfaceSharedPtr Gtk3Surface::getSimilar( Content aContent, int width, int height ) const
+    {
+        return SurfaceSharedPtr(
+            new Gtk3Surface(CairoSurfaceSharedPtr(
+                               cairo_surface_create_similar( mpSurface.get(), aContent, width, height ),
+                               &cairo_surface_destroy ), width, height));
+    }
+
+    /**
+     * 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 Gtk3Surface::Resize( int /*width*/, int /*height*/ )
+    {
+        assert(false && "not supposed to be called!");
+    }
+
+    void Gtk3Surface::flush() const
+    {
+        cairo_surface_flush(mpSurface.get());
+    }
+
+    boost::shared_ptr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
+    {
+        return boost::shared_ptr<VirtualDevice>(new VirtualDevice(NULL, Size(mnWidth, mnHeight), 0));
+    }
+
     SurfaceSharedPtr createSurface( const OutputDevice& rRefDevice,
                                     int x, int y, int width, int height )
     {
-        if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
-            return SurfaceSharedPtr(new X11Surface(getSysData(static_cast<const vcl::Window&>(rRefDevice)),
-                                                   x,y,width,height));
-        else if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
-            return SurfaceSharedPtr(new X11Surface(getSysData(static_cast<const VirtualDevice&>(rRefDevice)),
-                                                   x,y,width,height));
-        else
-            return SurfaceSharedPtr();
+        return SurfaceSharedPtr(new Gtk3Surface(rRefDevice, x, y, width, height));
     }
 
     SurfaceSharedPtr createBitmapSurface( const OutputDevice&     rRefDevice,
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index f040b9b..babebde 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -97,6 +97,28 @@ namespace cairo {
         void* getRenderFormat() const { return maSysData.pRenderFormat; }
         long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; }
     };
+
+    class Gtk3Surface : public Surface
+    {
+        CairoSurfaceSharedPtr mpSurface;
+        int mnWidth;
+        int mnHeight;
+    public:
+        /// takes over ownership of passed cairo_surface
+        explicit Gtk3Surface(const CairoSurfaceSharedPtr& pSurface, int width, int height);
+        /// create surface on subarea of given drawable
+        explicit Gtk3Surface(const OutputDevice& rRefDevice, int x, int y, int width, int height);
+
+        // Surface interface
+        virtual CairoSharedPtr getCairo() const SAL_OVERRIDE;
+        virtual CairoSurfaceSharedPtr getCairoSurface() const SAL_OVERRIDE { return mpSurface; }
+        virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const SAL_OVERRIDE;
+
+        virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const SAL_OVERRIDE;
+
+        virtual void Resize(int width, int height) SAL_OVERRIDE;
+        virtual void flush() const SAL_OVERRIDE;
+    };
 }
 
 #endif
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6e90d45..91dab6c 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -235,6 +235,7 @@ class VCLXGraphics;
 class OutDevStateStack;
 
 typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr;
+typedef struct _cairo cairo_t;
 
 namespace vcl {
     class FontInfo;
@@ -378,6 +379,7 @@ public:
     SystemGraphicsData          GetSystemGfxData() const;
     bool                        SupportsCairo() const;
     bool                        CanResizeCairoSurface() const;
+    cairo_t*                    GetCairoContext() const;
     css::uno::Any               GetSystemGfxDataAny() const;
 
     void                        SetRefPoint();
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index ea76cd3..d43e725b 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1219,6 +1219,11 @@ bool GenPspGraphics::CanResizeCairoSurface() const
     return false;
 }
 
+cairo_t* GenPspGraphics::GetCairoContext() const
+{
+    return NULL;
+}
+
 SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
 {
     return SystemFontData();
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 3dee490..de56306 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -743,4 +743,9 @@ bool SvpSalGraphics::CanResizeCairoSurface() const
     return false;
 }
 
+cairo_t* SvpSalGraphics::GetCairoContext() const
+{
+    return NULL;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index e682e3a..b4a683c 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -203,6 +203,7 @@ public:
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
+    virtual cairo_t*        GetCairoContext() 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..e4ff74d 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -200,6 +200,7 @@ public:
 
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
+    cairo_t*                GetCairoContext() 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..451c582 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -420,6 +420,7 @@ public:
                             GetGraphicsData() const SAL_OVERRIDE;
     virtual bool            SupportsCairo() const SAL_OVERRIDE;
     virtual bool            CanResizeCairoSurface() const SAL_OVERRIDE;
+    virtual cairo_t*        GetCairoContext() 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..87971fd 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -441,6 +441,7 @@ public:
     /// Check whether cairo will work
     virtual bool                SupportsCairo() const = 0;
     virtual bool                CanResizeCairoSurface() const = 0;
+    virtual cairo_t*            GetCairoContext() const = 0;
 
     virtual SystemFontData      GetSysFontData( int nFallbacklevel ) const = 0;
 
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 2d00216..731b7f0 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -50,13 +50,12 @@ public:
                                                     Rectangle &rNativeBoundingRegion,
                                                     Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
     virtual bool        SupportsCairo() const SAL_OVERRIDE;
+    virtual cairo_t*    GetCairoContext() const SAL_OVERRIDE;
 
     void updateSettings( AllSettings& rSettings );
     static void refreshFontconfig( GtkSettings *pSettings );
     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
 
-    cairo_t* getCairoContext();
-
     void clipRegion(cairo_t* cr);
 
 private:
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 7f9bff6..74ba77d 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -263,6 +263,7 @@ public:
 
     virtual SystemGraphicsData      GetGraphicsData() const SAL_OVERRIDE;
     virtual bool                    SupportsCairo() const SAL_OVERRIDE;
+    virtual cairo_t*                GetCairoContext() const SAL_OVERRIDE;
     virtual bool                    CanResizeCairoSurface() const SAL_OVERRIDE;
     virtual SystemFontData          GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE;
 
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 107140b..a4800ea 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -447,6 +447,7 @@ public:
     virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
     virtual bool               SupportsCairo() const SAL_OVERRIDE;
     virtual bool               CanResizeCairoSurface() const SAL_OVERRIDE;
+    virtual cairo_t*           GetCairoContext() const SAL_OVERRIDE;
     virtual SystemFontData     GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
 
     virtual void               BeginPaint() SAL_OVERRIDE;
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index c2ec14b..1ffa228 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -319,6 +319,17 @@ bool OutputDevice::CanResizeCairoSurface() const
     return mpGraphics->CanResizeCairoSurface();
 }
 
+cairo_t* OutputDevice::GetCairoContext() const
+{
+    if (!mpGraphics)
+    {
+        if (!AcquireGraphics())
+            return NULL;
+    }
+
+    return mpGraphics->GetCairoContext();
+}
+
 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 29366ca..91bfa59 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -467,6 +467,11 @@ bool X11SalGraphics::CanResizeCairoSurface() const
     return true;
 }
 
+cairo_t* X11SalGraphics::GetCairoContext() const
+{
+    return NULL;
+}
+
 // draw a poly-polygon
 bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency )
 {
diff --git a/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx b/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
index f2f044e..032f20a 100644
--- a/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
@@ -21,7 +21,7 @@ GlyphCache& GtkCairoTextRender::getPlatformGlyphCache()
 
 cairo_t* GtkCairoTextRender::getCairoContext()
 {
-    return mrParent.getCairoContext();
+    return mrParent.GetCairoContext();
 }
 
 void GtkCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 2554562..eaf56ea 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -922,7 +922,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
         return false;
     }
 
-    cairo_t *cr = getCairoContext();
+    cairo_t *cr = GetCairoContext();
     clipRegion(cr);
     cairo_translate(cr, rControlRegion.Left(), rControlRegion.Top());
 
@@ -1556,7 +1556,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     gtk_widget_path_free(path);
 }
 
-cairo_t* GtkSalGraphics::getCairoContext()
+cairo_t* GtkSalGraphics::GetCairoContext() const
 {
     return mpFrame->getCairoContext();
 }
commit 98d2e1aaa22fb5e9aeb86750038b6a0bf96bdaf2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 09:57:41 2015 +0000

    claim gtk3 can handle cairo canvas
    
    Change-Id: Ie6edf155288d1514ce7a0c859ba751cdebc93391

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 26f2efb..2d00216 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -49,6 +49,8 @@ public:
                                                     const OUString& rCaption,
                                                     Rectangle &rNativeBoundingRegion,
                                                     Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
+    virtual bool        SupportsCairo() const SAL_OVERRIDE;
+
     void updateSettings( AllSettings& rSettings );
     static void refreshFontconfig( GtkSettings *pSettings );
     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 3006d62..2554562 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1447,6 +1447,11 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
     return false;
 }
 
+bool GtkSalGraphics::SupportsCairo() const
+{
+    return true;
+}
+
 static GtkWidget* gCacheWindow;
 static GtkWidget* gDumbContainer;
 
commit f59345721b1731c0fd5ed052f2dee99042bd7f4c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 13:38:11 2015 +0000

    move the cairo resize hack into vcl
    
    Change-Id: Ifd1817a28f4fb7ddcc85447fd3388fd0efd86476

diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index fab8b1b..05266e4 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <config_features.h>
-
 #include <canvas/debug.hxx>
 #include <canvas/verbosetrace.hxx>
 #include <canvas/canvastools.hxx>
@@ -94,18 +92,20 @@ namespace cairocanvas
 
         OutputDevice* pOutDev=getOutputDevice();
 
-#if HAVE_FEATURE_X11
-        // X11 only
-        if( mpSurface )
+        if (mpSurface && pOutDev->CanResizeCairoSurface())
+        {
+            // X11 only
             mpSurface->Resize( rSize.getX() + pOutDev->GetOutOffXPixel(),
                                rSize.getY() + pOutDev->GetOutOffYPixel() );
+        }
         else
-#endif
+        {
             mpSurface = cairo::createSurface(
                 *pOutDev,
                 pOutDev->GetOutOffXPixel(),
                 pOutDev->GetOutOffYPixel(),
                 rSize.getX(), rSize.getY() );
+        }
     }
 
     geometry::RealSize2D DeviceHelper::getPhysicalResolution()
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 30c8c83..6e90d45 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -377,6 +377,7 @@ 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 a5457ce..ea76cd3 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1214,6 +1214,11 @@ 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 f63ae47..3dee490 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -738,4 +738,9 @@ 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 25de868..e682e3a 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -202,6 +202,8 @@ 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/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 5bbf816..855dfff 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -200,6 +200,8 @@ 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/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 54bd2a9..8ee3ccf 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -419,6 +419,7 @@ 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 ef18120..6d7d787 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -440,6 +440,7 @@ 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 b8a2a60..7f9bff6 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -263,6 +263,7 @@ 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 287daf4..107140b 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -446,6 +446,7 @@ 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 b982dd4..e04b558 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -1450,6 +1450,11 @@ 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 c64fbff..c2ec14b 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -308,6 +308,17 @@ 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 2a76110..29366ca 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -462,6 +462,11 @@ 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 fc74d05..614ec27 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -1077,6 +1077,11 @@ 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