1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #error This file is not for iOS
26 #include <sal/config.h>
27 #include <config_features.h>
29 #include <osl/endian.h>
30 #include <vcl/sysdata.hxx>
31 #include <config_cairo_canvas.h>
33 #include <font/PhysicalFontFace.hxx>
35 #include <sallayout.hxx>
36 #include "svpcairotextrender.hxx"
37 #include <impfontmetricdata.hxx>
39 #include <headless/SvpGraphicsBackend.hxx>
40 #include <headless/CairoCommon.hxx>
45 class VCL_DLLPUBLIC SvpSalGraphics
: public SalGraphicsAutoDelegateToImpl
47 CairoCommon m_aCairoCommon
;
48 SvpCairoTextRender m_aTextRenderImpl
;
49 std::unique_ptr
<SvpGraphicsBackend
> m_pBackend
;
52 void setSurface(cairo_surface_t
* pSurface
, const basegfx::B2IVector
& rSize
);
53 cairo_surface_t
* getSurface() const { return m_aCairoCommon
.m_pSurface
; }
54 static cairo_user_data_key_t
* getDamageKey()
56 return CairoCommon::getDamageKey();
61 cairo_t
* createTmpCompatibleCairoContext() const;
65 virtual ~SvpSalGraphics() override
;
67 virtual SalGraphicsImpl
* GetImpl() const override
{ return m_pBackend
.get(); }
68 std::unique_ptr
<SvpGraphicsBackend
> const& getSvpBackend() { return m_pBackend
; }
70 virtual void GetResolution( sal_Int32
& rDPIX
, sal_Int32
& rDPIY
) override
;
72 virtual void SetTextColor( Color nColor
) override
;
73 virtual void SetFont(LogicalFontInstance
*, int nFallbackLevel
) override
;
74 virtual void GetFontMetric( ImplFontMetricDataRef
&, int nFallbackLevel
) override
;
75 virtual FontCharMapRef
GetFontCharMap() const override
;
76 virtual bool GetFontCapabilities(vcl::FontCapabilities
&rFontCapabilities
) const override
;
77 virtual void GetDevFontList( vcl::font::PhysicalFontCollection
* ) override
;
78 virtual void ClearDevFontCache() override
;
79 virtual bool AddTempDevFont( vcl::font::PhysicalFontCollection
*, const OUString
& rFileURL
, const OUString
& rFontName
) override
;
80 virtual std::unique_ptr
<GenericSalLayout
>
81 GetTextLayout(int nFallbackLevel
) override
;
82 virtual void DrawTextLayout( const GenericSalLayout
& ) override
;
84 virtual bool ShouldDownscaleIconsAtSurface(double* pScaleOut
) const override
;
86 virtual SystemGraphicsData
GetGraphicsData() const override
;
88 #if ENABLE_CAIRO_CANVAS
89 virtual bool SupportsCairo() const override
;
90 virtual cairo::SurfaceSharedPtr
CreateSurface(const cairo::CairoSurfaceSharedPtr
& rSurface
) const override
;
91 virtual cairo::SurfaceSharedPtr
CreateSurface(const OutputDevice
& rRefDevice
, int x
, int y
, int width
, int height
) const override
;
92 virtual cairo::SurfaceSharedPtr
CreateBitmapSurface(const OutputDevice
& rRefDevice
, const BitmapSystemData
& rData
, const Size
& rSize
) const override
;
93 virtual css::uno::Any
GetNativeSurfaceHandle(cairo::SurfaceSharedPtr
& rSurface
, const basegfx::B2ISize
& rSize
) const override
;
94 #endif // ENABLE_CAIRO_CANVAS
96 cairo_t
* getCairoContext() const
98 return m_aCairoCommon
.getCairoContext(/*bXorModeAllowed*/false, getAntiAlias());
101 void releaseCairoContext(cairo_t
* cr
, const basegfx::B2DRange
& rExtents
) const
103 return m_aCairoCommon
.releaseCairoContext(cr
, /*bXorModeAllowed*/false, rExtents
);
106 void clipRegion(cairo_t
* cr
)
108 m_aCairoCommon
.clipRegion(cr
);
110 void copySource(const SalTwoRect
& rTR
, cairo_surface_t
* source
)
112 m_aCairoCommon
.copySource(rTR
, source
, getAntiAlias());
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */