summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/headless/SvpGraphicsBackend.cxx17
-rw-r--r--vcl/headless/svpgdi.cxx24
-rw-r--r--vcl/inc/headless/CairoCommon.hxx1
-rw-r--r--vcl/inc/headless/SvpGraphicsBackend.hxx6
-rw-r--r--vcl/inc/headless/svpgdi.hxx5
5 files changed, 26 insertions, 27 deletions
diff --git a/vcl/headless/SvpGraphicsBackend.cxx b/vcl/headless/SvpGraphicsBackend.cxx
index d8688f7cefd5..bac3d949a279 100644
--- a/vcl/headless/SvpGraphicsBackend.cxx
+++ b/vcl/headless/SvpGraphicsBackend.cxx
@@ -24,7 +24,10 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <vcl/BitmapTools.hxx>
-SvpGraphicsBackend::SvpGraphicsBackend() {}
+SvpGraphicsBackend::SvpGraphicsBackend(CairoCommon& rCairoCommon)
+ : m_rCairoCommon(rCairoCommon)
+{
+}
void SvpGraphicsBackend::Init() {}
@@ -34,9 +37,17 @@ bool SvpGraphicsBackend::setClipRegion(const vcl::Region& /*i_rClip*/) { return
void SvpGraphicsBackend::ResetClipRegion() {}
-sal_uInt16 SvpGraphicsBackend::GetBitCount() const { return 0; }
+sal_uInt16 SvpGraphicsBackend::GetBitCount() const
+{
+ if (cairo_surface_get_content(m_rCairoCommon.m_pSurface) != CAIRO_CONTENT_COLOR_ALPHA)
+ return 1;
+ return 32;
+}
-tools::Long SvpGraphicsBackend::GetGraphicsWidth() const { return 0; }
+tools::Long SvpGraphicsBackend::GetGraphicsWidth() const
+{
+ return m_rCairoCommon.m_pSurface ? m_rCairoCommon.m_aFrameSize.getX() : 0;
+}
void SvpGraphicsBackend::SetLineColor() {}
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 1e6a6edf7100..d32c65448ce9 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -918,7 +918,7 @@ SvpSalGraphics::SvpSalGraphics()
, m_aFillColor(Color(0xFF, 0xFF, 0XFF))
, m_ePaintMode(PaintMode::Over)
, m_aTextRenderImpl(*this)
- , m_pBackend(new SvpGraphicsBackend())
+ , m_pBackend(new SvpGraphicsBackend(m_aCairoCommon))
{
bool bLOKActive = comphelper::LibreOfficeKit::isActive();
initWidgetDrawBackends(bLOKActive);
@@ -932,7 +932,7 @@ SvpSalGraphics::~SvpSalGraphics()
void SvpSalGraphics::setSurface(cairo_surface_t* pSurface, const basegfx::B2IVector& rSize)
{
m_aCairoCommon.m_pSurface = pSurface;
- m_aFrameSize = rSize;
+ m_aCairoCommon.m_aFrameSize = rSize;
dl_cairo_surface_get_device_scale(pSurface, &m_fScale, nullptr);
ResetClipRegion();
}
@@ -942,18 +942,6 @@ void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY )
rDPIX = rDPIY = 96;
}
-sal_uInt16 SvpSalGraphics::GetBitCount() const
-{
- if (cairo_surface_get_content(m_aCairoCommon.m_pSurface) != CAIRO_CONTENT_COLOR_ALPHA)
- return 1;
- return 32;
-}
-
-tools::Long SvpSalGraphics::GetGraphicsWidth() const
-{
- return m_aCairoCommon.m_pSurface ? m_aFrameSize.getX() : 0;
-}
-
void SvpSalGraphics::ResetClipRegion()
{
m_aClipRegion.SetNull();
@@ -2487,8 +2475,8 @@ cairo_t* SvpSalGraphics::createTmpCompatibleCairoContext() const
cairo_surface_t *target = cairo_image_surface_create(
#endif
CAIRO_FORMAT_ARGB32,
- m_aFrameSize.getX() * m_fScale,
- m_aFrameSize.getY() * m_fScale);
+ m_aCairoCommon.m_aFrameSize.getX() * m_fScale,
+ m_aCairoCommon.m_aFrameSize.getY() * m_fScale);
dl_cairo_surface_set_device_scale(target, m_fScale, m_fScale);
@@ -2539,8 +2527,8 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
basegfx::B2IRange aIntExtents(basegfx::unotools::b2ISurroundingRangeFromB2DRange(rExtents));
sal_Int32 nExtentsLeft(aIntExtents.getMinX()), nExtentsTop(aIntExtents.getMinY());
sal_Int32 nExtentsRight(aIntExtents.getMaxX()), nExtentsBottom(aIntExtents.getMaxY());
- sal_Int32 nWidth = m_aFrameSize.getX();
- sal_Int32 nHeight = m_aFrameSize.getY();
+ sal_Int32 nWidth = m_aCairoCommon.m_aFrameSize.getX();
+ sal_Int32 nHeight = m_aCairoCommon.m_aFrameSize.getY();
nExtentsLeft = std::max<sal_Int32>(nExtentsLeft, 0);
nExtentsTop = std::max<sal_Int32>(nExtentsTop, 0);
nExtentsRight = std::min<sal_Int32>(nExtentsRight, nWidth);
diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx
index 3e00c0a41cff..34bbc57a4d43 100644
--- a/vcl/inc/headless/CairoCommon.hxx
+++ b/vcl/inc/headless/CairoCommon.hxx
@@ -63,6 +63,7 @@ typedef struct _cairo_user_data_key cairo_user_data_key_t;
struct VCL_DLLPUBLIC CairoCommon
{
cairo_surface_t* m_pSurface;
+ basegfx::B2IVector m_aFrameSize;
CairoCommon()
: m_pSurface(nullptr)
diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx
index a21e886abf7f..e927ad9b684b 100644
--- a/vcl/inc/headless/SvpGraphicsBackend.hxx
+++ b/vcl/inc/headless/SvpGraphicsBackend.hxx
@@ -25,10 +25,14 @@
#include <salgdiimpl.hxx>
#include <salgdi.hxx>
+#include <headless/CairoCommon.hxx>
+
class VCL_DLLPUBLIC SvpGraphicsBackend : public SalGraphicsImpl
{
+ CairoCommon& m_rCairoCommon;
+
public:
- SvpGraphicsBackend();
+ SvpGraphicsBackend(CairoCommon& rCairoCommon);
void Init() override;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index dac0c62ed4dc..827dffcb46e8 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -60,7 +60,6 @@ struct VCL_DLLPUBLIC DamageHandler
class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphicsAutoDelegateToImpl
{
CairoCommon m_aCairoCommon;
- basegfx::B2IVector m_aFrameSize;
double m_fScale;
Color m_aLineColor;
Color m_aFillColor;
@@ -130,8 +129,6 @@ public:
virtual SalGraphicsImpl* GetImpl() const override { return m_pBackend.get(); }
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
- virtual sal_uInt16 GetBitCount() const override;
- virtual tools::Long GetGraphicsWidth() const override;
virtual void ResetClipRegion() override;
virtual bool setClipRegion( const vcl::Region& ) override;
@@ -241,8 +238,6 @@ public:
virtual SystemGraphicsData GetGraphicsData() const override;
- virtual OUString getRenderBackendName() const override { return "svp"; }
-
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;