summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--canvas/source/cairo/cairo_devicehelper.cxx12
-rw-r--r--canvas/source/cairo/cairo_xlib_cairo.cxx102
-rw-r--r--canvas/source/cairo/cairo_xlib_cairo.hxx23
-rw-r--r--include/vcl/outdev.hxx4
-rw-r--r--vcl/generic/print/genpspgraphics.cxx14
-rw-r--r--vcl/headless/svpgdi.cxx14
-rw-r--r--vcl/inc/generic/genpspgraphics.h4
-rw-r--r--vcl/inc/headless/svpgdi.hxx4
-rw-r--r--vcl/inc/quartz/salgdi.h3
-rw-r--r--vcl/inc/salgdi.hxx3
-rw-r--r--vcl/inc/unx/gtk/gtkgdi.hxx6
-rw-r--r--vcl/inc/unx/salgdi.h3
-rw-r--r--vcl/inc/win/salgdi.h3
-rw-r--r--vcl/quartz/salgdicommon.cxx5
-rw-r--r--vcl/source/outdev/outdev.cxx33
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx14
-rw-r--r--vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx2
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx15
-rw-r--r--vcl/win/source/gdi/salgdi.cxx5
19 files changed, 19 insertions, 250 deletions
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index 05266e424457..fab8b1b0e754 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 fe82ceae72f1..a4665e14aa04 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 0cc4212c7c64..f040b9bc0ced 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 2019fcbd4875..30c8c839c56b 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 53f6a579be38..a5457ce399f6 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 d2822ebcf4de..f63ae479f31b 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 094504c15ac1..25de8687b283 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 b6d2a7420f34..5bbf81607ef6 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 7958af26d1f0..54bd2a932831 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 1beebfade5b5..ef1812077ee8 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 1a63e744710e..26f2efba05b9 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 7851ca395179..b8a2a60972de 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 6502dac34c2f..287daf4effb2 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 e04b5586b9c5..b982dd4ff7bb 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 8c3820f3060b..c64fbfffcc84 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 1f70e9a4f52d..2a76110fe4fa 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 032f20a39db0..f2f044e633af 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 9123e589b247..3006d62fdf81 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 614ec2736414..fc74d0567779 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();