[Libreoffice-commits] core.git: canvas/source include/vcl vcl/generic vcl/headless vcl/inc vcl/Library_vcl.mk vcl/quartz vcl/source vcl/win
Mox Soini
mox at iki.fi
Thu Jun 11 01:35:36 PDT 2015
canvas/source/cairo/cairo_textlayout.cxx | 97 -----------
include/vcl/sysdata.hxx | 16 -
vcl/Library_vcl.mk | 2
vcl/generic/print/genpspgraphics.cxx | 5
vcl/headless/svpgdi.cxx | 5
vcl/headless/svptext.cxx | 5
vcl/headless/svptextrender.cxx | 5
vcl/inc/generic/genpspgraphics.h | 4
vcl/inc/headless/svpgdi.hxx | 5
vcl/inc/headless/svptextrender.hxx | 3
vcl/inc/quartz/salgdi.h | 6
vcl/inc/salgdi.hxx | 9 +
vcl/inc/textrender.hxx | 3
vcl/inc/win/salgdi.h | 6
vcl/quartz/cairo_quartz_cairo.cxx | 260 -------------------------------
vcl/quartz/cairo_quartz_cairo.hxx | 70 --------
vcl/quartz/salgdi.cxx | 10 -
vcl/quartz/salgdicommon.cxx | 118 --------------
vcl/source/outdev/font.cxx | 4
vcl/source/outdev/outdev.cxx | 9 -
vcl/win/source/gdi/cairo_win32_cairo.cxx | 185 ----------------------
vcl/win/source/gdi/cairo_win32_cairo.hxx | 56 ------
vcl/win/source/gdi/salgdi.cxx | 139 ----------------
vcl/win/source/gdi/salgdi3.cxx | 15 -
24 files changed, 64 insertions(+), 973 deletions(-)
New commits:
commit 0c87f8bf42ba0338dbf6516dc9539223a5dedf4c
Author: Mox Soini <mox at iki.fi>
Date: Tue Jun 2 23:52:56 2015 +0300
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 at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index 35e98c7..6f53264 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -26,15 +26,6 @@
#include <vcl/metric.hxx>
#include <vcl/virdev.hxx>
-
-#ifdef WNT
-#ifdef max
-#undef max
-#endif
-#ifdef min
-#undef min
-#endif
-#endif
#include <vcl/sysdata.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
@@ -45,21 +36,12 @@
#include "cairo_textlayout.hxx"
#include "cairo_spritecanvas.hxx"
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
-#include <cairo-quartz.h>
-#elif defined CAIRO_HAS_WIN32_SURFACE
-# include "cairo_win32_cairo.hxx"
-# include <cairo-win32.h>
-#elif defined CAIRO_HAS_FT_FONT
+#if defined CAIRO_HAS_FT_FONT
# include <cairo-ft.h>
#else
# error Native API needed.
#endif
-#ifdef IOS
-#include <CoreText/CoreText.h>
-#endif
-
using namespace ::cairo;
using namespace ::com::sun::star;
@@ -309,7 +291,7 @@ namespace cairocanvas
**/
bool TextLayout::isCairoRenderable(SystemFontData aSysFontData) const
{
-#if defined UNX && !defined MACOSX && !defined IOS
+#if defined CAIRO_HAS_FT_FONT
// is font usable?
if (!aSysFontData.nFontId)
return false;
@@ -325,46 +307,6 @@ namespace cairocanvas
return true;
}
-#ifdef CAIRO_HAS_WIN32_SURFACE
- namespace
- {
- /**
- * cairo::ucs4toindex: Convert ucs4 char to glyph index
- * @param ucs4 an ucs4 char
- * @param hfont current font
- *
- * @return true if successful
- **/
- unsigned long ucs4toindex(unsigned int ucs4, HFONT hfont)
- {
- wchar_t unicode[2];
- WORD glyph_index;
- HDC hdc = NULL;
-
- hdc = CreateCompatibleDC (NULL);
-
- if (!hdc) return 0;
- if (!SetGraphicsMode (hdc, GM_ADVANCED))
- {
- DeleteDC (hdc);
- return 0;
- }
-
- SelectObject (hdc, hfont);
- SetMapMode (hdc, MM_TEXT);
-
- unicode[0] = ucs4;
- unicode[1] = 0;
- if (GetGlyphIndicesW (hdc, unicode, 1, &glyph_index, 0) == GDI_ERROR)
- {
- glyph_index = 0;
- }
-
- DeleteDC (hdc);
- return glyph_index;
- }
- }
-#endif
/**
* TextLayout::draw
@@ -385,9 +327,6 @@ namespace cairocanvas
{
::osl::MutexGuard aGuard( m_aMutex );
SystemTextLayoutData aSysLayoutData;
-#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
- LOGFONTW logfont;
-#endif
setupLayoutMode( rOutDev, mnTextDirection );
// TODO(P2): cache that
@@ -484,11 +423,6 @@ namespace cairocanvas
cairo_glyph_t aGlyph;
aGlyph.index = systemGlyph.index;
-#ifdef CAIRO_HAS_WIN32_SURFACE
- // Cairo requires standard glyph indexes (ETO_GLYPH_INDEX), while vcl/win/* uses ucs4 chars.
- // Convert to standard indexes
- aGlyph.index = ucs4toindex((unsigned int) aGlyph.index, rSysFontData.hFont);
-#endif
aGlyph.x = systemGlyph.x;
aGlyph.y = systemGlyph.y;
cairo_glyphs.push_back(aGlyph);
@@ -502,24 +436,7 @@ namespace cairocanvas
**/
cairo_font_face_t* font_face = NULL;
-#ifdef CAIRO_HAS_QUARTZ_SURFACE
-# ifdef MACOSX
- // TODO: use cairo_quartz_font_face_create_for_cgfont(cgFont)
- // when CGFont (Mac OS X 10.5 API) is provided by the AQUA VCL backend.
- font_face = cairo_quartz_font_face_create_for_atsu_font_id((ATSUFontID) rSysFontData.aATSUFontID);
-# else // iOS
- font_face = cairo_quartz_font_face_create_for_cgfont( CTFontCopyGraphicsFont( rSysFontData.rCTFont, NULL ) );
-# endif
-
-#elif defined CAIRO_HAS_WIN32_SURFACE
-# if (OSL_DEBUG_LEVEL > 1)
- GetObjectW( rSysFontData.hFont, sizeof(logfont), &logfont );
-# endif
- // Note: cairo library uses logfont fallbacks when lfEscapement, lfOrientation and lfWidth are not zero.
- // VCL always has non-zero value for lfWidth
- font_face = cairo_win32_font_face_create_for_hfont(rSysFontData.hFont);
-
-#elif defined CAIRO_HAS_FT_FONT
+#if defined CAIRO_HAS_FT_FONT
font_face = cairo_ft_font_face_create_for_ft_face(static_cast<FT_Face>(rSysFontData.nFontId),
rSysFontData.nFontFlags);
#else
@@ -567,11 +484,6 @@ namespace cairocanvas
cairo_set_font_matrix(pSCairo.get(), &m);
-#if (defined CAIRO_HAS_WIN32_SURFACE) && (OSL_DEBUG_LEVEL > 1)
-# define TEMP_TRACE_FONT OUString(reinterpret_cast<const sal_Unicode*> (logfont.lfFaceName))
-#else
-# define TEMP_TRACE_FONT aFont.GetName()
-#endif
SAL_INFO(
"canvas.cairo",
"Size:(" << aFont.GetWidth() << "," << aFont.GetHeight()
@@ -586,9 +498,8 @@ namespace cairocanvas
<< (rSysFontData.bAntialias ? "AA " : "")
<< (rSysFontData.bFakeBold ? "FB " : "")
<< (rSysFontData.bFakeItalic ? "FI " : "") << " || Name:"
- << TEMP_TRACE_FONT << " - "
+ << aFont.GetName() << " - "
<< maText.Text.copy(maText.StartPosition, maText.Length));
-#undef TEMP_TRACE_FONT
cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index a525f77..57217df 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -23,6 +23,8 @@
#include <vector>
#include <cstddef>
+#include <config_cairo_canvas.h>
+
#ifdef MACOSX
// predeclare the native classes to avoid header/include problems
typedef struct CGContext *CGContextRef;
@@ -200,13 +202,12 @@ struct SystemGlyphData
int fallbacklevel;
};
+#if ENABLE_CAIRO_CANVAS
+
struct SystemFontData
{
unsigned long nSize; // size in bytes of this structure
-#if defined( WNT )
- HFONT hFont; // native font object
-#elif defined( MACOSX )
-#elif defined( UNX )
+#if defined( UNX )
void* nFontId; // native font id
int nFontFlags; // native font flags
#endif
@@ -217,10 +218,7 @@ struct SystemFontData
SystemFontData()
: nSize( sizeof( SystemFontData ) )
-#if defined( WNT )
- , hFont( 0 )
-#elif defined( MACOSX )
-#elif defined( UNX )
+#if defined( UNX )
, nFontId( NULL )
, nFontFlags( 0 )
#endif
@@ -232,6 +230,8 @@ struct SystemFontData
}
};
+#endif // ENABLE_CAIRO_CANVAS
+
typedef std::vector<SystemGlyphData> SystemGlyphDataVector;
struct SystemTextLayoutData
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7c99bed..0ce40d3 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 e6df236..cdb41f8 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 0f184fd..13f93cf 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 1651a3a..9eb39f26 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 af28eb3..a2acf00 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 8b78faa..5173c65 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 297d28a..cd2c993 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 13d99f4..7c2ca03 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 12c3144..7292479 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 50e5e5a..8c98d08 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 12c47c3..c43ddc6 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 fdd931c..504737a 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 0b0835c..0000000
--- 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 9c31c42..0000000
--- 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 6a1b18a..025d873 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 30f8086..9b42a22 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 eb43913..9f2884c 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 2ae452e..0b6d0aa 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 65dd478..0000000
--- 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 46a5024..0000000
--- 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 2334624..1a1d569 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 89b8d96..76cbc22 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: */
More information about the Libreoffice-commits
mailing list