summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMox Soini <mox@iki.fi>2015-06-02 23:52:56 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-06-04 21:31:58 +0000
commite4d55e8045c99af65a2cae57b26ec076825c9673 (patch)
tree3a56aa0c7998ff643e15c0edee5ad8fdaa0e1fed /vcl
parent8854643a0a964f6aa511013c6ab31ed198c74e86 (diff)
Cleanup crossplatform cairo
Mac / Win cairo is not built / used, this cairo code can be removed to reduce code bloat. Change-Id: I758d674291e25e0722f5c66a0096295e903786b1 Reviewed-on: https://gerrit.libreoffice.org/16049 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Library_vcl.mk2
-rw-r--r--vcl/inc/quartz/salgdi.h6
-rw-r--r--vcl/inc/salgdi.hxx9
-rw-r--r--vcl/inc/win/salgdi.h6
-rw-r--r--vcl/quartz/salgdi.cxx10
-rw-r--r--vcl/quartz/salgdicommon.cxx118
-rw-r--r--vcl/source/outdev/font.cxx4
-rw-r--r--vcl/source/outdev/outdev.cxx9
-rw-r--r--vcl/win/source/gdi/salgdi.cxx139
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx15
10 files changed, 17 insertions, 301 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7c99bed96ec3..0ce40d39eb46 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -499,7 +499,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/osx/PictToBmpFlt \
vcl/osx/clipboard \
vcl/osx/service_entry \
- vcl/quartz/cairo_quartz_cairo \
$(vcl_quartz_code) \
vcl/quartz/salgdiutils \
vcl/osx/salnativewidgets \
@@ -669,7 +668,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/win/source/app/salinst \
vcl/win/source/app/salshl \
vcl/win/source/app/saltimer \
- vcl/win/source/gdi/cairo_win32_cairo \
vcl/win/source/gdi/gdiimpl \
vcl/win/source/gdi/salbmp \
vcl/win/source/gdi/salgdi \
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 12c314482bba..7292479e8c9b 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -414,12 +414,6 @@ public:
virtual SystemGraphicsData
GetGraphicsData() const SAL_OVERRIDE;
- virtual bool SupportsCairo() const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const SAL_OVERRIDE;
- virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const SAL_OVERRIDE;
- virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const SAL_OVERRIDE;
virtual void BeginPaint() SAL_OVERRIDE { };
virtual void EndPaint() SAL_OVERRIDE { };
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 50e5e5a30646..8c98d08b7b3e 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -36,6 +36,8 @@
#include <map>
#include <set>
+#include <config_cairo_canvas.h>
+
class PhysicalFontCollection;
class SalBitmap;
class FontSelectPattern;
@@ -49,7 +51,10 @@ class OpenGLContext;
class OutputDevice;
class ServerFontLayout;
struct SystemGraphicsData;
+
+#if ENABLE_CAIRO_CANVAS
struct SystemFontData;
+#endif // ENABLE_CAIRO_CANVAS
namespace basegfx {
class B2DVector;
@@ -438,6 +443,8 @@ public:
virtual SystemGraphicsData GetGraphicsData() const = 0;
+#if ENABLE_CAIRO_CANVAS
+
/// Check whether cairo will work
virtual bool SupportsCairo() const = 0;
/// Create Surface from given cairo surface
@@ -450,6 +457,8 @@ public:
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const = 0;
+#endif // ENABLE_CAIRO_CANVAS
+
protected:
virtual bool setClipRegion( const vcl::Region& ) = 0;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index fdd931ce5fe6..504737a7eca5 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -448,12 +448,6 @@ public:
virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE;
- virtual bool SupportsCairo() const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const SAL_OVERRIDE;
- virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const SAL_OVERRIDE;
- virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const SAL_OVERRIDE;
- virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
virtual void BeginPaint() SAL_OVERRIDE;
virtual void EndPaint() SAL_OVERRIDE;
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 52cf48acf816..4f2104d79659 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -750,16 +750,6 @@ void AquaSalGraphics::FreeEmbedFontData( const void* pData, long /*nDataLen*/ )
DBG_ASSERT( (pData!=NULL), "AquaSalGraphics::FreeEmbedFontData() is not implemented\n");
}
-SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
-{
- SystemFontData aSysFontData;
- aSysFontData.nSize = sizeof( SystemFontData );
-
- aSysFontData.bAntialias = !mbNonAntialiasedText;
-
- return aSysFontData;
-}
-
bool AquaSalGraphics::IsFlipped() const
{
#ifdef MACOSX
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 1464f18ce323..b4e50e454dac 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -39,11 +39,6 @@
#include <vcl/sysdata.hxx>
#endif
-#include <config_cairo_canvas.h>
-#if ENABLE_CAIRO_CANVAS
-#include "cairo_quartz_cairo.hxx"
-#endif
-
#if defined(IOS) && defined(DBG_UTIL)
// Variables in TiledView.m
@@ -1450,119 +1445,6 @@ SystemGraphicsData AquaSalGraphics::GetGraphicsData() const
return aRes;
}
-bool AquaSalGraphics::SupportsCairo() const
-{
-#if ENABLE_CAIRO_CANVAS
- return true;
-#else
- return false;
-#endif
-}
-
-/**
- * cairo::createSurface: Create generic Canvas surface using given Cairo Surface
- *
- * @param rSurface Cairo Surface
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const
-{
-#if ENABLE_CAIRO_CANVAS
- return cairo::SurfaceSharedPtr(new cairo::QuartzSurface(rSurface));
-#else
- (void)rSurface;
- return cairo::SurfaceSharedPtr();
-#endif
-}
-
-/**
- * cairo::createSurface: Create Canvas surface using given VCL Window or Virtualdevice
- *
- * @param rSurface Cairo Surface
- *
- * For VCL Window, use platform native system environment data (struct SystemEnvData in vcl/inc/sysdata.hxx)
- * For VCL Virtualdevice, use platform native system graphics data (struct SystemGraphicsData in vcl/inc/sysdata.hxx)
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateSurface( const OutputDevice& rRefDevice,
- int x, int y, int width, int height ) const
-{
- cairo::SurfaceSharedPtr surf;
-#if ENABLE_CAIRO_CANVAS
- if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
- {
- const vcl::Window &rWindow = (const vcl::Window &) rRefDevice;
- const SystemEnvData* pSysData = GetSysData(&rWindow);
- if (pSysData)
- surf = cairo::SurfaceSharedPtr(new cairo::QuartzSurface(pSysData->pView, x, y, width, height));
- }
- else if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
- {
- SystemGraphicsData aSysData = ((const VirtualDevice&) rRefDevice).GetSystemGfxData();
-
- if (aSysData.rCGContext)
- surf = cairo::SurfaceSharedPtr(new cairo::QuartzSurface(aSysData.rCGContext, x, y, width, height));
- }
-#else
- (void)rRefDevice;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
-#endif
- return surf;
-}
-
-/**
- * cairo::createBitmapSurface: Create platform native Canvas surface from BitmapSystemData
- * @param OutputDevice (not used)
- * @param rData Platform native image data (struct BitmapSystemData in vcl/inc/bitmap.hxx)
- * @param rSize width and height of the new surface
- *
- * Create a surface based on image data on rData
- *
- * @return new surface or empty surface
- **/
-cairo::SurfaceSharedPtr AquaSalGraphics::CreateBitmapSurface( const OutputDevice& /* rRefDevice */,
- const BitmapSystemData& rData,
- const Size& rSize ) const
-{
-#if ENABLE_CAIRO_CANVAS
- OSL_TRACE( "requested size: %d x %d available size: %d x %d",
- rSize.Width(), rSize.Height(), rData.mnWidth, rData.mnHeight );
-
- if ( rData.mnWidth == rSize.Width() && rData.mnHeight == rSize.Height() )
- {
- CGContextRef rContext = (CGContextRef)rData.rImageContext;
- OSL_TRACE("Canvas::cairo::createBitmapSurface(): New native image surface, context = %p.", rData.rImageContext);
-
- return cairo::SurfaceSharedPtr(new cairo::QuartzSurface(rContext, 0, 0, rData.mnWidth, rData.mnHeight));
- }
-#else
- (void)rData;
- (void)rSize;
-#endif
- return cairo::SurfaceSharedPtr();
-}
-
-css::uno::Any AquaSalGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& /*rSize*/) const
-{
- sal_IntPtr handle;
-#if ENABLE_CAIRO_CANVAS
- cairo::QuartzSurface* pQuartzSurface = dynamic_cast<cairo::QuartzSurface*>(rSurface.get());
- OSL_ASSERT(pQuartzSurface);
- handle = sal_IntPtr (pQuartzSurface->getCGContext());
-#else
- handle = 0;
- (void)rSurface;
-#endif
- css::uno::Sequence< css::uno::Any > args( 1 );
- args[0] = css::uno::Any( handle );
- return css::uno::Any( args );
-}
-
long AquaSalGraphics::GetGraphicsWidth() const
{
long w = 0;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 216c8a6f8fcd..d9f239bc6f5c 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -280,6 +280,8 @@ bool OutputDevice::GetFontCapabilities( vcl::FontCapabilities& rFontCapabilities
return mpGraphics->GetFontCapabilities(rFontCapabilities);
}
+#if ENABLE_CAIRO_CANVAS
+
SystemFontData OutputDevice::GetSysFontData(int nFallbacklevel) const
{
SystemFontData aSysFontData;
@@ -294,6 +296,8 @@ SystemFontData OutputDevice::GetSysFontData(int nFallbacklevel) const
return aSysFontData;
}
+#endif // ENABLE_CAIRO_CANVAS
+
void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPolyLine,
Rectangle& rRect1, Rectangle& rRect2,
long& rYOff, long& rWidth,
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 2ae452e70d63..0b6d0aa7ec01 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -324,9 +324,10 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
return mpGraphics->GetGraphicsData();
}
+#if ENABLE_CAIRO_CANVAS
+
bool OutputDevice::SupportsCairo() const
{
-#if ENABLE_CAIRO_CANVAS
if (!mpGraphics)
{
if (!AcquireGraphics())
@@ -334,10 +335,6 @@ bool OutputDevice::SupportsCairo() const
}
return mpGraphics->SupportsCairo();
-#else
- (void) this; // loplugin:staticmethods
- return false;
-#endif
}
cairo::SurfaceSharedPtr OutputDevice::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const
@@ -380,6 +377,8 @@ css::uno::Any OutputDevice::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSur
return mpGraphics->GetNativeSurfaceHandle(rSurface, rSize);
}
+#endif // ENABLE_CAIRO_CANVAS
+
css::uno::Any OutputDevice::GetSystemGfxDataAny() const
{
const SystemGraphicsData aSysData = GetSystemGfxData();
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 23d4e5ca1924..95a5e94d15ec 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -36,10 +36,6 @@
#include "salgdiimpl.hxx"
#include "gdiimpl.hxx"
#include "opengl/win/gdiimpl.hxx"
-#include <config_cairo_canvas.h>
-#if ENABLE_CAIRO_CANVAS
-#include "cairo_win32_cairo.cxx"
-#endif
#include <vcl/opengl/OpenGLHelper.hxx>
@@ -1078,141 +1074,6 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const
return aRes;
}
-bool WinSalGraphics::SupportsCairo() const
-{
-#if ENABLE_CAIRO_CANVAS
- return true;
-#else
- return false;
-#endif
-}
-
-/**
- * cairo::createSurface: Create generic Canvas surface using given Cairo Surface
- *
- * @param rSurface Cairo Surface
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr WinSalGraphics::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const
-{
-#if ENABLE_CAIRO_CANVAS
- return cairo::SurfaceSharedPtr(new cairo::Win32Surface(rSurface));
-#else
- (void)rSurface;
- return cairo::SurfaceSharedPtr();
-#endif
-}
-
-/**
- * cairo::createSurface: Create Canvas surface using given VCL Window or Virtualdevice
- *
- * @param rSurface Cairo Surface
- *
- * For VCL Window, use platform native system environment data (struct SystemEnvData in vcl/inc/sysdata.hxx)
- * For VCL Virtualdevice, use platform native system graphics data (struct SystemGraphicsData in vcl/inc/sysdata.hxx)
- *
- * @return new Surface
- */
-cairo::SurfaceSharedPtr WinSalGraphics::CreateSurface( const OutputDevice& rRefDevice,
- int x, int y, int /* width */, int /* height */) const
-{
- cairo::SurfaceSharedPtr surf;
-
-#if ENABLE_CAIRO_CANVAS
- if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
- {
- const vcl::Window &rWindow = (const vcl::Window &) rRefDevice;
- const SystemEnvData* pSysData = GetSysData(&rWindow);
- if (pSysData && pSysData->hWnd)
- surf = cairo::SurfaceSharedPtr(new cairo::Win32Surface(GetDC((HWND) pSysData->hWnd), x, y));
- }
- else if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
- {
- SystemGraphicsData aSysData = ((const VirtualDevice&) rRefDevice).GetSystemGfxData();
- if (aSysData.hDC)
- surf = cairo::SurfaceSharedPtr(new cairo::Win32Surface((HDC) aSysData.hDC, x, y));
- }
-#else
- (void)rRefDevice;
- (void)x;
- (void)y;
-#endif
-
- return surf;
-}
-
-/**
- * cairo::createBitmapSurface: Create platform native Canvas surface from BitmapSystemData
- * @param OutputDevice (not used)
- * @param rData Platform native image data (struct BitmapSystemData in vcl/inc/bitmap.hxx)
- * @param rSize width and height of the new surface
- *
- * Create a surface based on image data on rData
- *
- * @return new surface or empty surface
- **/
-cairo::SurfaceSharedPtr WinSalGraphics::CreateBitmapSurface( const OutputDevice& /* rRefDevice */,
- const BitmapSystemData& rData,
- const Size& rSize ) const
-{
- OSL_TRACE( "requested size: %d x %d available size: %d x %d",
- rSize.Width(), rSize.Height(), rData.mnWidth, rData.mnHeight );
-
-#if ENABLE_CAIRO_CANVAS
- if ( rData.mnWidth == rSize.Width() && rData.mnHeight == rSize.Height() )
- return cairo::SurfaceSharedPtr(new cairo::Win32Surface( rData ));
-#else
- (void)rData;
- (void)rSize;
-#endif
- return cairo::SurfaceSharedPtr();
-}
-
-#if ENABLE_CAIRO_CANVAS
-namespace
-{
- HBITMAP surface2HBitmap( const SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize )
- {
- // can't seem to retrieve HBITMAP from cairo. copy content then
- HDC hScreenDC=GetDC(NULL);
- HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC,
- rSize.getX(),
- rSize.getY() );
-
- HDC hBmpDC = CreateCompatibleDC( 0 );
- HBITMAP hBmpOld = (HBITMAP) SelectObject( hBmpDC, hBmpBitmap );
-
- BitBlt( hBmpDC, 0, 0, rSize.getX(), rSize.getX(),
- cairo_win32_surface_get_dc(rSurface->getCairoSurface().get()),
- 0, 0, SRCCOPY );
-
- SelectObject( hBmpDC, hBmpOld );
- DeleteDC( hBmpDC );
-
- return hBmpBitmap;
- }
-}
-#endif
-
-css::uno::Any WinSalGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const
-{
- // TODO(F2): check whether under all circumstances,
- // the alpha channel is ignored here.
- css::uno::Sequence< css::uno::Any > args( 1 );
- sal_Int64 nHandle;
-#if ENABLE_CAIRO_CANVAS
- nHandle = sal_Int64(surface2HBitmap(rSurface, rSize));
-#else
- (void)rSurface;
- (void)rSize;
- nHandle = 0;
-#endif
- args[1] = css::uno::Any(nHandle);
- // caller frees the bitmap
- return css::uno::Any( args );
-}
-
void WinSalGraphics::BeginPaint()
{
return mpImpl->beginPaint();
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 89b8d96e2526..76cbc222926e 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -2773,19 +2773,4 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
void WinSalGraphics::DrawServerFontLayout( const ServerFontLayout& )
{}
-SystemFontData WinSalGraphics::GetSysFontData( int nFallbacklevel ) const
-{
- SystemFontData aSysFontData;
-
- if (nFallbacklevel >= MAX_FALLBACK) nFallbacklevel = MAX_FALLBACK - 1;
- if (nFallbacklevel < 0 ) nFallbacklevel = 0;
-
- aSysFontData.hFont = mhFonts[nFallbacklevel];
-
- OSL_TRACE("\r\n:WinSalGraphics::GetSysFontData(): FontID: %p, Fallback level: %d",
- aSysFontData.hFont, nFallbacklevel);
-
- return aSysFontData;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */