[Libreoffice-commits] core.git: vcl/inc vcl/ios vcl/osx vcl/quartz vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 23 12:59:59 UTC 2021
vcl/inc/quartz/salgdi.h | 3 ++-
vcl/inc/skia/osx/gdiimpl.hxx | 5 ++++-
vcl/ios/salios.cxx | 8 +++++---
vcl/osx/salgdiutils.cxx | 3 +++
vcl/osx/salmacos.cxx | 8 +++++---
vcl/quartz/salvd.cxx | 4 ++--
vcl/skia/osx/gdiimpl.cxx | 9 +++------
7 files changed, 24 insertions(+), 16 deletions(-)
New commits:
commit 09b16f9f44578182306c47cdabe92a31cc5d3b4c
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Aug 12 16:08:50 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Aug 23 14:59:25 2021 +0200
make SalGeometryProvider available for Aqua VCL backends
This is needed for the Skia backend to know the geometry.
The Mac Skia code now passes most VCL unittests.
Change-Id: I6e35764d95ce821d8e11ed9979e5be75bcf6ff49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120806
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index ab7a25ee9b7c..8ec68cddcc09 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -285,6 +285,7 @@ public:
mpImpl = dynamic_cast<SalGraphicsImpl*>(this);
return mpImpl;
}
+ virtual void UpdateGeometryProvider(SalGeometryProvider*) {};
};
inline AquaGraphicsBackendBase::~AquaGraphicsBackendBase() {}
@@ -436,7 +437,7 @@ public:
AquaSalGraphics();
virtual ~AquaSalGraphics() override;
- void SetVirDevGraphics(CGLayerHolder const &rLayer, CGContextRef, int nBitDepth = 0);
+ void SetVirDevGraphics(SalVirtualDevice* pVirDev,CGLayerHolder const &rLayer, CGContextRef, int nBitDepth = 0);
#ifdef MACOSX
void initResolution( NSWindow* );
void copyResolution( AquaSalGraphics& );
diff --git a/vcl/inc/skia/osx/gdiimpl.hxx b/vcl/inc/skia/osx/gdiimpl.hxx
index 8523d272e897..eabea4483c2d 100644
--- a/vcl/inc/skia/osx/gdiimpl.hxx
+++ b/vcl/inc/skia/osx/gdiimpl.hxx
@@ -24,11 +24,14 @@ public:
AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent, AquaSharedAttributes& rShared);
virtual ~AquaSkiaSalGraphicsImpl() override;
- virtual void Init() override;
virtual void DeInit() override;
virtual void freeResources() override;
// virtual void Flush() override;
+ virtual void UpdateGeometryProvider(SalGeometryProvider* provider) override
+ {
+ setProvider(provider);
+ }
static void prepareSkia();
private:
diff --git a/vcl/ios/salios.cxx b/vcl/ios/salios.cxx
index 335c14264c64..c078654286de 100644
--- a/vcl/ios/salios.cxx
+++ b/vcl/ios/salios.cxx
@@ -272,7 +272,7 @@ void AquaGraphicsBackend::copyArea(tools::Long nDstX, tools::Long nDstY,tools::L
mrShared.refreshRect(nDstX, nDstY, nSrcWidth, nSrcHeight);
}
-void AquaSalGraphics::SetVirDevGraphics(CGLayerHolder const & rLayer, CGContextRef xContext,
+void AquaSalGraphics::SetVirDevGraphics(SalVirtualDevice* pVirDev, CGLayerHolder const & rLayer, CGContextRef xContext,
int nBitmapDepth)
{
SAL_INFO( "vcl.quartz", "SetVirDevGraphics() this=" << this << " layer=" << rLayer.get() << " context=" << xContext );
@@ -288,6 +288,8 @@ void AquaSalGraphics::SetVirDevGraphics(CGLayerHolder const & rLayer, CGContextR
maShared.mbForeignContext = xContext != NULL;
+ mpBackend->UpdateGeometryProvider(pVirDev);
+
// return early if the virdev is being destroyed
if (!xContext)
return;
@@ -489,7 +491,7 @@ void AquaSalVirtualDevice::Destroy()
{
if( mpGraphics )
{
- mpGraphics->SetVirDevGraphics(nullptr, nullptr);
+ mpGraphics->SetVirDevGraphics(this, nullptr, nullptr);
}
CGLayerRelease(maLayer.get());
maLayer.set(nullptr);
@@ -573,7 +575,7 @@ bool AquaSalVirtualDevice::SetSize( tools::Long nDX, tools::Long nDY )
// to SetVirDevGraphics(). That parameter is of type CGLayerHolder, so what we actually pass
// is an implicitly constructed *separate* CGLayerHolder. Is that what we want? No idea.
// Possibly we could pass just maLayer as such? But doing that does not fix tdf#138122.
- mpGraphics->SetVirDevGraphics(maLayer.get(), xDrawContext, mnBitmapDepth);
+ mpGraphics->SetVirDevGraphics(this, maLayer.get(), xDrawContext, mnBitmapDepth);
}
return maLayer.isSet();
diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx
index 81210c8e876c..da1d3ab2138a 100644
--- a/vcl/osx/salgdiutils.cxx
+++ b/vcl/osx/salgdiutils.cxx
@@ -75,6 +75,7 @@ void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame )
maShared.mbWindow = true;
maShared.mbPrinter = false;
maShared.mbVirDev = false;
+ mpBackend->UpdateGeometryProvider(pFrame);
}
void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, sal_Int32 nDPIX, sal_Int32 nDPIY )
@@ -97,6 +98,8 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, sal_Int32 nDPIX
CGContextSaveGState( maShared.maContextHolder.get() );
maShared.setState();
}
+
+ mpBackend->UpdateGeometryProvider(nullptr);
}
void AquaSalGraphics::InvalidateContext()
diff --git a/vcl/osx/salmacos.cxx b/vcl/osx/salmacos.cxx
index 78b06fc911dd..700b252cf4f3 100644
--- a/vcl/osx/salmacos.cxx
+++ b/vcl/osx/salmacos.cxx
@@ -211,7 +211,7 @@ void AquaGraphicsBackend::copyScaledArea(tools::Long nDstX, tools::Long nDstY,to
mrShared.refreshRect(nDstX, nDstY, nSrcWidth, nSrcHeight);
}
-void AquaSalGraphics::SetVirDevGraphics(CGLayerHolder const &rLayer, CGContextRef xContext, int nBitmapDepth)
+void AquaSalGraphics::SetVirDevGraphics(SalVirtualDevice* pVirDev, CGLayerHolder const &rLayer, CGContextRef xContext, int nBitmapDepth)
{
SAL_INFO("vcl.quartz", "SetVirDevGraphics() this=" << this << " layer=" << rLayer.get() << " context=" << xContext);
@@ -224,6 +224,8 @@ void AquaSalGraphics::SetVirDevGraphics(CGLayerHolder const &rLayer, CGContextRe
maShared.maLayer = rLayer;
maShared.mnBitmapDepth = nBitmapDepth;
+ mpBackend->UpdateGeometryProvider(pVirDev);
+
// Get size and scale from layer if set else from bitmap and sal::aqua::getWindowScaling(), which is used to determine
// scaling for direct graphics output too
@@ -444,7 +446,7 @@ void AquaSalVirtualDevice::Destroy()
{
if( mpGraphics )
{
- mpGraphics->SetVirDevGraphics(nullptr, nullptr);
+ mpGraphics->SetVirDevGraphics(this, nullptr, nullptr);
}
CGLayerRelease(maLayer.get());
maLayer.set(nullptr);
@@ -517,7 +519,7 @@ bool AquaSalVirtualDevice::SetSize(tools::Long nDX, tools::Long nDY)
CGSize aLayerSize = { static_cast<CGFloat>(nScaledWidth), static_cast<CGFloat>(nScaledHeight) };
maLayer.set(CGLayerCreateWithContext(maBitmapContext.get(), aLayerSize, nullptr));
maLayer.setScale(fScale);
- mpGraphics->SetVirDevGraphics(maLayer, CGLayerGetContext(maLayer.get()), mnBitmapDepth);
+ mpGraphics->SetVirDevGraphics(this, maLayer, CGLayerGetContext(maLayer.get()), mnBitmapDepth);
SAL_WARN_IF(!maBitmapContext.isSet(), "vcl.quartz", "No context");
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 4e84e33a13b5..7cd82fbcbb96 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -103,7 +103,7 @@ AquaSalVirtualDevice::AquaSalVirtualDevice(
nDY = 0;
}
- mpGraphics->SetVirDevGraphics(maLayer, pData->rCGContext);
+ mpGraphics->SetVirDevGraphics(this, maLayer, pData->rCGContext);
SAL_INFO("vcl.virdev", "AquaSalVirtualDevice::AquaSalVirtualDevice() this=" << this <<
" (" << nDX << "x" << nDY << ") mbForeignContext=" << (mbForeignContext ? "YES" : "NO"));
@@ -151,7 +151,7 @@ AquaSalVirtualDevice::~AquaSalVirtualDevice()
if( mpGraphics )
{
- mpGraphics->SetVirDevGraphics( nullptr, nullptr );
+ mpGraphics->SetVirDevGraphics( this, nullptr, nullptr );
delete mpGraphics;
mpGraphics = nullptr;
}
diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx
index e15406ea831c..399f8d024f0a 100644
--- a/vcl/skia/osx/gdiimpl.cxx
+++ b/vcl/skia/osx/gdiimpl.cxx
@@ -30,15 +30,12 @@ AquaSkiaSalGraphicsImpl::AquaSkiaSalGraphicsImpl(AquaSalGraphics& rParent,
: SkiaSalGraphicsImpl(rParent, rShared.mpFrame)
, AquaGraphicsBackendBase(rShared)
{
+ Init(); // mac code doesn't call Init()
}
-AquaSkiaSalGraphicsImpl::~AquaSkiaSalGraphicsImpl() { DeInit(); }
-
-void AquaSkiaSalGraphicsImpl::Init()
+AquaSkiaSalGraphicsImpl::~AquaSkiaSalGraphicsImpl()
{
- // The m_pFrame and m_pVDev pointers are updated late in X11
- // setProvider(mX11Parent.GetGeometryProvider());
- // SkiaSalGraphicsImpl::Init();
+ DeInit(); // mac code doesn't call DeInit()
}
void AquaSkiaSalGraphicsImpl::DeInit()
More information about the Libreoffice-commits
mailing list