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 22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 23cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <vclhelperbufferdevice.hxx> 26cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx> 27cdf0e10cSrcweir #include <vcl/bitmapex.hxx> 28cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 29cdf0e10cSrcweir #include <tools/stream.hxx> 30ce37d08fSArmin Le Grand #include <vcl/timer.hxx> 31ce37d08fSArmin Le Grand #include <comphelper/broadcasthelper.hxx> 3233a1c393SArmin Le Grand #include <vcl/lazydelete.hxx> 33*45fd3b9aSArmin Le Grand #include <vcl/dibtools.hxx> 34ce37d08fSArmin Le Grand 35ce37d08fSArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 36ce37d08fSArmin Le Grand // buffered VDev usage 37ce37d08fSArmin Le Grand 38ce37d08fSArmin Le Grand namespace 39ce37d08fSArmin Le Grand { 40ce37d08fSArmin Le Grand typedef ::std::vector< VirtualDevice* > aBuffers; 41ce37d08fSArmin Le Grand 42ce37d08fSArmin Le Grand class VDevBuffer : public Timer, protected comphelper::OBaseMutex 43ce37d08fSArmin Le Grand { 44ce37d08fSArmin Le Grand private: 4556a68a31SArmin Le Grand // available buffers 4656a68a31SArmin Le Grand aBuffers maFreeBuffers; 4756a68a31SArmin Le Grand 4856a68a31SArmin Le Grand // allocated/used buffers (remembered to allow deleteing them in destructor) 4956a68a31SArmin Le Grand aBuffers maUsedBuffers; 50ce37d08fSArmin Le Grand 51ce37d08fSArmin Le Grand public: 52ce37d08fSArmin Le Grand VDevBuffer(); 53ce37d08fSArmin Le Grand virtual ~VDevBuffer(); 54ce37d08fSArmin Le Grand 55ce37d08fSArmin Le Grand VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMono); 56ce37d08fSArmin Le Grand void free(VirtualDevice& rDevice); 57ce37d08fSArmin Le Grand 58ce37d08fSArmin Le Grand // Timer virtuals 59ce37d08fSArmin Le Grand virtual void Timeout(); 60ce37d08fSArmin Le Grand }; 61ce37d08fSArmin Le Grand VDevBuffer()62ce37d08fSArmin Le Grand VDevBuffer::VDevBuffer() 63ce37d08fSArmin Le Grand : Timer(), 6456a68a31SArmin Le Grand maFreeBuffers(), 6556a68a31SArmin Le Grand maUsedBuffers() 66ce37d08fSArmin Le Grand { 67ce37d08fSArmin Le Grand SetTimeout(10L * 1000L); // ten seconds 68ce37d08fSArmin Le Grand } 69ce37d08fSArmin Le Grand ~VDevBuffer()70ce37d08fSArmin Le Grand VDevBuffer::~VDevBuffer() 71ce37d08fSArmin Le Grand { 72ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 73ce37d08fSArmin Le Grand Stop(); 74ce37d08fSArmin Le Grand 7556a68a31SArmin Le Grand while(!maFreeBuffers.empty()) 7656a68a31SArmin Le Grand { 7756a68a31SArmin Le Grand delete *(maFreeBuffers.end() - 1); 7856a68a31SArmin Le Grand maFreeBuffers.pop_back(); 7956a68a31SArmin Le Grand } 8056a68a31SArmin Le Grand 8156a68a31SArmin Le Grand while(!maUsedBuffers.empty()) 82ce37d08fSArmin Le Grand { 8356a68a31SArmin Le Grand delete *(maUsedBuffers.end() - 1); 8456a68a31SArmin Le Grand maUsedBuffers.pop_back(); 85ce37d08fSArmin Le Grand } 86ce37d08fSArmin Le Grand } 87ce37d08fSArmin Le Grand alloc(OutputDevice & rOutDev,const Size & rSizePixel,bool bClear,bool bMono)88ce37d08fSArmin Le Grand VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& rSizePixel, bool bClear, bool bMono) 89ce37d08fSArmin Le Grand { 90ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 91ce37d08fSArmin Le Grand VirtualDevice* pRetval = 0; 92ce37d08fSArmin Le Grand 9356a68a31SArmin Le Grand if(!maFreeBuffers.empty()) 94ce37d08fSArmin Le Grand { 95ce37d08fSArmin Le Grand bool bOkay(false); 9656a68a31SArmin Le Grand aBuffers::iterator aFound(maFreeBuffers.end()); 97ce37d08fSArmin Le Grand 9856a68a31SArmin Le Grand for(aBuffers::iterator a(maFreeBuffers.begin()); a != maFreeBuffers.end(); a++) 99ce37d08fSArmin Le Grand { 100ce37d08fSArmin Le Grand OSL_ENSURE(*a, "Empty pointer in VDevBuffer (!)"); 101ce37d08fSArmin Le Grand 102ce37d08fSArmin Le Grand if((bMono && 1 == (*a)->GetBitCount()) || (!bMono && (*a)->GetBitCount() > 1)) 103ce37d08fSArmin Le Grand { 104ce37d08fSArmin Le Grand // candidate is valid due to bit depth 10556a68a31SArmin Le Grand if(aFound != maFreeBuffers.end()) 106ce37d08fSArmin Le Grand { 107ce37d08fSArmin Le Grand // already found 108ce37d08fSArmin Le Grand if(bOkay) 109ce37d08fSArmin Le Grand { 110ce37d08fSArmin Le Grand // found is valid 111ce37d08fSArmin Le Grand const bool bCandidateOkay((*a)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*a)->GetOutputHeightPixel() >= rSizePixel.getHeight()); 112ce37d08fSArmin Le Grand 113ce37d08fSArmin Le Grand if(bCandidateOkay) 114ce37d08fSArmin Le Grand { 115ce37d08fSArmin Le Grand // found and candidate are valid 116ce37d08fSArmin Le Grand const sal_uLong aSquare((*aFound)->GetOutputWidthPixel() * (*aFound)->GetOutputHeightPixel()); 117ce37d08fSArmin Le Grand const sal_uLong aCandidateSquare((*a)->GetOutputWidthPixel() * (*a)->GetOutputHeightPixel()); 118ce37d08fSArmin Le Grand 119ce37d08fSArmin Le Grand if(aCandidateSquare < aSquare) 120ce37d08fSArmin Le Grand { 121ce37d08fSArmin Le Grand // candidate is valid and smaller, use it 122ce37d08fSArmin Le Grand aFound = a; 123ce37d08fSArmin Le Grand } 124ce37d08fSArmin Le Grand } 125ce37d08fSArmin Le Grand else 126ce37d08fSArmin Le Grand { 127ce37d08fSArmin Le Grand // found is valid, candidate is not. Keep found 128ce37d08fSArmin Le Grand } 129ce37d08fSArmin Le Grand } 130ce37d08fSArmin Le Grand else 131ce37d08fSArmin Le Grand { 132ce37d08fSArmin Le Grand // found is invalid, use candidate 133ce37d08fSArmin Le Grand aFound = a; 134ce37d08fSArmin Le Grand bOkay = (*aFound)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*aFound)->GetOutputHeightPixel() >= rSizePixel.getHeight(); 135ce37d08fSArmin Le Grand } 136ce37d08fSArmin Le Grand } 137ce37d08fSArmin Le Grand else 138ce37d08fSArmin Le Grand { 139ce37d08fSArmin Le Grand // none yet, use candidate 140ce37d08fSArmin Le Grand aFound = a; 141ce37d08fSArmin Le Grand bOkay = (*aFound)->GetOutputWidthPixel() >= rSizePixel.getWidth() && (*aFound)->GetOutputHeightPixel() >= rSizePixel.getHeight(); 142ce37d08fSArmin Le Grand } 143ce37d08fSArmin Le Grand } 144ce37d08fSArmin Le Grand } 145ce37d08fSArmin Le Grand 14656a68a31SArmin Le Grand if(aFound != maFreeBuffers.end()) 147ce37d08fSArmin Le Grand { 148ce37d08fSArmin Le Grand pRetval = *aFound; 14956a68a31SArmin Le Grand maFreeBuffers.erase(aFound); 150ce37d08fSArmin Le Grand 151ce37d08fSArmin Le Grand if(bOkay) 152ce37d08fSArmin Le Grand { 153ce37d08fSArmin Le Grand if(bClear) 154ce37d08fSArmin Le Grand { 155ce37d08fSArmin Le Grand pRetval->Erase(Rectangle(0, 0, rSizePixel.getWidth(), rSizePixel.getHeight())); 156ce37d08fSArmin Le Grand } 157ce37d08fSArmin Le Grand } 158ce37d08fSArmin Le Grand else 159ce37d08fSArmin Le Grand { 160ce37d08fSArmin Le Grand pRetval->SetOutputSizePixel(rSizePixel, bClear); 161ce37d08fSArmin Le Grand } 162ce37d08fSArmin Le Grand } 163ce37d08fSArmin Le Grand } 164ce37d08fSArmin Le Grand 165ce37d08fSArmin Le Grand // no success yet, create new buffer 166ce37d08fSArmin Le Grand if(!pRetval) 167ce37d08fSArmin Le Grand { 168ce37d08fSArmin Le Grand pRetval = (bMono) ? new VirtualDevice(rOutDev, 1) : new VirtualDevice(rOutDev); 169ce37d08fSArmin Le Grand pRetval->SetOutputSizePixel(rSizePixel, bClear); 170ce37d08fSArmin Le Grand } 171ce37d08fSArmin Le Grand else 172ce37d08fSArmin Le Grand { 173ce37d08fSArmin Le Grand // reused, reset some values 174ce37d08fSArmin Le Grand pRetval->SetMapMode(); 175ce37d08fSArmin Le Grand } 176ce37d08fSArmin Le Grand 17756a68a31SArmin Le Grand // remember allocated buffer 17856a68a31SArmin Le Grand maUsedBuffers.push_back(pRetval); 17956a68a31SArmin Le Grand 180ce37d08fSArmin Le Grand return pRetval; 181ce37d08fSArmin Le Grand } 182ce37d08fSArmin Le Grand free(VirtualDevice & rDevice)183ce37d08fSArmin Le Grand void VDevBuffer::free(VirtualDevice& rDevice) 184ce37d08fSArmin Le Grand { 185ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 18656a68a31SArmin Le Grand const aBuffers::iterator aUsedFound(::std::find(maUsedBuffers.begin(), maUsedBuffers.end(), &rDevice)); 18756a68a31SArmin Le Grand OSL_ENSURE(aUsedFound != maUsedBuffers.end(), "OOps, non-registered buffer freed (!)"); 18856a68a31SArmin Le Grand 18956a68a31SArmin Le Grand maUsedBuffers.erase(aUsedFound); 19056a68a31SArmin Le Grand maFreeBuffers.push_back(&rDevice); 191ce37d08fSArmin Le Grand Start(); 192ce37d08fSArmin Le Grand } 193ce37d08fSArmin Le Grand Timeout()194ce37d08fSArmin Le Grand void VDevBuffer::Timeout() 195ce37d08fSArmin Le Grand { 196ce37d08fSArmin Le Grand ::osl::MutexGuard aGuard(m_aMutex); 197ce37d08fSArmin Le Grand 19856a68a31SArmin Le Grand while(!maFreeBuffers.empty()) 199ce37d08fSArmin Le Grand { 20056a68a31SArmin Le Grand delete *(maFreeBuffers.end() - 1); 20156a68a31SArmin Le Grand maFreeBuffers.pop_back(); 202ce37d08fSArmin Le Grand } 203ce37d08fSArmin Le Grand } 204ce37d08fSArmin Le Grand } 205cdf0e10cSrcweir 206cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 207cdf0e10cSrcweir // support for rendering Bitmap and BitmapEx contents 208cdf0e10cSrcweir 209cdf0e10cSrcweir namespace drawinglayer 210cdf0e10cSrcweir { 211ce37d08fSArmin Le Grand // static global VDev buffer for the VclProcessor2D's (VclMetafileProcessor2D and VclPixelProcessor2D) getVDevBuffer()21233a1c393SArmin Le Grand VDevBuffer& getVDevBuffer() 21333a1c393SArmin Le Grand { 21433a1c393SArmin Le Grand // secure global instance with Vcl's safe desroyer of external (seen by 21533a1c393SArmin Le Grand // library base) stuff, the remembered VDevs need to be deleted before 21633a1c393SArmin Le Grand // Vcl's deinit 21733a1c393SArmin Le Grand static vcl::DeleteOnDeinit< VDevBuffer > aVDevBuffer(new VDevBuffer()); 21833a1c393SArmin Le Grand return *aVDevBuffer.get(); 21933a1c393SArmin Le Grand } 220ce37d08fSArmin Le Grand impBufferDevice(OutputDevice & rOutDev,const basegfx::B2DRange & rRange,bool bAddOffsetToMapping)221ce37d08fSArmin Le Grand impBufferDevice::impBufferDevice( 222ce37d08fSArmin Le Grand OutputDevice& rOutDev, 223ce37d08fSArmin Le Grand const basegfx::B2DRange& rRange, 224ce37d08fSArmin Le Grand bool bAddOffsetToMapping) 225ce37d08fSArmin Le Grand : mrOutDev(rOutDev), 226ce37d08fSArmin Le Grand mpContent(0), 227ce37d08fSArmin Le Grand mpMask(0), 228ce37d08fSArmin Le Grand mpAlpha(0) 229ce37d08fSArmin Le Grand { 230cdf0e10cSrcweir basegfx::B2DRange aRangePixel(rRange); 231ce37d08fSArmin Le Grand aRangePixel.transform(mrOutDev.GetViewTransformation()); 232cdf0e10cSrcweir const Rectangle aRectPixel( 233ce37d08fSArmin Le Grand (sal_Int32)floor(aRangePixel.getMinX()), (sal_Int32)floor(aRangePixel.getMinY()), 234ce37d08fSArmin Le Grand (sal_Int32)ceil(aRangePixel.getMaxX()), (sal_Int32)ceil(aRangePixel.getMaxY())); 235ce37d08fSArmin Le Grand const Point aEmptyPoint; 236ce37d08fSArmin Le Grand maDestPixel = Rectangle(aEmptyPoint, mrOutDev.GetOutputSizePixel()); 237ce37d08fSArmin Le Grand maDestPixel.Intersection(aRectPixel); 238cdf0e10cSrcweir 239ce37d08fSArmin Le Grand if(isVisible()) 240ce37d08fSArmin Le Grand { 24133a1c393SArmin Le Grand mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), false, false); 242cdf0e10cSrcweir 243cdf0e10cSrcweir // #i93485# assert when copying from window to VDev is used 244ce37d08fSArmin Le Grand OSL_ENSURE(mrOutDev.GetOutDevType() != OUTDEV_WINDOW, 245cdf0e10cSrcweir "impBufferDevice render helper: Copying from Window to VDev, this should be avoided (!)"); 246cdf0e10cSrcweir 247ce37d08fSArmin Le Grand const bool bWasEnabledSrc(mrOutDev.IsMapModeEnabled()); 248ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(false); 249ce37d08fSArmin Le Grand mpContent->DrawOutDev(aEmptyPoint, maDestPixel.GetSize(), maDestPixel.TopLeft(), maDestPixel.GetSize(), mrOutDev); 250ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(bWasEnabledSrc); 251cdf0e10cSrcweir 252ce37d08fSArmin Le Grand MapMode aNewMapMode(mrOutDev.GetMapMode()); 253cdf0e10cSrcweir 254ce37d08fSArmin Le Grand if(bAddOffsetToMapping) 255ce37d08fSArmin Le Grand { 256ce37d08fSArmin Le Grand const Point aLogicTopLeft(mrOutDev.PixelToLogic(maDestPixel.TopLeft())); 257ce37d08fSArmin Le Grand aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y())); 258ce37d08fSArmin Le Grand } 259cdf0e10cSrcweir 260ce37d08fSArmin Le Grand mpContent->SetMapMode(aNewMapMode); 261cdf0e10cSrcweir 262cdf0e10cSrcweir // copy AA flag for new target 263ce37d08fSArmin Le Grand mpContent->SetAntialiasing(mrOutDev.GetAntialiasing()); 264ce37d08fSArmin Le Grand } 265ce37d08fSArmin Le Grand } 266ce37d08fSArmin Le Grand ~impBufferDevice()267ce37d08fSArmin Le Grand impBufferDevice::~impBufferDevice() 268ce37d08fSArmin Le Grand { 269ce37d08fSArmin Le Grand if(mpContent) 270ce37d08fSArmin Le Grand { 27133a1c393SArmin Le Grand getVDevBuffer().free(*mpContent); 272ce37d08fSArmin Le Grand } 273ce37d08fSArmin Le Grand 274ce37d08fSArmin Le Grand if(mpMask) 275ce37d08fSArmin Le Grand { 27633a1c393SArmin Le Grand getVDevBuffer().free(*mpMask); 277ce37d08fSArmin Le Grand } 278cdf0e10cSrcweir 279cdf0e10cSrcweir if(mpAlpha) 280ce37d08fSArmin Le Grand { 28133a1c393SArmin Le Grand getVDevBuffer().free(*mpAlpha); 282ce37d08fSArmin Le Grand } 283ce37d08fSArmin Le Grand } 284cdf0e10cSrcweir paint(double fTrans)285ce37d08fSArmin Le Grand void impBufferDevice::paint(double fTrans) 286ce37d08fSArmin Le Grand { 287ce37d08fSArmin Le Grand if(isVisible()) 288ce37d08fSArmin Le Grand { 289ce37d08fSArmin Le Grand const Point aEmptyPoint; 290ce37d08fSArmin Le Grand const Size aSizePixel(maDestPixel.GetSize()); 291ce37d08fSArmin Le Grand const bool bWasEnabledDst(mrOutDev.IsMapModeEnabled()); 292ce37d08fSArmin Le Grand static bool bDoSaveForVisualControl(false); 293ce37d08fSArmin Le Grand 294ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(false); 295ce37d08fSArmin Le Grand mpContent->EnableMapMode(false); 296ce37d08fSArmin Le Grand Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel)); 297ce37d08fSArmin Le Grand 298cdf0e10cSrcweir if(bDoSaveForVisualControl) 299ce37d08fSArmin Le Grand { 300ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\content.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 301*45fd3b9aSArmin Le Grand WriteDIB(aContent, aNew, false, true); 302ce37d08fSArmin Le Grand } 303ce37d08fSArmin Le Grand 304ce37d08fSArmin Le Grand if(mpAlpha) 305ce37d08fSArmin Le Grand { 306ce37d08fSArmin Le Grand mpAlpha->EnableMapMode(false); 307ce37d08fSArmin Le Grand const AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel)); 308cdf0e10cSrcweir 309ce37d08fSArmin Le Grand if(bDoSaveForVisualControl) 310ce37d08fSArmin Le Grand { 311ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\transparence.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 312*45fd3b9aSArmin Le Grand WriteDIB(aAlphaMask.GetBitmap(), aNew, false, true); 313ce37d08fSArmin Le Grand } 314cdf0e10cSrcweir 315ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); 316ce37d08fSArmin Le Grand } 317ce37d08fSArmin Le Grand else if(mpMask) 318ce37d08fSArmin Le Grand { 319ce37d08fSArmin Le Grand mpMask->EnableMapMode(false); 320ce37d08fSArmin Le Grand const Bitmap aMask(mpMask->GetBitmap(aEmptyPoint, aSizePixel)); 321cdf0e10cSrcweir 322ce37d08fSArmin Le Grand if(bDoSaveForVisualControl) 323ce37d08fSArmin Le Grand { 324ce37d08fSArmin Le Grand SvFileStream aNew((const String&)String(ByteString( "c:\\mask.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); 325*45fd3b9aSArmin Le Grand WriteDIB(aMask, aNew, false, true); 326ce37d08fSArmin Le Grand } 327cdf0e10cSrcweir 328ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aMask)); 329ce37d08fSArmin Le Grand } 330ce37d08fSArmin Le Grand else if(0.0 != fTrans) 331ce37d08fSArmin Le Grand { 332ce37d08fSArmin Le Grand sal_uInt8 nMaskValue((sal_uInt8)basegfx::fround(fTrans * 255.0)); 333ce37d08fSArmin Le Grand const AlphaMask aAlphaMask(aSizePixel, &nMaskValue); 334ce37d08fSArmin Le Grand mrOutDev.DrawBitmapEx(maDestPixel.TopLeft(), BitmapEx(aContent, aAlphaMask)); 335ce37d08fSArmin Le Grand } 336ce37d08fSArmin Le Grand else 337ce37d08fSArmin Le Grand { 338ce37d08fSArmin Le Grand mrOutDev.DrawBitmap(maDestPixel.TopLeft(), aContent); 339ce37d08fSArmin Le Grand } 340ce37d08fSArmin Le Grand 341ce37d08fSArmin Le Grand mrOutDev.EnableMapMode(bWasEnabledDst); 342ce37d08fSArmin Le Grand } 343ce37d08fSArmin Le Grand } 344ce37d08fSArmin Le Grand getContent()345ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getContent() 346ce37d08fSArmin Le Grand { 347ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 348ce37d08fSArmin Le Grand return *mpContent; 349ce37d08fSArmin Le Grand } 350cdf0e10cSrcweir getMask()351ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getMask() 352ce37d08fSArmin Le Grand { 353ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 354ce37d08fSArmin Le Grand if(!mpMask) 355ce37d08fSArmin Le Grand { 35633a1c393SArmin Le Grand mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, true); 357ce37d08fSArmin Le Grand mpMask->SetMapMode(mpContent->GetMapMode()); 358ce37d08fSArmin Le Grand 359ce37d08fSArmin Le Grand // do NOT copy AA flag for mask! 360ce37d08fSArmin Le Grand } 361ce37d08fSArmin Le Grand 362ce37d08fSArmin Le Grand return *mpMask; 363ce37d08fSArmin Le Grand } 364ce37d08fSArmin Le Grand getTransparence()365ce37d08fSArmin Le Grand VirtualDevice& impBufferDevice::getTransparence() 366ce37d08fSArmin Le Grand { 367ce37d08fSArmin Le Grand OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() before accessing (!)"); 368ce37d08fSArmin Le Grand if(!mpAlpha) 369ce37d08fSArmin Le Grand { 37033a1c393SArmin Le Grand mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), true, false); 371ce37d08fSArmin Le Grand mpAlpha->SetMapMode(mpContent->GetMapMode()); 372ce37d08fSArmin Le Grand 373ce37d08fSArmin Le Grand // copy AA flag for new target; masking needs to be smooth 374ce37d08fSArmin Le Grand mpAlpha->SetAntialiasing(mpContent->GetAntialiasing()); 375ce37d08fSArmin Le Grand } 376ce37d08fSArmin Le Grand 377ce37d08fSArmin Le Grand return *mpAlpha; 378ce37d08fSArmin Le Grand } 379cdf0e10cSrcweir } // end of namespace drawinglayer 380cdf0e10cSrcweir 381cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 382cdf0e10cSrcweir // eof 383