LCOV - code coverage report
Current view: top level - vcl/source/gdi - virdev.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 209 272 76.8 %
Date: 2014-04-11 Functions: 17 24 70.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/debug.hxx>
      21             : 
      22             : #include <vcl/settings.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <vcl/wrkwin.hxx>
      25             : #include <vcl/virdev.hxx>
      26             : 
      27             : #include <salinst.hxx>
      28             : #include <salgdi.hxx>
      29             : #include <salframe.hxx>
      30             : #include <salvd.hxx>
      31             : #include <outdev.h>
      32             : #include "PhysicalFontCollection.hxx"
      33             : #include <svdata.hxx>
      34             : 
      35             : using namespace ::com::sun::star::uno;
      36             : 
      37      112272 : bool VirtualDevice::ImplInitGraphics() const
      38             : {
      39             :     DBG_TESTSOLARMUTEX();
      40             : 
      41      112272 :     if ( mpGraphics )
      42           0 :         return true;
      43             : 
      44      112272 :     mbInitLineColor     = true;
      45      112272 :     mbInitFillColor     = true;
      46      112272 :     mbInitFont          = true;
      47      112272 :     mbInitTextColor     = true;
      48      112272 :     mbInitClipRegion    = true;
      49             : 
      50      112272 :     ImplSVData* pSVData = ImplGetSVData();
      51             : 
      52      112272 :     if ( mpVirDev )
      53             :     {
      54      112272 :         mpGraphics = mpVirDev->AcquireGraphics();
      55             :         // if needed retry after releasing least recently used virtual device graphics
      56      224544 :         while ( !mpGraphics )
      57             :         {
      58           0 :             if ( !pSVData->maGDIData.mpLastVirGraphics )
      59           0 :                 break;
      60           0 :             pSVData->maGDIData.mpLastVirGraphics->ImplReleaseGraphics();
      61           0 :             mpGraphics = mpVirDev->AcquireGraphics();
      62             :         }
      63             :         // update global LRU list of virtual device graphics
      64      112272 :         if ( mpGraphics )
      65             :         {
      66      112272 :             mpNextGraphics = pSVData->maGDIData.mpFirstVirGraphics;
      67      112272 :             pSVData->maGDIData.mpFirstVirGraphics = const_cast<VirtualDevice*>(this);
      68      112272 :             if ( mpNextGraphics )
      69      111520 :                 mpNextGraphics->mpPrevGraphics = const_cast<VirtualDevice*>(this);
      70      112272 :             if ( !pSVData->maGDIData.mpLastVirGraphics )
      71         752 :                 pSVData->maGDIData.mpLastVirGraphics = const_cast<VirtualDevice*>(this);
      72             :         }
      73             :     }
      74             : 
      75      112272 :     if ( mpGraphics )
      76             :     {
      77      112272 :         mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp );
      78      112272 :         mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
      79             :     }
      80             : 
      81      112272 :     return mpGraphics ? true : false;
      82             : }
      83             : 
      84      110700 : void VirtualDevice::ImplReleaseGraphics( bool bRelease )
      85             : {
      86             :     DBG_TESTSOLARMUTEX();
      87             : 
      88      110700 :     if ( !mpGraphics )
      89      110700 :         return;
      90             : 
      91             :     // release the fonts of the physically released graphics device
      92      110700 :     if ( bRelease )
      93      110700 :         ImplReleaseFonts();
      94             : 
      95      110700 :     ImplSVData* pSVData = ImplGetSVData();
      96             : 
      97      110700 :     VirtualDevice* pVirDev = (VirtualDevice*)this;
      98             : 
      99      110700 :     if ( bRelease )
     100      110700 :         pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
     101             :     // remove from global LRU list of virtual device graphics
     102      110700 :     if ( mpPrevGraphics )
     103       39875 :         mpPrevGraphics->mpNextGraphics = mpNextGraphics;
     104             :     else
     105       70825 :         pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics;
     106      110700 :     if ( mpNextGraphics )
     107      109527 :         mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
     108             :     else
     109        1173 :         pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics;
     110             : 
     111      110700 :     mpGraphics      = NULL;
     112      110700 :     mpPrevGraphics  = NULL;
     113      110700 :     mpNextGraphics  = NULL;
     114             : }
     115             : 
     116      105591 : void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
     117             :                                     long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
     118             : {
     119             :     SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << nBitCount << ")" );
     120             : 
     121      105591 :     if ( nDX < 1 )
     122           0 :         nDX = 1;
     123             : 
     124      105591 :     if ( nDY < 1 )
     125           0 :         nDY = 1;
     126             : 
     127      105591 :     ImplSVData* pSVData = ImplGetSVData();
     128             : 
     129      105591 :     if ( !pOutDev )
     130           0 :         pOutDev = ImplGetDefaultWindow();
     131      105591 :     if( !pOutDev )
     132      105591 :         return;
     133             : 
     134             :     SalGraphics* pGraphics;
     135      105591 :     if ( !pOutDev->mpGraphics )
     136        7773 :         ((OutputDevice*)pOutDev)->ImplGetGraphics();
     137      105591 :     pGraphics = pOutDev->mpGraphics;
     138      105591 :     if ( pGraphics )
     139      105591 :         mpVirDev = pSVData->mpDefInst->CreateVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData );
     140             :     else
     141           0 :         mpVirDev = NULL;
     142      105591 :     if ( !mpVirDev )
     143             :     {
     144             :         // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
     145             :         throw ::com::sun::star::uno::RuntimeException(
     146             :             OUString( "Could not create system bitmap!" ),
     147           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
     148             :     }
     149             : 
     150      105591 :     mnBitCount      = ( nBitCount ? nBitCount : pOutDev->GetBitCount() );
     151      105591 :     mnOutWidth      = nDX;
     152      105591 :     mnOutHeight     = nDY;
     153      105591 :     mbScreenComp    = true;
     154      105591 :     mnAlphaDepth    = -1;
     155             : 
     156             :     // #i59315# init vdev size from system object, when passed a
     157             :     // SystemGraphicsData. Otherwise, output size will always
     158             :     // incorrectly stay at (1,1)
     159      105591 :     if( pData && mpVirDev )
     160           0 :         mpVirDev->GetSize(mnOutWidth,mnOutHeight);
     161             : 
     162      105591 :     if( mnBitCount < 8 )
     163        6767 :         SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
     164             : 
     165      105591 :     if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
     166           0 :         mbScreenComp = false;
     167      105591 :     else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
     168       21835 :         mbScreenComp = ((VirtualDevice*)pOutDev)->mbScreenComp;
     169             : 
     170      105591 :     meOutDevType    = OUTDEV_VIRDEV;
     171      105591 :     mbDevOutput     = true;
     172      105591 :     mpFontCollection      = pSVData->maGDIData.mpScreenFontList;
     173      105591 :     mpFontCache     = pSVData->maGDIData.mpScreenFontCache;
     174      105591 :     mnDPIX          = pOutDev->mnDPIX;
     175      105591 :     mnDPIY          = pOutDev->mnDPIY;
     176      105591 :     mnDPIScaleFactor = pOutDev->mnDPIScaleFactor;
     177      105591 :     maFont          = pOutDev->maFont;
     178             : 
     179      105591 :     if( maTextColor != pOutDev->maTextColor )
     180             :     {
     181         118 :         maTextColor = pOutDev->maTextColor;
     182         118 :         mbInitTextColor = true;
     183             :     }
     184             : 
     185             :     // virtual devices have white background by default
     186      105591 :     SetBackground( Wallpaper( Color( COL_WHITE ) ) );
     187             : 
     188             :     // #i59283# don't erase user-provided surface
     189      105591 :     if( !pData )
     190      105591 :         Erase();
     191             : 
     192             :     // register VirDev in the list
     193      105591 :     mpNext = pSVData->maGDIData.mpFirstVirDev;
     194      105591 :     mpPrev = NULL;
     195      105591 :     if ( mpNext )
     196      104847 :         mpNext->mpPrev = this;
     197             :     else
     198         744 :         pSVData->maGDIData.mpLastVirDev = this;
     199      105591 :     pSVData->maGDIData.mpFirstVirDev = this;
     200             : }
     201             : 
     202       69686 : VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
     203             : :   mpVirDev( NULL ),
     204       69686 :     meRefDevMode( REFDEV_NONE )
     205             : {
     206             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
     207             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     208             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     209             : 
     210       69686 :     ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
     211       69686 : }
     212             : 
     213       28270 : VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount )
     214             :     : mpVirDev( NULL ),
     215       28270 :     meRefDevMode( REFDEV_NONE )
     216             : {
     217             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
     218             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     219             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     220             : 
     221       28270 :     ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
     222       28270 : }
     223             : 
     224        7635 : VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount )
     225             :     : mpVirDev( NULL ),
     226        7635 :     meRefDevMode( REFDEV_NONE )
     227             : {
     228             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
     229             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     230             :     SAL_INFO( "vcl.gdi",
     231             :             "VirtualDevice::VirtualDevice( " << nBitCount << ", " << nAlphaBitCount << " )" );
     232             : 
     233        7635 :     ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
     234             : 
     235             :     // Enable alpha channel
     236        7635 :     mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);
     237        7635 : }
     238             : 
     239           0 : VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount )
     240             : :   mpVirDev( NULL ),
     241           0 :     meRefDevMode( REFDEV_NONE )
     242             : {
     243             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     244             : 
     245           0 :     ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData );
     246           0 : }
     247             : 
     248      277884 : VirtualDevice::~VirtualDevice()
     249             : {
     250             :     SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" );
     251             : 
     252      104019 :     ImplSVData* pSVData = ImplGetSVData();
     253             : 
     254      104019 :     ImplReleaseGraphics();
     255             : 
     256      104019 :     delete mpVirDev;
     257             : 
     258             :     // remove this VirtualDevice from the double-linked global list
     259      104019 :     if( mpPrev )
     260       38606 :         mpPrev->mpNext = mpNext;
     261             :     else
     262       65413 :         pSVData->maGDIData.mpFirstVirDev = mpNext;
     263             : 
     264      104019 :     if( mpNext )
     265      102854 :         mpNext->mpPrev = mpPrev;
     266             :     else
     267        1165 :         pSVData->maGDIData.mpLastVirDev = mpPrev;
     268      173865 : }
     269             : 
     270       37559 : bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
     271             : {
     272             :     SAL_INFO( "vcl.gdi",
     273             :               "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
     274             :               << rNewSize.Height() << ", " << int(bErase) << " )" );
     275             : 
     276       37559 :     if ( !mpVirDev )
     277           0 :         return false;
     278       37559 :     else if ( rNewSize == GetOutputSizePixel() )
     279             :     {
     280        1185 :         if ( bErase )
     281        1185 :             Erase();
     282             :         // Yeah, so trying to re-use a VirtualDevice but this time using a
     283             :         // pre-allocated buffer won't work. Big deal.
     284        1185 :         return true;
     285             :     }
     286             : 
     287             :     bool bRet;
     288       36374 :     long nNewWidth = rNewSize.Width(), nNewHeight = rNewSize.Height();
     289             : 
     290       36374 :     if ( nNewWidth < 1 )
     291          89 :         nNewWidth = 1;
     292             : 
     293       36374 :     if ( nNewHeight < 1 )
     294         285 :         nNewHeight = 1;
     295             : 
     296       36374 :     if ( bErase )
     297             :     {
     298       29693 :         if ( pBuffer )
     299           0 :             bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer );
     300             :         else
     301       29693 :             bRet = mpVirDev->SetSize( nNewWidth, nNewHeight );
     302             : 
     303       29693 :         if ( bRet )
     304             :         {
     305       29693 :             mnOutWidth  = rNewSize.Width();
     306       29693 :             mnOutHeight = rNewSize.Height();
     307       29693 :             Erase();
     308             :         }
     309             :     }
     310             :     else
     311             :     {
     312             :         SalVirtualDevice*   pNewVirDev;
     313        6681 :         ImplSVData*         pSVData = ImplGetSVData();
     314             : 
     315             :         // we need a graphics
     316        6681 :         if ( !mpGraphics )
     317             :         {
     318           0 :             if ( !ImplGetGraphics() )
     319           0 :                 return false;
     320             :         }
     321             : 
     322        6681 :         pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, nNewWidth, nNewHeight, mnBitCount );
     323        6681 :         if ( pNewVirDev )
     324             :         {
     325        6681 :             SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
     326        6681 :             if ( pGraphics )
     327             :             {
     328             :                 SalTwoRect aPosAry;
     329             :                 long nWidth;
     330             :                 long nHeight;
     331        6681 :                 if ( mnOutWidth < nNewWidth )
     332        6607 :                     nWidth = mnOutWidth;
     333             :                 else
     334          74 :                     nWidth = nNewWidth;
     335        6681 :                 if ( mnOutHeight < nNewHeight )
     336        6604 :                     nHeight = mnOutHeight;
     337             :                 else
     338          77 :                     nHeight = nNewHeight;
     339        6681 :                 aPosAry.mnSrcX       = 0;
     340        6681 :                 aPosAry.mnSrcY       = 0;
     341        6681 :                 aPosAry.mnSrcWidth   = nWidth;
     342        6681 :                 aPosAry.mnSrcHeight  = nHeight;
     343        6681 :                 aPosAry.mnDestX      = 0;
     344        6681 :                 aPosAry.mnDestY      = 0;
     345        6681 :                 aPosAry.mnDestWidth  = nWidth;
     346        6681 :                 aPosAry.mnDestHeight = nHeight;
     347             : 
     348        6681 :                 pGraphics->CopyBits( aPosAry, mpGraphics, this, this );
     349        6681 :                 pNewVirDev->ReleaseGraphics( pGraphics );
     350        6681 :                 ImplReleaseGraphics();
     351        6681 :                 delete mpVirDev;
     352        6681 :                 mpVirDev = pNewVirDev;
     353        6681 :                 mnOutWidth  = rNewSize.Width();
     354        6681 :                 mnOutHeight = rNewSize.Height();
     355        6681 :                 bRet = true;
     356             :             }
     357             :             else
     358             :             {
     359           0 :                 bRet = false;
     360           0 :                 delete pNewVirDev;
     361             :             }
     362             :         }
     363             :         else
     364           0 :             bRet = false;
     365             :     }
     366             : 
     367       36374 :     return bRet;
     368             : }
     369             : 
     370             : // #i32109#: Fill opaque areas correctly (without relying on
     371             : // fill/linecolor state)
     372           0 : void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
     373             : {
     374             :     // Set line and fill color to black (->opaque),
     375             :     // fill rect with that (linecolor, too, because of
     376             :     // those pesky missing pixel problems)
     377           0 :     Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
     378           0 :     SetLineColor( COL_BLACK );
     379           0 :     SetFillColor( COL_BLACK );
     380           0 :     DrawRect( rRect );
     381           0 :     Pop();
     382           0 : }
     383             : 
     384       29924 : bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
     385             : {
     386       29924 :     if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
     387             :     {
     388       29924 :         if( mnAlphaDepth != -1 )
     389             :         {
     390             :             // #110958# Setup alpha bitmap
     391        7635 :             if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
     392             :             {
     393           0 :                 delete mpAlphaVDev;
     394           0 :                 mpAlphaVDev = 0L;
     395             :             }
     396             : 
     397        7635 :             if( !mpAlphaVDev )
     398             :             {
     399        7635 :                 mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth );
     400        7635 :                 mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, basebmp::RawMemorySharedArray() );
     401             :             }
     402             : 
     403             :             // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev
     404        7635 :             if( GetLineColor() != Color( COL_TRANSPARENT ) )
     405        7635 :                 mpAlphaVDev->SetLineColor( COL_BLACK );
     406             : 
     407        7635 :             if( GetFillColor() != Color( COL_TRANSPARENT ) )
     408        7635 :                 mpAlphaVDev->SetFillColor( COL_BLACK );
     409             : 
     410        7635 :             mpAlphaVDev->SetMapMode( GetMapMode() );
     411             :         }
     412             : 
     413       29924 :         return true;
     414             :     }
     415             : 
     416           0 :     return false;
     417             : }
     418             : 
     419       20026 : void VirtualDevice::EnableRTL( bool bEnable )
     420             : {
     421             :     // virdevs default to not mirroring, they will only be set to mirroring
     422             :     // under rare circumstances in the UI, eg the valueset control
     423             :     // because each virdev has its own SalGraphics we can safely switch the SalGraphics here
     424             :     // ...hopefully
     425       20026 :     if( ImplGetGraphics() )
     426       20026 :         mpGraphics->SetLayout( bEnable ? SAL_LAYOUT_BIDI_RTL : 0 );
     427             : 
     428       20026 :     OutputDevice::EnableRTL(bEnable);
     429       20026 : }
     430             : 
     431       29924 : bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase )
     432             : {
     433       29924 :     return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray() );
     434             : }
     435             : 
     436           0 : bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer )
     437             : {
     438           0 :     if (pBuffer) {
     439           0 :         MapMode mm = GetMapMode();
     440           0 :         mm.SetOrigin( rNewOffset );
     441           0 :         mm.SetScaleX( rScale );
     442           0 :         mm.SetScaleY( rScale );
     443           0 :         SetMapMode( mm );
     444             :     }
     445           0 :     return ImplSetOutputSizePixel( rNewSize, true, pBuffer);
     446             : }
     447             : 
     448        2273 : void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )
     449             : {
     450        2273 :     sal_Int32 nDPIX = 600, nDPIY = 600;
     451        2273 :     switch( i_eRefDevMode )
     452             :     {
     453             :     case REFDEV_NONE:
     454             :     default:
     455             :         DBG_ASSERT( false, "VDev::SetRefDev illegal argument!" );
     456           0 :         break;
     457             :     case REFDEV_MODE06:
     458          16 :         nDPIX = nDPIY = 600;
     459          16 :         break;
     460             :     case REFDEV_MODE_MSO1:
     461        2257 :         nDPIX = nDPIY = 6*1440;
     462        2257 :         break;
     463             :     case REFDEV_MODE_PDF1:
     464           0 :         nDPIX = nDPIY = 720;
     465           0 :         break;
     466             :     }
     467        2273 :     ImplSetReferenceDevice( i_eRefDevMode, nDPIX, nDPIY );
     468        2273 : }
     469             : 
     470           0 : void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
     471             : {
     472           0 :     ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY );
     473           0 : }
     474             : 
     475        2273 : void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
     476             : {
     477        2273 :     mnDPIX = i_nDPIX;
     478        2273 :     mnDPIY = i_nDPIY;
     479        2273 :     mnDPIScaleFactor = 1;
     480             : 
     481        2273 :     EnableOutput( false );  // prevent output on reference device
     482        2273 :     mbScreenComp = false;
     483             : 
     484             :     // invalidate currently selected fonts
     485        2273 :     mbInitFont = true;
     486        2273 :     mbNewFont = true;
     487             : 
     488             :     // avoid adjusting font lists when already in refdev mode
     489        2273 :     sal_uInt8 nOldRefDevMode = meRefDevMode;
     490        2273 :     sal_uInt8 nOldCompatFlag = (sal_uInt8)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD;
     491        2273 :     meRefDevMode = (sal_uInt8)(i_eRefDevMode | nOldCompatFlag);
     492        2273 :     if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE )
     493        2273 :         return;
     494             : 
     495             :     // the reference device should have only scalable fonts
     496             :     // => clean up the original font lists before getting new ones
     497        2273 :     if ( mpFontEntry )
     498             :     {
     499           0 :         mpFontCache->Release( mpFontEntry );
     500           0 :         mpFontEntry = NULL;
     501             :     }
     502        2273 :     if ( mpGetDevFontList )
     503             :     {
     504           0 :         delete mpGetDevFontList;
     505           0 :         mpGetDevFontList = NULL;
     506             :     }
     507        2273 :     if ( mpGetDevSizeList )
     508             :     {
     509           0 :         delete mpGetDevSizeList;
     510           0 :         mpGetDevSizeList = NULL;
     511             :     }
     512             : 
     513             :     // preserve global font lists
     514        2273 :     ImplSVData* pSVData = ImplGetSVData();
     515        2273 :     if( mpFontCollection && (mpFontCollection != pSVData->maGDIData.mpScreenFontList) )
     516           0 :         delete mpFontCollection;
     517        2273 :     if( mpFontCache && (mpFontCache != pSVData->maGDIData.mpScreenFontCache) )
     518           0 :         delete mpFontCache;
     519             : 
     520             :     // get font list with scalable fonts only
     521        2273 :     ImplGetGraphics();
     522        2273 :     mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone( true, false );
     523             : 
     524             :     // prepare to use new font lists
     525        2273 :     mpFontCache = new ImplFontCache();
     526             : }
     527             : 
     528     7468930 : sal_uInt16 VirtualDevice::GetBitCount() const
     529             : {
     530     7468930 :     return mnBitCount;
     531             : }
     532             : 
     533           0 : sal_uInt16 VirtualDevice::GetAlphaBitCount() const
     534             : {
     535           0 :     if (mpAlphaVDev)
     536           0 :         return mpAlphaVDev->GetBitCount();
     537             : 
     538           0 :     return 0;
     539             : }
     540             : 
     541           0 : bool VirtualDevice::UsePolyPolygonForComplexGradient()
     542             : {
     543           0 :     return true;
     544             : }
     545             : 
     546           0 : void VirtualDevice::Compat_ZeroExtleadBug()
     547             : {
     548           0 :     meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD;
     549         516 : }
     550             : 
     551             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10