[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 10:44:11 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 -----
 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 -
 19 files changed, 19 insertions(+), 250 deletions(-)

New commits:
commit 3d495712258359d14c3d08b29caaa8b66a9b621c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 18 17:43:03 2015 +0000

    revert work in progress
    
    Change-Id: I1387b0ed7b2d8bb9df801c03cf59efc9c0e1cfd3

diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 05266e4..fab8b1b 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -17,6 +17,8 @@
  *   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>
@@ -92,20 +94,18 @@ namespace cairocanvas
 
         OutputDevice* pOutDev=getOutputDevice();
 
-        if (mpSurface && pOutDev->CanResizeCairoSurface())
-        {
-            // X11 only
+#if HAVE_FEATURE_X11
+        // X11 only
+        if( mpSurface )
             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/canvas/source/cairo/cairo_xlib_cairo.cxx b/canvas/source/cairo/cairo_xlib_cairo.cxx
index fe82cea..a4665e1 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.cxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.cxx
@@ -324,103 +324,17 @@ 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)
-        , mpDevice(&rRefDevice)
-        , 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)
-        , mpDevice(NULL)
-        , 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());
-        if (mpDevice)
-            mpDevice->FlushCairoContext(NULL);
-    }
-
-    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 )
     {
-        return SurfaceSharedPtr(new Gtk3Surface(rRefDevice, x, y, width, 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();
     }
 
     SurfaceSharedPtr createBitmapSurface( const OutputDevice&     rRefDevice,
diff --git a/canvas/source/cairo/cairo_xlib_cairo.hxx b/canvas/source/cairo/cairo_xlib_cairo.hxx
index 0cc4212..f040b9b 100644
--- a/canvas/source/cairo/cairo_xlib_cairo.hxx
+++ b/canvas/source/cairo/cairo_xlib_cairo.hxx
@@ -97,29 +97,6 @@ namespace cairo {
         void* getRenderFormat() const { return maSysData.pRenderFormat; }
         long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : maSysData.hDrawable; }
     };
-
-    class Gtk3Surface : public Surface
-    {
-        CairoSurfaceSharedPtr mpSurface;
-        const OutputDevice* mpDevice;
-        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 2019fcb..30c8c83 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -235,7 +235,6 @@ class VCLXGraphics;
 class OutDevStateStack;
 
 typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr;
-typedef struct _cairo cairo_t;
 
 namespace vcl {
     class FontInfo;
@@ -378,9 +377,6 @@ public:
 
     SystemGraphicsData          GetSystemGfxData() const;
     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 53f6a57..a5457ce 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1214,20 +1214,6 @@ bool GenPspGraphics::SupportsCairo() const
     return false;
 }
 
-bool GenPspGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
-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 d2822eb..f63ae47 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -738,18 +738,4 @@ bool SvpSalGraphics::SupportsCairo() const
     return false;
 }
 
-bool SvpSalGraphics::CanResizeCairoSurface() const
-{
-    return false;
-}
-
-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 094504c..25de868 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -202,10 +202,6 @@ 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 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/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index b6d2a74..5bbf816 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -200,10 +200,6 @@ 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 *cr) 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 7958af2..54bd2a9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -419,9 +419,6 @@ 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 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 1beebfa..ef18120 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -440,9 +440,6 @@ public:
 
     /// Check whether cairo will work
     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 1a63e74..26f2efb 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -49,14 +49,12 @@ public:
                                                     const OUString& rCaption,
                                                     Rectangle &rNativeBoundingRegion,
                                                     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 );
     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 7851ca3..b8a2a60 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -263,9 +263,6 @@ 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;
 
     virtual void                    BeginPaint() SAL_OVERRIDE;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 6502dac..287daf4 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -446,9 +446,6 @@ 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 void               FlushCairoContext(cairo_t *) 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 8c3820f..c64fbff 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -308,39 +308,6 @@ bool OutputDevice::SupportsCairo() const
     return mpGraphics->SupportsCairo();
 }
 
-bool OutputDevice::CanResizeCairoSurface() const
-{
-    if (!mpGraphics)
-    {
-        if (!AcquireGraphics())
-            return false;
-    }
-
-    return mpGraphics->CanResizeCairoSurface();
-}
-
-cairo_t* OutputDevice::GetCairoContext() const
-{
-    if (!mpGraphics)
-    {
-        if (!AcquireGraphics())
-            return NULL;
-    }
-
-    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 1f70e9a..2a76110 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -462,20 +462,6 @@ bool X11SalGraphics::SupportsCairo() const
     return XQueryExtension(pDisplay, "RENDER", &nDummy, &nDummy, &nDummy);
 }
 
-bool X11SalGraphics::CanResizeCairoSurface() const
-{
-    return true;
-}
-
-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/gtk3cairotextrender.cxx b/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
index 032f20a..f2f044e 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 9123e58..3006d62 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());
 
@@ -1447,11 +1447,6 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
     return false;
 }
 
-bool GtkSalGraphics::SupportsCairo() const
-{
-    return true;
-}
-
 static GtkWidget* gCacheWindow;
 static GtkWidget* gDumbContainer;
 
@@ -1556,17 +1551,11 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     gtk_widget_path_free(path);
 }
 
-cairo_t* GtkSalGraphics::GetCairoContext() const
+cairo_t* GtkSalGraphics::getCairoContext()
 {
     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())
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