diff options
author | Mox Soini <mox@iki.fi> | 2015-06-02 23:52:56 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-06-11 08:35:09 +0000 |
commit | 0c87f8bf42ba0338dbf6516dc9539223a5dedf4c (patch) | |
tree | b2257ea435d70bf8e5bc00f0529f6dabf6e563b5 /vcl | |
parent | 776a3f14f2d987312b926ebc1ad09321a3a87f0d (diff) |
Cleanup crossplatform cairo
Mac / Win cairo is not built / used, this cairo code can be removed to
reduce code bloat.
4th Revised version with Android fixes
Change-Id: I6e56850f535ca13b77839b7d67e227c5f39d388e
Reviewed-on: https://gerrit.libreoffice.org/16218
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Library_vcl.mk | 2 | ||||
-rw-r--r-- | vcl/generic/print/genpspgraphics.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svpgdi.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svptext.cxx | 5 | ||||
-rw-r--r-- | vcl/headless/svptextrender.cxx | 5 | ||||
-rw-r--r-- | vcl/inc/generic/genpspgraphics.h | 4 | ||||
-rw-r--r-- | vcl/inc/headless/svpgdi.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/headless/svptextrender.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 6 | ||||
-rw-r--r-- | vcl/inc/salgdi.hxx | 9 | ||||
-rw-r--r-- | vcl/inc/textrender.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 6 | ||||
-rw-r--r-- | vcl/quartz/cairo_quartz_cairo.cxx | 260 | ||||
-rw-r--r-- | vcl/quartz/cairo_quartz_cairo.hxx | 70 | ||||
-rw-r--r-- | vcl/quartz/salgdi.cxx | 10 | ||||
-rw-r--r-- | vcl/quartz/salgdicommon.cxx | 118 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 4 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 9 | ||||
-rw-r--r-- | vcl/win/source/gdi/cairo_win32_cairo.cxx | 185 | ||||
-rw-r--r-- | vcl/win/source/gdi/cairo_win32_cairo.hxx | 56 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi.cxx | 139 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 15 |
22 files changed, 52 insertions, 872 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/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index e6df23672fae..cdb41f8e424e 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -40,6 +40,7 @@ #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/sysdata.hxx> +#include <config_cairo_canvas.h> #include "fontsubset.hxx" #include "generic/geninst.h" @@ -1209,6 +1210,8 @@ SystemGraphicsData GenPspGraphics::GetGraphicsData() const return SystemGraphicsData(); } +#if ENABLE_CAIRO_CANVAS + bool GenPspGraphics::SupportsCairo() const { return false; @@ -1239,6 +1242,8 @@ SystemFontData GenPspGraphics::GetSysFontData( int /* nFallbacklevel */ ) const return SystemFontData(); } +#endif // ENABLE_CAIRO_CANVAS + bool GenPspGraphics::supportsOperation( OutDevSupportType ) const { return false; diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index 0f184fddbf6f..13f93cff3e5e 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -25,6 +25,7 @@ #include "saldatabasic.hxx" #include <vcl/sysdata.hxx> +#include <config_cairo_canvas.h> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2ibox.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -735,6 +736,8 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const #endif +#if ENABLE_CAIRO_CANVAS + bool SvpSalGraphics::SupportsCairo() const { return false; @@ -760,4 +763,6 @@ css::uno::Any SvpSalGraphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& /* return css::uno::Any(); } +#endif // ENABLE_CAIRO_CANVAS + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx index 1651a3a49c5d..9eb39f263b69 100644 --- a/vcl/headless/svptext.cxx +++ b/vcl/headless/svptext.cxx @@ -20,6 +20,7 @@ #include <sal/types.h> #include <basegfx/range/b2ibox.hxx> #include "headless/svpgdi.hxx" +#include <config_cairo_canvas.h> sal_uInt16 SvpSalGraphics::SetFont( FontSelectPattern* pIFSD, int nFallbackLevel ) { @@ -123,11 +124,15 @@ void SvpSalGraphics::SetTextColor( SalColor nSalColor ) m_xTextRenderImpl->SetTextColor(nSalColor); } +#if ENABLE_CAIRO_CANVAS + SystemFontData SvpSalGraphics::GetSysFontData( int nFallbacklevel ) const { return m_xTextRenderImpl->GetSysFontData(nFallbacklevel); } +#endif // ENABLE_CAIRO_CANVAS + void SvpSalGraphics::BlendTextColor(const basebmp::Color &rTextColor, const basebmp::BitmapDeviceSharedPtr &rAlphaMask, const basegfx::B2IPoint &rDstPoint) { diff --git a/vcl/headless/svptextrender.cxx b/vcl/headless/svptextrender.cxx index af28eb302357..a2acf005e4e8 100644 --- a/vcl/headless/svptextrender.cxx +++ b/vcl/headless/svptextrender.cxx @@ -28,6 +28,7 @@ #include <rtl/instance.hxx> #include <tools/debug.hxx> #include <vcl/sysdata.hxx> +#include <config_cairo_canvas.h> #include "generic/geninst.h" #include "generic/genpspgraphics.h" @@ -447,6 +448,8 @@ void SvpTextRender::SetTextColor( SalColor nSalColor ) m_aTextColor = basebmp::Color( nSalColor ); } +#if ENABLE_CAIRO_CANVAS + SystemFontData SvpTextRender::GetSysFontData( int nFallbackLevel ) const { SystemFontData aSysFontData; @@ -468,6 +471,8 @@ SystemFontData SvpTextRender::GetSysFontData( int nFallbackLevel ) const return aSysFontData; } +#endif // ENABLE_CAIRO_CANVAS + void SvpTextRender::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) { // determine matching bitmap format for masks diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index 8b78faa8d0b1..5173c653dec3 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -21,6 +21,7 @@ #define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H #include <vcl/vclenum.hxx> +#include <config_cairo_canvas.h> #include "fontmanager.hxx" #include "salgdi.hxx" @@ -201,6 +202,8 @@ public: sal_uInt8 nTransparency ) SAL_OVERRIDE; virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; + +#if ENABLE_CAIRO_CANVAS 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; @@ -208,6 +211,7 @@ public: virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; +#endif // ENABLE_CAIRO_CANVAS virtual void BeginPaint() SAL_OVERRIDE { }; virtual void EndPaint() SAL_OVERRIDE { }; diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index 297d28a7f4fa..cd2c993a303b 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -24,6 +24,7 @@ #include <basebmp/color.hxx> #include <vcl/sysdata.hxx> #include <vcl/metric.hxx> +#include <config_cairo_canvas.h> #include "salgdi.hxx" #include "sallayout.hxx" @@ -199,6 +200,8 @@ public: virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) SAL_OVERRIDE; virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; + +#if ENABLE_CAIRO_CANVAS 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; @@ -207,6 +210,8 @@ public: virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; +#endif // ENABLE_CAIRO_CANVAS + virtual void BeginPaint() SAL_OVERRIDE { }; virtual void EndPaint() SAL_OVERRIDE { }; }; diff --git a/vcl/inc/headless/svptextrender.hxx b/vcl/inc/headless/svptextrender.hxx index 13d99f4eaf4f..7c2ca03bb7b7 100644 --- a/vcl/inc/headless/svptextrender.hxx +++ b/vcl/inc/headless/svptextrender.hxx @@ -23,6 +23,7 @@ #include "textrender.hxx" #include <vcl/region.hxx> #include <deque> +#include <config_cairo_canvas.h> class VCL_DLLPUBLIC SvpTextRender : public TextRenderImpl { @@ -74,7 +75,9 @@ public: virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) SAL_OVERRIDE; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) SAL_OVERRIDE; virtual void DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE; +#if ENABLE_CAIRO_CANVAS virtual SystemFontData GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE; +#endif // ENABLE_CAIRO_CANVAS }; #endif // INCLUDED_VCL_INC_HEADLESS_SVPTEXTRENDER_HXX 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/textrender.hxx b/vcl/inc/textrender.hxx index 12c47c3ac715..c43ddc6ebd96 100644 --- a/vcl/inc/textrender.hxx +++ b/vcl/inc/textrender.hxx @@ -28,6 +28,7 @@ #include "salgdi.hxx" #include "salglyphid.hxx" #include "fontsubset.hxx" +#include <config_cairo_canvas.h> class PspSalPrinter; class PspSalInfoPrinter; @@ -81,7 +82,9 @@ public: virtual bool GetGlyphOutline( sal_GlyphId nIndex, ::basegfx::B2DPolyPolygon& ) = 0; virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) = 0; virtual void DrawServerFontLayout( const ServerFontLayout& ) = 0; +#if ENABLE_CAIRO_CANVAS virtual SystemFontData GetSysFontData( int nFallbackLevel ) const = 0; +#endif // ENABLE_CAIRO_CANVAS }; #endif 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/cairo_quartz_cairo.cxx b/vcl/quartz/cairo_quartz_cairo.cxx deleted file mode 100644 index 0b0835c8fb05..000000000000 --- a/vcl/quartz/cairo_quartz_cairo.cxx +++ /dev/null @@ -1,260 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <config_cairo_canvas.h> - -#if ENABLE_CAIRO_CANVAS -/************************************************************************ - * Mac OS X/Quartz and iOS surface backend for LibreOffice Cairo Canvas * - ************************************************************************/ - -#include <osl/diagnose.h> -#include <vcl/sysdata.hxx> -#include <vcl/bitmap.hxx> -#include <vcl/virdev.hxx> - -#include "cairo_cairo.hxx" - -#include <config_cairo_canvas.h> - -#include "cairo_quartz_cairo.hxx" - -namespace cairo -{ - /** - * QuartzSurface::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() - * and QuartzSurface::getSimilar() - * - * Set the mpSurface to the new surface or NULL - **/ - QuartzSurface::QuartzSurface( const CairoSurfaceSharedPtr& pSurface ) : - mpView(NULL), - mpSurface( pSurface ) - { - // Necessary, context is lost otherwise - CGContextRetain( getCGContext() ); // == NULL for non-native surfaces - } - - /** - * QuartzSurface::Surface: Create Canvas surface from Window reference. - * @param NSView - * @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 - * - * pSysData contains the platform native Window reference. - * pSysData is used to create a surface on the Window - * - * Set the mpSurface to the new surface or NULL - **/ - QuartzSurface::QuartzSurface( NSView* pView, int x, int y, int width, int height ) : - mpView(pView), - mpSurface() - { - OSL_TRACE("Canvas::cairo::Surface(NSView*, x:%d, y:%d, w:%d, h:%d): New Surface for window", x, y, width, height); - - // on Mac OS X / Quartz we are not drawing directly to the screen, but via regular CGContextRef. - // The actual drawing to NSView (i.e. screen) is done in QuartzSurface::flush() - - // HACK: currently initial size for windowsurface is 0x0, which is not possible for us. - if (width == 0 || height == 0) { - width = [mpView bounds].size.width; - height = [mpView bounds].size.height; - OSL_TRACE("Canvas::cairo::Surface(): BUG!! size is ZERO! fixing to %d x %d...", width, height); - } - - // create a generic surface, NSView/Window is ARGB32. - mpSurface.reset( - cairo_quartz_surface_create(CAIRO_FORMAT_ARGB32, width, height), - &cairo_surface_destroy); - - cairo_surface_set_device_offset( mpSurface.get(), x, y ); - } - - /** - * QuartzSurface::Surface: Create Canvas surface from CGContextRef. - * @param CGContext Native graphics context - * @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 - **/ - QuartzSurface::QuartzSurface( CGContextRef rContext, int x, int y, int width, int height ) : - mpView(NULL), - mpSurface() - { - OSL_TRACE("Canvas::cairo::Surface(CGContext:%p, x:%d, y:%d, w:%d, h:%d): New Surface.", rContext, x, y, width, height); - // create surface based on CGContext - - // ensure kCGBitmapByteOrder32Host flag, otherwise Cairo breaks (we are practically always using CGBitmapContext) - OSL_ASSERT ((CGBitmapContextGetBitsPerPixel(rContext) != 32) || - (CGBitmapContextGetBitmapInfo(rContext) & kCGBitmapByteOrderMask) == kCGBitmapByteOrder32Host); - - mpSurface.reset(cairo_quartz_surface_create_for_cg_context(rContext, width, height), - &cairo_surface_destroy); - - cairo_surface_set_device_offset( mpSurface.get(), x, y ); - - // Necessary, context is lost otherwise - CGContextRetain(rContext); - } - - - /** - * QuartzSurface::getCairo: Create Cairo (drawing object) for the Canvas surface - * - * @return new Cairo or NULL - **/ - CairoSharedPtr QuartzSurface::getCairo() const - { - if (mpSurface.get()) - { - return CairoSharedPtr( cairo_create(mpSurface.get()), - &cairo_destroy ); - } - else - { - return CairoSharedPtr(); - } - } - - /** - * QuartzSurface::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. This normally creates platform native surface, even though - * generic function is used. - * - * Cairo surface from aContent (cairo_content_t) - * - * @return new surface or NULL - **/ - SurfaceSharedPtr QuartzSurface::getSimilar( Content aContent, int width, int height ) const - { - return SurfaceSharedPtr( - new QuartzSurface( - CairoSurfaceSharedPtr( - cairo_surface_create_similar( mpSurface.get(), aContent, width, height ), - &cairo_surface_destroy ))); - } - - /** - * QuartzSurface::flush: Draw the data to screen - **/ - void QuartzSurface::flush() const - { - // can only flush surfaces with NSView - if( !mpView ) - return; - - OSL_TRACE("Canvas::cairo::QuartzSurface::flush(): flush to NSView"); - - CGContextRef mrContext = getCGContext(); - - if (!mrContext) - return; -#ifndef IOS - [mpView lockFocus]; -#endif - -#ifndef IOS - /** - * This code is using same screen update code as in VCL (esp. AquaSalGraphics::UpdateWindow() ) - */ - CGContextRef rViewContext = reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]); -#else - // Just guessing for now... - CGContextRef rViewContext = UIGraphicsGetCurrentContext(); -#endif - CGImageRef xImage = CGBitmapContextCreateImage(mrContext); - CGContextDrawImage(rViewContext, - CGRectMake( 0, 0, - CGImageGetWidth(xImage), - CGImageGetHeight(xImage)), - xImage); - CGImageRelease( xImage ); - CGContextFlush( rViewContext ); -#ifndef IOS - [mpView unlockFocus]; -#endif - } - - /** - * QuartzSurface::getDepth: Get the color depth of the Canvas surface. - * - * @return color depth - **/ - int QuartzSurface::getDepth() const - { - if (mpSurface.get()) - { - switch (cairo_surface_get_content (mpSurface.get())) - { - case CAIRO_CONTENT_ALPHA: return 8; break; - case CAIRO_CONTENT_COLOR: return 24; break; - case CAIRO_CONTENT_COLOR_ALPHA: return 32; break; - } - } - OSL_TRACE("Canvas::cairo::QuartzSurface::getDepth(): ERROR - depth unspecified!"); - - return -1; - } - - /** - * QuartzSurface::getCGContext: Get the native CGContextRef of the Canvas's cairo surface - * - * @return graphics context - **/ - CGContextRef QuartzSurface::getCGContext() const - { - if (mpSurface.get()) - return cairo_quartz_surface_get_cg_context(mpSurface.get()); - else - return NULL; - } - - /** - * cairo::createVirtualDevice: Create a VCL virtual device for the CGContext in the cairo Surface - * - * @return The new virtual device - **/ - VclPtr<VirtualDevice> QuartzSurface::createVirtualDevice() const - { - SystemGraphicsData aSystemGraphicsData; - aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); - aSystemGraphicsData.rCGContext = getCGContext(); - return VclPtr<VirtualDevice>( - VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), getDepth() )); - } - -} // namespace cairo - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/cairo_quartz_cairo.hxx b/vcl/quartz/cairo_quartz_cairo.hxx deleted file mode 100644 index 9c31c42c6ab9..000000000000 --- a/vcl/quartz/cairo_quartz_cairo.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_QUARTZ_CAIRO_HXX -#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_QUARTZ_CAIRO_HXX - -#include "cairo_cairo.hxx" - -#include "premac.h" -#include <TargetConditionals.h> -#if !defined(TARGET_OS_IPHONE) || !TARGET_OS_IPHONE -# include <Cocoa/Cocoa.h> -#else -# include <UIKit/UIKit.h> -# define NSView UIView -#endif -#include <cairo-quartz.h> -#include "postmac.h" - -namespace cairo { - - class QuartzSurface : public Surface - { - NSView* mpView; // if NULL - bg surface - CairoSurfaceSharedPtr mpSurface; - - public: - /// takes over ownership of passed cairo_surface - explicit QuartzSurface( const CairoSurfaceSharedPtr& pSurface ); - - /// create surface on subarea of given CGContext - explicit QuartzSurface( CGContextRef rContext, int x, int y, int width, int height ); - - /// create a offscreen surface for given NSView - QuartzSurface( NSView* pView, int x, int y, int width, int height ); - - // Surface interface - virtual CairoSharedPtr getCairo() const; - virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; } - virtual SurfaceSharedPtr getSimilar( Content aContent, int width, int height ) const; - - virtual VclPtr<VirtualDevice> createVirtualDevice() const; - - virtual void flush() const; - - int getDepth() const; - - CGContextRef getCGContext() const; - }; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 6a1b18af04c6..025d873c2f98 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 30f8086da031..9b42a222c6af 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 eb43913f3deb..9f2884cebdf9 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/cairo_win32_cairo.cxx b/vcl/win/source/gdi/cairo_win32_cairo.cxx deleted file mode 100644 index 65dd478bd1dc..000000000000 --- a/vcl/win/source/gdi/cairo_win32_cairo.cxx +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <config_cairo_canvas.h> - -#if ENABLE_CAIRO_CANVAS -/************************************************************************ - * Win32 surface backend for LibreOffice Cairo Canvas * - ************************************************************************/ - -#include <osl/diagnose.h> -#include <vcl/bitmap.hxx> -#include <vcl/virdev.hxx> -#include <vcl/sysdata.hxx> - -#include "cairo_win32_cairo.hxx" - -namespace cairo -{ - -#include <cairo-win32.h> - - /** - * 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() - * and Surface::getSimilar() - * - * Set the mpSurface to the new surface or NULL - **/ - Win32Surface::Win32Surface( const CairoSurfaceSharedPtr& pSurface ) : - mpSurface( pSurface ) - {} - - /** - * Surface::Surface: Create Canvas surface from Window reference. - * @param pSysData Platform native system environment data (struct SystemEnvData in vcl/inc/sysdata.hxx) - * @param x horizontal location of the new surface - * @param y vertical location of the new surface - * - * pSysData contains the platform native Window reference. - * pSysData is used to create a surface on the Window - * - * Set the mpSurface to the new surface or NULL - **/ - Win32Surface::Win32Surface( HDC hDC, int x, int y) : - mpSurface( - cairo_win32_surface_create(hDC), - &cairo_surface_destroy) - { - cairo_surface_set_device_offset( mpSurface.get(), x, y ); - } - - /** - * Surface::Surface: Create platform native Canvas surface from BitmapSystemData - * @param pBmpData Platform native image data (struct BitmapSystemData in vcl/inc/bitmap.hxx) - * - * Create a surface based on image data on pBmpData - * - * Set the mpSurface to the new surface or NULL - **/ - Win32Surface::Win32Surface( const BitmapSystemData& rBmpData ) : - mpSurface() - { - OSL_ASSERT(rBmpData.pDIB == NULL); - - if(rBmpData.pDIB != NULL) - { - // So just leave mpSurface to NULL, little else we can do at - // this stage. Hopefully the Win32 patch to - // cairocanvas::DeviceHelper::getSurface(BitmapSystemData&, - // const Size&) will catch the cases where this - // constructor would be called with a DIB bitmap, and we - // will never get here. At least it worked for Ballmer.ppt. - } - else - { - HDC hDC = CreateCompatibleDC(NULL); - void* hOrigBitmap; - OSL_TRACE ("Surface::Surface(): Selecting bitmap %p into DC %p", rBmpData.pDDB, hDC); - hOrigBitmap = SelectObject( hDC, (HANDLE)rBmpData.pDDB ); - if(hOrigBitmap == NULL) - OSL_TRACE ("SelectObject failed: %d", GetLastError ()); - mpSurface.reset( - cairo_win32_surface_create(hDC), - &cairo_surface_destroy); - } - } - - /** - * Surface::getCairo: Create Cairo (drawing object) for the Canvas surface - * - * @return new Cairo or NULL - **/ - CairoSharedPtr Win32Surface::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. This normally creates platform native surface, even though - * generic function is used. - * - * Cairo surface from aContent (cairo_content_t) - * - * @return new surface or NULL - **/ - SurfaceSharedPtr Win32Surface::getSimilar( int aContent, int width, int height ) const - { - return SurfaceSharedPtr( - new Win32Surface( - CairoSurfaceSharedPtr( - cairo_surface_create_similar( mpSurface.get(), aContent, width, height ), - &cairo_surface_destroy ))); - } - - void Win32Surface::flush() const - { - GdiFlush(); - } - - /** - * Surface::getDepth: Get the color depth of the Canvas surface. - * - * @return color depth - **/ - int Win32Surface::getDepth() const - { - if (mpSurface) - { - switch (cairo_surface_get_content (mpSurface.get())) - { - case CAIRO_CONTENT_ALPHA: return 8; break; - case CAIRO_CONTENT_COLOR: return 24; break; - case CAIRO_CONTENT_COLOR_ALPHA: return 32; break; - } - } - OSL_TRACE("Canvas::cairo::Surface::getDepth(): ERROR - depth unspecified!"); - return -1; - } - - - /** - * cairo::createVirtualDevice: Create a VCL virtual device for the CGContext in the cairo Surface - * - * @return The new virtual device - **/ - VclPtr<VirtualDevice> Win32Surface::createVirtualDevice() const - { - SystemGraphicsData aSystemGraphicsData; - aSystemGraphicsData.nSize = sizeof( SystemGraphicsData ); - aSystemGraphicsData.hDC = cairo_win32_surface_get_dc( mpSurface.get() ); - return VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>( getDepth() ) ); - } - -} // namespace cairo - -#endif // #ENABLE_CAIRO_CANVAS - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/cairo_win32_cairo.hxx b/vcl/win/source/gdi/cairo_win32_cairo.hxx deleted file mode 100644 index 46a502416638..000000000000 --- a/vcl/win/source/gdi/cairo_win32_cairo.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_WIN32_CAIRO_HXX -#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_WIN32_CAIRO_HXX - -#include "cairo_cairo.hxx" -#include <prewin.h> -#include <postwin.h> - -namespace cairo { - - class Win32Surface : public Surface - { - CairoSurfaceSharedPtr mpSurface; - - public: - /// takes over ownership of passed cairo_surface - explicit Win32Surface( const CairoSurfaceSharedPtr& pSurface ); - /// create surface on subarea of given drawable - Win32Surface( HDC hDC, int x, int y ); - /// create surface for given bitmap data - explicit Win32Surface( const BitmapSystemData& rBmpData ); - - // Surface interface - virtual CairoSharedPtr getCairo() const; - virtual CairoSurfaceSharedPtr getCairoSurface() const { return mpSurface; } - virtual SurfaceSharedPtr getSimilar( int aContent, int width, int height ) const; - - virtual VclPtr<VirtualDevice> createVirtualDevice() const; - - virtual void flush() const; - - int getDepth() const; - }; -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 2334624d58f6..1a1d569afceb 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -35,10 +35,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> @@ -1077,141 +1073,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: */ |