1464702f4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3464702f4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4464702f4SAndrew Rist * or more contributor license agreements. See the NOTICE file 5464702f4SAndrew Rist * distributed with this work for additional information 6464702f4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7464702f4SAndrew Rist * to you under the Apache License, Version 2.0 (the 8464702f4SAndrew Rist * "License"); you may not use this file except in compliance 9464702f4SAndrew Rist * with the License. You may obtain a copy of the License at 10464702f4SAndrew Rist * 11464702f4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12464702f4SAndrew Rist * 13464702f4SAndrew Rist * Unless required by applicable law or agreed to in writing, 14464702f4SAndrew Rist * software distributed under the License is distributed on an 15464702f4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16464702f4SAndrew Rist * KIND, either express or implied. See the License for the 17464702f4SAndrew Rist * specific language governing permissions and limitations 18464702f4SAndrew Rist * under the License. 19464702f4SAndrew Rist * 20464702f4SAndrew Rist *************************************************************/ 21464702f4SAndrew Rist 22464702f4SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vclhelperbufferdevice.hxx> 28cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 29cdf0e10cSrcweir #include <vcl/bitmapex.hxx> 30cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 31cdf0e10cSrcweir #include <tools/stream.hxx> 32ce37d08fSArmin Le Grand #include <vcl/timer.hxx> 33ce37d08fSArmin Le Grand #include <comphelper/broadcasthelper.hxx> 3433a1c393SArmin Le Grand #include <vcl/lazydelete.hxx> 35ce37d08fSArmin Le Grand 36ce37d08fSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 37ce37d08fSArmin Le Grand // buffered VDev usage 38ce37d08fSArmin Le Grand 39ce37d08fSArmin Le Grand namespace 40ce37d08fSArmin Le Grand { 41ce37d08fSArmin Le Grand typedef ::std::vector< VirtualDevice* > aBuffers; 42ce37d08fSArmin Le Grand 43ce37d08fSArmin Le Grand class VDevBuffer : public Timer, protected comphelper::OBaseMutex 44ce37d08fSArmin Le Grand { 45ce37d08fSArmin Le Grand private: 46*56a68a31SArmin Le Grand // available buffers 47*56a68a31SArmin Le Grand aBuffers maFreeBuffers; 48*56a68a31SArmin Le Grand 49*56a68a31SArmin Le Grand // allocated/used buffers (remembered to allow deleteing them in destructor) 50*56a68a31SArmin Le Grand aBuffers maUsedBuffers; 51ce37d08fSArmin Le Grand 52ce37d08fSArmin Le Grand public: 53ce37d08fSArmin Le Grand VDevBuffer(); 54ce37d08fSArmin Le Grand virtual ~VDevBuffer(); 55ce37d08fSArmin Le Grand 56ce37d08fSArmin Le Grand VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMono); 57ce37d08fSArmin Le Grand void free(VirtualDevice& rDevice); 58ce37d08fSArmin Le Grand 59ce37d08fSArmin Le Grand // Timer virtuals 60ce37d08fSArmin Le Grand virtual void Timeout(); 61ce37d08fSArmin Le Grand }; 62ce37d08fSArmin Le Grand 63ce37d08fSArmin Le Grand VDevBuffer::VDevBuffer() 64ce37d08fSArmin Le Grand : Timer(), 65*56a68a31SArmin Le Grand maFreeBuffers(), 66*56a68a31SArmin Le Grand maUsedBuffers() 67ce37d08fSArmin Le Grand { 68ce37d08fSArmin Le Grand SetTimeout(10L * 1000L); // ten seconds 69ce37d08fSArmin Le Grand } 70ce37d08fSArmin Le Grand 71ce37d08fSArmin Le Grand VDevBuffer::~VDevBuffer() 72ce37d08fSArmin Le Grand { 73ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 74ce37d08fSArmin Le Grand Stop(); 75ce37d08fSArmin Le Grand 76*56a68a31SArmin Le Grand while(!maFreeBuffers.empty()) 77*56a68a31SArmin Le Grand { 78*56a68a31SArmin Le Grand delete *(maFreeBuffers.end() - 1); 79*56a68a31SArmin Le Grand maFreeBuffers.pop_back(); 80*56a68a31SArmin Le Grand } 81*56a68a31SArmin Le Grand 82*56a68a31SArmin Le Grand while(!maUsedBuffers.empty()) 83ce37d08fSArmin Le Grand { 84*56a68a31SArmin Le Grand delete *(maUsedBuffers.end() - 1); 85*56a68a31SArmin Le Grand maUsedBuffers.pop_back(); 86ce37d08fSArmin Le Grand } 87ce37d08fSArmin Le Grand } 88ce37d08fSArmin Le Grand 89ce37d08fSArmin Le Grand VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMono) 90ce37d08fSArmin Le Grand { 91ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 92ce37d08fSArmin Le Grand VirtualDevice* pRetval = 0; 93ce37d08fSArmin Le Grand 94*56a68a31SArmin Le Grand if(!maFreeBuffers.empty()) 95ce37d08fSArmin Le Grand { 96ce37d08fSArmin Le Grand bool bOkay(false); 97*56a68a31SArmin Le Grand aBuffers::iterator aFound(maFreeBuffers.end()); 98ce37d08fSArmin Le Grand 99*56a68a31SArmin Le Grand for(aBuffers::iterator a(maFreeBuffers.begin()); a != maFreeBuffers.end(); a++) 100ce37d08fSArmin Le Grand { 101ce37d08fSArmin Le Grand OSL_ENSURE(*a, "Empty pointer in VDevBuffer (!)"); 102ce37d08fSArmin Le Grand 103ce37d08fSArmin Le Grand if((bMono && 1 == (*a)->GetBitCount()) || (!bMono && (*a)->GetBitCount() > 1)) 104ce37d08fSArmin Le Grand { 105ce37d08fSArmin Le Grand // candidate is valid due to bit depth 106*56a68a31SArmin Le Grand if(aFound != maFreeBuffers.end()) 107ce37d08fSArmin Le Grand { 108ce37d08fSArmin Le Grand // already found 109ce37d08fSArmin Le Grand if(bOkay) 110ce37d08fSArmin Le Grand { 111ce37d08fSArmin Le Grand // found is valid 112ce37d08fSArmin Le Grand const bool bCandidateOkay((*a)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*a)->GetOutputHeightPixel() >= rSizePixel.getHeight()); 113ce37d08fSArmin Le Grand 114ce37d08fSArmin Le Grand if(bCandidateOkay) 115ce37d08fSArmin Le Grand { 116ce37d08fSArmin Le Grand // found and candidate are valid 117ce37d08fSArmin Le Grand const sal_uLong aSquare((*aFound)->GetOutputWidthPixel() * (*aFound)->GetOutputHeightPixel()); 118ce37d08fSArmin Le Grand const sal_uLong aCandidateSquare((*a)->GetOutputWidthPixel() * (*a)->GetOutputHeightPixel()); 119ce37d08fSArmin Le Grand 120ce37d08fSArmin Le Grand if(aCandidateSquare < aSquare) 121ce37d08fSArmin Le Grand { 122ce37d08fSArmin Le Grand // candidate is valid and smaller, use it 123ce37d08fSArmin Le Grand aFound = a; 124ce37d08fSArmin Le Grand } 125ce37d08fSArmin Le Grand } 126ce37d08fSArmin Le Grand else 127ce37d08fSArmin Le Grand { 128ce37d08fSArmin Le Grand // found is valid, candidate is not. Keep found 129ce37d08fSArmin Le Grand } 130ce37d08fSArmin Le Grand } 131ce37d08fSArmin Le Grand else 132ce37d08fSArmin Le Grand { 133ce37d08fSArmin Le Grand // found is invalid, use candidate 134ce37d08fSArmin Le Grand aFound = a; 135ce37d08fSArmin Le Grand bOkay = (*aFound)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*aFound)->GetOutputHeightPixel() >= rSizePixel.getHeight(); 136ce37d08fSArmin Le Grand } 137ce37d08fSArmin Le Grand } 138ce37d08fSArmin Le Grand else 139ce37d08fSArmin Le Grand { 140ce37d08fSArmin Le Grand // none yet, use candidate 141ce37d08fSArmin Le Grand aFound = a; 142ce37d08fSArmin Le Grand bOkay = (*aFound)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*aFound)->GetOutputHeightPixel() >= rSizePixel.getHeight(); 143ce37d08fSArmin Le Grand } 144ce37d08fSArmin Le Grand } 145ce37d08fSArmin Le Grand } 146ce37d08fSArmin Le Grand 147*56a68a31SArmin Le Grand if(aFound != maFreeBuffers.end()) 148ce37d08fSArmin Le Grand { 149ce37d08fSArmin Le Grand pRetval = *aFound; 150*56a68a31SArmin Le Grand maFreeBuffers.erase(aFound); 151ce37d08fSArmin Le Grand 152ce37d08fSArmin Le Grand if(bOkay) 153ce37d08fSArmin Le Grand { 154ce37d08fSArmin Le Grand if(bClear) 155ce37d08fSArmin Le Grand { 156ce37d08fSArmin Le Grand pRetval->Erase(Rectangle(0, 0, rSizePixel.getWidth(), rSizePixel.getHeight())); 157ce37d08fSArmin Le Grand } 158ce37d08fSArmin Le Grand } 159ce37d08fSArmin Le Grand else 160ce37d08fSArmin Le Grand { 161ce37d08fSArmin Le Grand pRetval->SetOutputSizePixel(rSizePixel, bClear); 162ce37d08fSArmin Le Grand } 163ce37d08fSArmin Le Grand } 164ce37d08fSArmin Le Grand } 165ce37d08fSArmin Le Grand 166ce37d08fSArmin Le Grand // no success yet, create new buffer 167ce37d08fSArmin Le Grand if(!pRetval) 168ce37d08fSArmin Le Grand { 169ce37d08fSArmin Le Grand pRetval = (bMono) ? new VirtualDevice(rOutDev, 1) : new VirtualDevice(rOutDev); 170ce37d08fSArmin Le Grand pRetval->SetOutputSizePixel(rSizePixel, bClear); 171ce37d08fSArmin Le Grand } 172ce37d08fSArmin Le Grand else 173ce37d08fSArmin Le Grand { 174ce37d08fSArmin Le Grand // reused, reset some values 175ce37d08fSArmin Le Grand pRetval->SetMapMode(); 176ce37d08fSArmin Le Grand } 177ce37d08fSArmin Le Grand 178*56a68a31SArmin Le Grand // remember allocated buffer 179*56a68a31SArmin Le Grand maUsedBuffers.push_back(pRetval); 180*56a68a31SArmin Le Grand 181ce37d08fSArmin Le Grand return pRetval; 182ce37d08fSArmin Le Grand } 183ce37d08fSArmin Le Grand 184ce37d08fSArmin Le Grand void VDevBuffer::free(VirtualDevice& rDevice) 185ce37d08fSArmin Le Grand { 186ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 187*56a68a31SArmin Le Grand const aBuffers::iterator aUsedFound(::std::find(maUsedBuffers.begin(), maUsedBuffers.end(), &rDevice)); 188*56a68a31SArmin Le Grand OSL_ENSURE(aUsedFound != maUsedBuffers.end(), "OOps, non-registered buffer freed (!)"); 189*56a68a31SArmin Le Grand 190*56a68a31SArmin Le Grand maUsedBuffers.erase(aUsedFound); 191*56a68a31SArmin Le Grand maFreeBuffers.push_back(&rDevice); 192ce37d08fSArmin Le Grand Start(); 193ce37d08fSArmin Le Grand } 194ce37d08fSArmin Le Grand 195ce37d08fSArmin Le Grand void VDevBuffer::Timeout() 196ce37d08fSArmin Le Grand { 197ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 198ce37d08fSArmin Le Grand 199*56a68a31SArmin Le Grand while(!maFreeBuffers.empty()) 200ce37d08fSArmin Le Grand { 201*56a68a31SArmin Le Grand delete *(maFreeBuffers.end() - 1); 202*56a68a31SArmin Le Grand maFreeBuffers.pop_back(); 203ce37d08fSArmin Le Grand } 204ce37d08fSArmin Le Grand } 205ce37d08fSArmin Le Grand } 206cdf0e10cSrcweir 207cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 208cdf0e10cSrcweir // support for rendering Bitmap and BitmapEx contents 209cdf0e10cSrcweir 210cdf0e10cSrcweir namespace drawinglayer 211cdf0e10cSrcweir { 212ce37d08fSArmin Le Grand // static global VDev buffer for the VclProcessor2D's (VclMetafileProcessor2D and VclPixelProcessor2D) 21333a1c393SArmin Le Grand VDevBuffer& getVDevBuffer() 21433a1c393SArmin Le Grand { 21533a1c393SArmin Le Grand // secure global instance with Vcl's safe desroyer of external (seen by 21633a1c393SArmin Le Grand // library base) stuff, the remembered VDevs need to be deleted before 21733a1c393SArmin Le Grand // Vcl's deinit 21833a1c393SArmin Le Grand static vcl::DeleteOnDeinit< VDevBuffer > aVDevBuffer(new VDevBuffer()); 21933a1c393SArmin Le Grand return *aVDevBuffer.get(); 22033a1c393SArmin Le Grand } 221ce37d08fSArmin Le Grand 222ce37d08fSArmin Le Grand impBufferDevice::impBufferDevice( 223ce37d08fSArmin Le Grand OutputDevice& rOutDev, 224ce37d08fSArmin Le Grand const basegfx::B2DRange& rRange, 225ce37d08fSArmin Le Grand bool bAddOffsetToMapping) 226ce37d08fSArmin Le Grand : mrOutDev(rOutDev), 227ce37d08fSArmin Le Grand mpContent(0), 228ce37d08fSArmin Le Grand mpMask(0), 229ce37d08fSArmin Le Grand mpAlpha(0) 230ce37d08fSArmin Le Grand { 231cdf0e10cSrcweir basegfx::B2DRange aRangePixel(rRange); 232ce37d08fSArmin Le Grand aRangePixel.transform(mrOutDev.GetViewTransformation()); 233cdf0e10cSrcweir const Rectangle aRectPixel( 234ce37d08fSArmin Le Grand (sal_Int32)floor(aRangePixel.getMinX()), (sal_Int32)floor(aRangePixel.getMinY()), 235ce37d08fSArmin Le Grand (sal_Int32)ceil(aRangePixel.getMaxX()), (sal_Int32)ceil(aRangePixel.getMaxY())); 236ce37d08fSArmin Le Grand const Point aEmptyPoint; 237ce37d08fSArmin Le Grand maDestPixel = Rectangle(aEmptyPoint, mrOutDev.GetOutputSizePixel()); 238ce37d08fSArmin Le Grand maDestPixel.Intersection(aRectPixel); 239cdf0e10cSrcweir 240ce37d08fSArmin Le Grand if(isVisible()) 241ce37d08fSArmin Le Grand { 24233a1c393SArmin Le Grand mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), false, false); 243cdf0e10cSrcweir 244cdf0e10cSrcweir // #i93485# assert when copying from window to VDev is used 245ce37d08fSArmin Le Grand OSL_ENSURE(mrOutDev.GetOutDevType() != OUTDEV_WINDOW, 246cdf0e10cSrcweir "impBufferDevice render helper: Copying from Window to VDev, this should be avoided (!)"); 247cdf0e10cSrcweir 248ce37d08fSArmin Le Grand const bool bWasEnabledSrc(mrOutDev.IsMapModeEnabled()); 249ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(false); 250ce37d08fSArmin Le Grand mpContent->DrawOutDev(aEmptyPoint, maDestPixel.GetSize(), maDestPixel.TopLeft(), maDestPixel.GetSize(), mrOutDev); 251ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(bWasEnabledSrc); 252cdf0e10cSrcweir 253ce37d08fSArmin Le Grand MapMode aNewMapMode(mrOutDev.GetMapMode()); 254cdf0e10cSrcweir 255ce37d08fSArmin Le Grand if(bAddOffsetToMapping) 256ce37d08fSArmin Le Grand { 257ce37d08fSArmin Le Grand const Point aLogicTopLeft(mrOutDev.PixelToLogic(maDestPixel.TopLeft())); 258ce37d08fSArmin Le Grand aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y())); 259ce37d08fSArmin Le Grand } 260cdf0e10cSrcweir 261ce37d08fSArmin Le Grand mpContent->SetMapMode(aNewMapMode); 262cdf0e10cSrcweir 263cdf0e10cSrcweir // copy AA flag for new target 264ce37d08fSArmin Le Grand mpContent->SetAntialiasing(mrOutDev.GetAntialiasing()); 265ce37d08fSArmin Le Grand } 266ce37d08fSArmin Le Grand } 267ce37d08fSArmin Le Grand 268ce37d08fSArmin Le Grand impBufferDevice::~impBufferDevice() 269ce37d08fSArmin Le Grand { 270ce37d08fSArmin Le Grand if(mpContent) 271ce37d08fSArmin Le Grand { 27233a1c393SArmin Le Grand getVDevBuffer().free(*mpContent); 273ce37d08fSArmin Le Grand } 274ce37d08fSArmin Le Grand 275ce37d08fSArmin Le Grand if(mpMask) 276ce37d08fSArmin Le Grand { 27733a1c393SArmin Le Grand getVDevBuffer().free(*mpMask); 278ce37d08fSArmin Le Grand } 279cdf0e10cSrcweir 280cdf0e10cSrcweir if(mpAlpha) 281ce37d08fSArmin Le Grand { 28233a1c393SArmin Le Grand getVDevBuffer().free(*mpAlpha); 283ce37d08fSArmin Le Grand } 284ce37d08fSArmin Le Grand } 285cdf0e10cSrcweir 286ce37d08fSArmin Le Grand void impBufferDevice::paint(double fTrans) 287ce37d08fSArmin Le Grand { 288ce37d08fSArmin Le Grand if(isVisible()) 289ce37d08fSArmin Le Grand { 290ce37d08fSArmin Le Grand const Point aEmptyPoint; 291ce37d08fSArmin Le Grand const Size aSizePixel(maDestPixel.GetSize()); 292ce37d08fSArmin Le Grand const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled()); 293ce37d08fSArmin Le Grand static bool bDoSaveForVisualControl(false); 294ce37d08fSArmin Le Grand 295ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(false); 296ce37d08fSArmin Le Grand mpContent->EnableMapMode(false); 297ce37d08fSArmin Le Grand Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); 298ce37d08fSArmin Le Grand 299cdf0e10cSrcweir if(bDoSaveForVisualControl) 300ce37d08fSArmin Le Grand { 301ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\content.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 302ce37d08fSArmin Le Grand aNew << aContent; 303ce37d08fSArmin Le Grand } 304ce37d08fSArmin Le Grand 305ce37d08fSArmin Le Grand if(mpAlpha) 306ce37d08fSArmin Le Grand { 307ce37d08fSArmin Le Grand mpAlpha->EnableMapMode(false); 308ce37d08fSArmin Le Grand const AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); 309cdf0e10cSrcweir 310ce37d08fSArmin Le Grand if(bDoSaveForVisualControl) 311ce37d08fSArmin Le Grand { 312ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\transparence.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 313ce37d08fSArmin Le Grand aNew << aAlphaMask.GetBitmap(); 314ce37d08fSArmin Le Grand } 315cdf0e10cSrcweir 316ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); 317ce37d08fSArmin Le Grand } 318ce37d08fSArmin Le Grand else if(mpMask) 319ce37d08fSArmin Le Grand { 320ce37d08fSArmin Le Grand mpMask->EnableMapMode(false); 321ce37d08fSArmin Le Grand const Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); 322cdf0e10cSrcweir 323ce37d08fSArmin Le Grand if(bDoSaveForVisualControl) 324ce37d08fSArmin Le Grand { 325ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\mask.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 326ce37d08fSArmin Le Grand aNew << aMask; 327ce37d08fSArmin Le Grand } 328cdf0e10cSrcweir 329ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); 330ce37d08fSArmin Le Grand } 331ce37d08fSArmin Le Grand else if(0.0 != fTrans) 332ce37d08fSArmin Le Grand { 333ce37d08fSArmin Le Grand sal_uInt8 nMaskValue((sal_uInt8)basegfx::fround(fTrans * 255.0)); 334ce37d08fSArmin Le Grand const AlphaMask aAlphaMask(aSizePixel, &nMaskValue); 335ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); 336ce37d08fSArmin Le Grand } 337ce37d08fSArmin Le Grand else 338ce37d08fSArmin Le Grand { 339ce37d08fSArmin Le Grand mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent); 340ce37d08fSArmin Le Grand } 341ce37d08fSArmin Le Grand 342ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(bWasEnabledDst); 343ce37d08fSArmin Le Grand } 344ce37d08fSArmin Le Grand } 345ce37d08fSArmin Le Grand 346ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getContent() 347ce37d08fSArmin Le Grand { 348ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 349ce37d08fSArmin Le Grand return *mpContent; 350ce37d08fSArmin Le Grand } 351cdf0e10cSrcweir 352ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getMask() 353ce37d08fSArmin Le Grand { 354ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 355ce37d08fSArmin Le Grand if(!mpMask) 356ce37d08fSArmin Le Grand { 35733a1c393SArmin Le Grand mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, true); 358ce37d08fSArmin Le Grand mpMask->SetMapMode(mpContent->GetMapMode()); 359ce37d08fSArmin Le Grand 360ce37d08fSArmin Le Grand // do NOT copy AA flag for mask! 361ce37d08fSArmin Le Grand } 362ce37d08fSArmin Le Grand 363ce37d08fSArmin Le Grand return *mpMask; 364ce37d08fSArmin Le Grand } 365ce37d08fSArmin Le Grand 366ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getTransparence() 367ce37d08fSArmin Le Grand { 368ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 369ce37d08fSArmin Le Grand if(!mpAlpha) 370ce37d08fSArmin Le Grand { 37133a1c393SArmin Le Grand mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false); 372ce37d08fSArmin Le Grand mpAlpha->SetMapMode(mpContent->GetMapMode()); 373ce37d08fSArmin Le Grand 374ce37d08fSArmin Le Grand // copy AA flag for new target; masking needs to be smooth 375ce37d08fSArmin Le Grand mpAlpha->SetAntialiasing(mpContent->GetAntialiasing()); 376ce37d08fSArmin Le Grand } 377ce37d08fSArmin Le Grand 378ce37d08fSArmin Le Grand return *mpAlpha; 379ce37d08fSArmin Le Grand } 380cdf0e10cSrcweir } // end of namespace drawinglayer 381cdf0e10cSrcweir 382cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 383cdf0e10cSrcweir // eof 384