canvas/source/cairo/cairo_devicehelper.cxx | 12 ++++++------ include/vcl/outdev.hxx | 1 + vcl/generic/print/genpspgraphics.cxx | 5 +++++ vcl/headless/svpgdi.cxx | 5 +++++ vcl/inc/generic/genpspgraphics.h | 2 ++ vcl/inc/headless/svpgdi.hxx | 2 ++ 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 +++++ 14 files changed, 51 insertions(+), 6 deletions(-)
New commits: commit 6ef1cb0c573c479b23866184b819be6226755179 Author: Caolán McNamara <[email protected]> Date: Wed Mar 18 13:38:11 2015 +0000 move the cairo resize hack into vcl Change-Id: I41868da3901d9c3fff69c11da467952176e58f09 Reviewed-on: https://gerrit.libreoffice.org/14897 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> 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();
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
