From c43a3a58677b467274ce6c21d7db1a6c0cc65cb4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 17 Nov 2015 13:03:23 +0000 Subject: establish that Virtual Devices either match Physical Device depth or ... are 1 or (rarely) 8 bit and lock that down. Change-Id: I3d946ebef34ffb71c5adea7aa420af50e9584e05 --- .../source/primitive2d/graphicprimitivehelper2d.cxx | 3 ++- .../source/processor2d/vclhelperbufferdevice.cxx | 19 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drawinglayer/source') diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 21bd6c6244b3..be7ff6541fa7 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -96,7 +96,8 @@ namespace if(maAnimation.Count()) { ScopedVclPtrInstance< VirtualDevice > aVirtualDevice(*Application::GetDefaultDevice()); - ScopedVclPtrInstance< VirtualDevice > aVirtualDeviceMask(*Application::GetDefaultDevice(), 1L); + ScopedVclPtrInstance< VirtualDevice > aVirtualDeviceMask(*Application::GetDefaultDevice(), + DeviceFormat::BITMASK); // Prepare VirtualDevices and their states aVirtualDevice->EnableMapMode(false); diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 06b7b5bc9fd3..2d1d498f095d 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -47,7 +47,7 @@ namespace VDevBuffer(); virtual ~VDevBuffer(); - VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, sal_Int32 nBits); + VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome); void free(VirtualDevice& rDevice); // Timer virtuals @@ -80,13 +80,12 @@ namespace } } - VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, sal_Int32 nBits) + VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMonoChrome) { ::osl::MutexGuard aGuard(m_aMutex); VirtualDevice* pRetval = nullptr; - if (nBits == 0) - nBits = rOutDev.GetBitCount(); + sal_Int32 nBits = bMonoChrome ? 1 : rOutDev.GetBitCount(); if(!maFreeBuffers.empty()) { @@ -97,7 +96,7 @@ namespace { OSL_ENSURE(*a, "Empty pointer in VDevBuffer (!)"); - if(nBits == (*a)->GetBitCount()) + if (nBits == (*a)->GetBitCount()) { // candidate is valid due to bit depth if(aFound != maFreeBuffers.end()) @@ -163,7 +162,7 @@ namespace // no success yet, create new buffer if(!pRetval) { - pRetval = VclPtr::Create(rOutDev, nBits); + pRetval = VclPtr::Create(rOutDev, bMonoChrome ? DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR); pRetval->SetOutputSizePixel(rSizePixel, bClear); } else @@ -243,9 +242,9 @@ namespace drawinglayer // rendering, especially shadows, is broken on iOS unless // we pass 'true' here. Are virtual devices always de // facto cleared when created on other platforms? - mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, 0); + mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false); #else - mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), false, 0); + mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), false, false); #endif // #i93485# assert when copying from window to VDev is used @@ -361,7 +360,7 @@ namespace drawinglayer assert(mpContent && "impBufferDevice: No content, check isVisible() before accessing (!)"); if (!mpMask) { - mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, 1); + mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, true); mpMask->SetMapMode(mpContent->GetMapMode()); // do NOT copy AA flag for mask! @@ -375,7 +374,7 @@ namespace drawinglayer OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); if(!mpAlpha) { - mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, 0); + mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false); mpAlpha->SetMapMode(mpContent->GetMapMode()); // copy AA flag for new target; masking needs to be smooth -- cgit