[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 2 commits - drawinglayer/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 2 19:19:10 UTC 2020
drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 39 +++++++-------
1 file changed, 20 insertions(+), 19 deletions(-)
New commits:
commit 81c9d6f2a99ece342e49af69dcaad804164ec42a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 2 21:16:42 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat May 2 21:18:00 2020 +0200
dl: replace OSL_ENSURE with SAL_WARN_IF in impBufferDevice
Change-Id: I457b9310109157da03b6c310783651f5232d2054
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 54206abf7aa5..534c512daa42 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -219,7 +219,8 @@ void VDevBuffer::free(VirtualDevice& rDevice)
{
::osl::MutexGuard aGuard(m_aMutex);
const auto aUsedFound = std::find(maUsedBuffers.begin(), maUsedBuffers.end(), &rDevice);
- OSL_ENSURE(aUsedFound != maUsedBuffers.end(), "OOps, non-registered buffer freed (!)");
+ SAL_WARN_IF(aUsedFound == maUsedBuffers.end(), "drawinglayer",
+ "OOps, non-registered buffer freed (!)");
maUsedBuffers.erase(aUsedFound);
maFreeBuffers.emplace_back(&rDevice);
@@ -286,8 +287,8 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange&
#endif
// #i93485# assert when copying from window to VDev is used
- OSL_ENSURE(
- mrOutDev.GetOutDevType() != OUTDEV_WINDOW,
+ SAL_WARN_IF(
+ mrOutDev.GetOutDevType() == OUTDEV_WINDOW, "drawinglayer",
"impBufferDevice render helper: Copying from Window to VDev, this should be avoided (!)");
const bool bWasEnabledSrc(mrOutDev.IsMapModeEnabled());
@@ -424,13 +425,15 @@ void impBufferDevice::paint(double fTrans)
VirtualDevice& impBufferDevice::getContent()
{
- assert(mpContent && "impBufferDevice: No content, check isVisible() before accessing (!)");
+ SAL_WARN_IF(!mpContent, "drawinglayer",
+ "impBufferDevice: No content, check isVisible() before accessing (!)");
return *mpContent;
}
VirtualDevice& impBufferDevice::getMask()
{
- assert(mpContent && "impBufferDevice: No content, check isVisible() before accessing (!)");
+ SAL_WARN_IF(!mpContent, "drawinglayer",
+ "impBufferDevice: No content, check isVisible() before accessing (!)");
if (!mpMask)
{
mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, true);
@@ -444,7 +447,8 @@ VirtualDevice& impBufferDevice::getMask()
VirtualDevice& impBufferDevice::getTransparence()
{
- OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)");
+ SAL_WARN_IF(!mpContent, "drawinglayer",
+ "impBufferDevice: No content, check isVisible() before accessing (!)");
if (!mpAlpha)
{
mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false);
commit a4971a957fb94192bf18fa08970d7421a24daf96
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 2 21:07:23 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat May 2 21:15:47 2020 +0200
drawinglayer: remove aBuffer typedef in VDevBuffer
Also use back() method on vector instead of end() - 1
Change-Id: I944691d097f82b1651cff87a7bb0d7c457ece27a
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 53ecdd4ee685..54206abf7aa5 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -39,16 +39,14 @@
namespace
{
-typedef std::vector<VclPtr<VirtualDevice>> aBuffers;
-
class VDevBuffer : public Timer, protected cppu::BaseMutex
{
private:
// available buffers
- aBuffers maFreeBuffers;
+ std::vector<VclPtr<VirtualDevice>> maFreeBuffers;
// allocated/used buffers (remembered to allow deleting them in destructor)
- aBuffers maUsedBuffers;
+ std::vector<VclPtr<VirtualDevice>> maUsedBuffers;
// remember what outputdevice was the template passed to VirtualDevice::Create
// so we can test if that OutputDevice was disposed before reusing a
@@ -83,13 +81,13 @@ VDevBuffer::~VDevBuffer()
while (!maFreeBuffers.empty())
{
- (*(maFreeBuffers.end() - 1)).disposeAndClear();
+ maFreeBuffers.back().disposeAndClear();
maFreeBuffers.pop_back();
}
while (!maUsedBuffers.empty())
{
- (*(maUsedBuffers.end() - 1)).disposeAndClear();
+ maUsedBuffers.back().disposeAndClear();
maUsedBuffers.pop_back();
}
}
@@ -105,9 +103,9 @@ VclPtr<VirtualDevice> VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSize
bool bOkay(false);
if (!maFreeBuffers.empty())
{
- aBuffers::iterator aFound(maFreeBuffers.end());
+ auto aFound(maFreeBuffers.end());
- for (aBuffers::iterator a(maFreeBuffers.begin()); a != maFreeBuffers.end(); ++a)
+ for (auto a = maFreeBuffers.begin(); a != maFreeBuffers.end(); ++a)
{
assert(*a && "Empty pointer in VDevBuffer (!)");
@@ -220,8 +218,7 @@ VclPtr<VirtualDevice> VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSize
void VDevBuffer::free(VirtualDevice& rDevice)
{
::osl::MutexGuard aGuard(m_aMutex);
- const aBuffers::iterator aUsedFound(
- std::find(maUsedBuffers.begin(), maUsedBuffers.end(), &rDevice));
+ const auto aUsedFound = std::find(maUsedBuffers.begin(), maUsedBuffers.end(), &rDevice);
OSL_ENSURE(aUsedFound != maUsedBuffers.end(), "OOps, non-registered buffer freed (!)");
maUsedBuffers.erase(aUsedFound);
@@ -237,9 +234,9 @@ void VDevBuffer::Invoke()
while (!maFreeBuffers.empty())
{
- aBuffers::iterator aLastOne(maFreeBuffers.end() - 1);
- maDeviceTemplates.erase(*aLastOne);
- aLastOne->disposeAndClear();
+ auto aLastOne = maFreeBuffers.back();
+ maDeviceTemplates.erase(aLastOne);
+ aLastOne.disposeAndClear();
maFreeBuffers.pop_back();
}
}
More information about the Libreoffice-commits
mailing list