LCOV - code coverage report
Current view: top level - vcl/source/gdi - virdev.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 225 276 81.5 %
Date: 2015-06-13 12:38:46 Functions: 22 28 78.6 %
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             : #include <vcl/ITiledRenderable.hxx>
      36             : 
      37             : namespace vcl
      38             : {
      39             : 
      40        4133 : ITiledRenderable::~ITiledRenderable()
      41             : {
      42        4133 : }
      43             : 
      44             : }
      45             : 
      46             : using namespace ::com::sun::star::uno;
      47             : 
      48      463534 : bool VirtualDevice::AcquireGraphics() const
      49             : {
      50             :     DBG_TESTSOLARMUTEX();
      51             : 
      52      463534 :     if ( mpGraphics )
      53      306705 :         return true;
      54             : 
      55      156829 :     mbInitLineColor     = true;
      56      156829 :     mbInitFillColor     = true;
      57      156829 :     mbInitFont          = true;
      58      156829 :     mbInitTextColor     = true;
      59      156829 :     mbInitClipRegion    = true;
      60             : 
      61      156829 :     ImplSVData* pSVData = ImplGetSVData();
      62             : 
      63      156829 :     if ( mpVirDev )
      64             :     {
      65      156829 :         mpGraphics = mpVirDev->AcquireGraphics();
      66             :         // if needed retry after releasing least recently used virtual device graphics
      67      313658 :         while ( !mpGraphics )
      68             :         {
      69           0 :             if ( !pSVData->maGDIData.mpLastVirGraphics )
      70           0 :                 break;
      71           0 :             pSVData->maGDIData.mpLastVirGraphics->ReleaseGraphics();
      72           0 :             mpGraphics = mpVirDev->AcquireGraphics();
      73             :         }
      74             :         // update global LRU list of virtual device graphics
      75      156829 :         if ( mpGraphics )
      76             :         {
      77      156829 :             mpNextGraphics = pSVData->maGDIData.mpFirstVirGraphics;
      78      156829 :             pSVData->maGDIData.mpFirstVirGraphics = const_cast<VirtualDevice*>(this);
      79      156829 :             if ( mpNextGraphics )
      80      155868 :                 mpNextGraphics->mpPrevGraphics = const_cast<VirtualDevice*>(this);
      81      156829 :             if ( !pSVData->maGDIData.mpLastVirGraphics )
      82         961 :                 pSVData->maGDIData.mpLastVirGraphics = const_cast<VirtualDevice*>(this);
      83             :         }
      84             :     }
      85             : 
      86      156829 :     if ( mpGraphics )
      87             :     {
      88      156829 :         mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp );
      89      156829 :         mpGraphics->setAntiAliasB2DDraw(bool(mnAntialiasing & AntialiasingFlags::EnableB2dDraw));
      90             :     }
      91             : 
      92      156829 :     return mpGraphics != nullptr;
      93             : }
      94             : 
      95      154265 : void VirtualDevice::ReleaseGraphics( bool bRelease )
      96             : {
      97             :     DBG_TESTSOLARMUTEX();
      98             : 
      99      154265 :     if ( !mpGraphics )
     100      154265 :         return;
     101             : 
     102             :     // release the fonts of the physically released graphics device
     103      154265 :     if ( bRelease )
     104      154265 :         ImplReleaseFonts();
     105             : 
     106      154265 :     ImplSVData* pSVData = ImplGetSVData();
     107             : 
     108      154265 :     VirtualDevice* pVirDev = this;
     109             : 
     110      154265 :     if ( bRelease )
     111      154265 :         pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
     112             :     // remove from global LRU list of virtual device graphics
     113      154265 :     if ( mpPrevGraphics )
     114       65771 :         mpPrevGraphics->mpNextGraphics = mpNextGraphics;
     115             :     else
     116       88494 :         pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics;
     117      154265 :     if ( mpNextGraphics )
     118      152286 :         mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
     119             :     else
     120        1979 :         pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics;
     121             : 
     122      154265 :     mpGraphics      = NULL;
     123      154265 :     mpPrevGraphics  = NULL;
     124      154265 :     mpNextGraphics  = NULL;
     125             : }
     126             : 
     127      154080 : void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
     128             :                                     long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
     129             : {
     130             :     SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << nBitCount << ")" );
     131             : 
     132      154080 :     if ( nDX < 1 )
     133           0 :         nDX = 1;
     134             : 
     135      154080 :     if ( nDY < 1 )
     136           0 :         nDY = 1;
     137             : 
     138      154080 :     ImplSVData* pSVData = ImplGetSVData();
     139             : 
     140      154080 :     if ( !pOutDev )
     141           0 :         pOutDev = ImplGetDefaultWindow();
     142      154080 :     if( !pOutDev )
     143      154080 :         return;
     144             : 
     145             :     SalGraphics* pGraphics;
     146      154080 :     if ( !pOutDev->mpGraphics )
     147       12200 :         (void)pOutDev->AcquireGraphics();
     148      154080 :     pGraphics = pOutDev->mpGraphics;
     149      154080 :     if ( pGraphics )
     150      154080 :         mpVirDev = pSVData->mpDefInst->CreateVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData );
     151             :     else
     152           0 :         mpVirDev = NULL;
     153      154080 :     if ( !mpVirDev )
     154             :     {
     155             :         // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
     156             :         throw ::com::sun::star::uno::RuntimeException(
     157             :             OUString( "Could not create system bitmap!" ),
     158           0 :             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
     159             :     }
     160             : 
     161      154080 :     mnBitCount      = ( nBitCount ? nBitCount : pOutDev->GetBitCount() );
     162      154080 :     mnOutWidth      = nDX;
     163      154080 :     mnOutHeight     = nDY;
     164      154080 :     mbScreenComp    = true;
     165      154080 :     mnAlphaDepth    = -1;
     166             : 
     167      154080 :     if( mnBitCount < 8 )
     168        5531 :         SetAntialiasing( AntialiasingFlags::DisableText );
     169             : 
     170      154080 :     if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
     171           0 :         mbScreenComp = false;
     172      154080 :     else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
     173       26950 :         mbScreenComp = static_cast<const VirtualDevice*>(pOutDev)->mbScreenComp;
     174             : 
     175      154080 :     meOutDevType    = OUTDEV_VIRDEV;
     176      154080 :     mbDevOutput     = true;
     177      154080 :     mpFontCollection      = pSVData->maGDIData.mpScreenFontList;
     178      154080 :     mpFontCache     = pSVData->maGDIData.mpScreenFontCache;
     179      154080 :     mnDPIX          = pOutDev->mnDPIX;
     180      154080 :     mnDPIY          = pOutDev->mnDPIY;
     181      154080 :     mnDPIScaleFactor = pOutDev->mnDPIScaleFactor;
     182      154080 :     maFont          = pOutDev->maFont;
     183             : 
     184      154080 :     if( maTextColor != pOutDev->maTextColor )
     185             :     {
     186         203 :         maTextColor = pOutDev->maTextColor;
     187         203 :         mbInitTextColor = true;
     188             :     }
     189             : 
     190             :     // virtual devices have white background by default
     191      154080 :     SetBackground( Wallpaper( Color( COL_WHITE ) ) );
     192             : 
     193             :     // #i59283# don't erase user-provided surface
     194      154080 :     if( !pData )
     195      154080 :         Erase();
     196             : 
     197             :     // register VirDev in the list
     198      154080 :     mpNext = pSVData->maGDIData.mpFirstVirDev;
     199      154080 :     mpPrev = NULL;
     200      154080 :     if ( mpNext )
     201      153127 :         mpNext->mpPrev = this;
     202             :     else
     203         953 :         pSVData->maGDIData.mpLastVirDev = this;
     204      154080 :     pSVData->maGDIData.mpFirstVirDev = this;
     205             : }
     206             : 
     207      109492 : VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
     208             : :   mpVirDev( NULL ),
     209      109492 :     meRefDevMode( REFDEV_NONE )
     210             : {
     211             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
     212             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     213             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     214             : 
     215      109492 :     ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
     216      109492 : }
     217             : 
     218       31802 : VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount )
     219             :     : mpVirDev( NULL ),
     220       31802 :     meRefDevMode( REFDEV_NONE )
     221             : {
     222             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8 && nBitCount != rCompDev.GetBitCount(), "vcl.gdi",
     223             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     224             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     225             : 
     226       31802 :     ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
     227       31802 : }
     228             : 
     229       12786 : VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount )
     230             :     : mpVirDev( NULL ),
     231       12786 :     meRefDevMode( REFDEV_NONE )
     232             : {
     233             :     SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
     234             :                  "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount, not " << nBitCount );
     235             :     SAL_INFO( "vcl.gdi",
     236             :             "VirtualDevice::VirtualDevice( " << nBitCount << ", " << nAlphaBitCount << " )" );
     237             : 
     238       12786 :     ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
     239             : 
     240             :     // Enable alpha channel
     241       12786 :     mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);
     242       12786 : }
     243             : 
     244           0 : VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize,
     245             :                              sal_uInt16 nBitCount)
     246             : :   mpVirDev( NULL ),
     247           0 :     meRefDevMode( REFDEV_NONE )
     248             : {
     249             :     SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
     250             : 
     251           0 :     ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), rSize.Height(),
     252           0 :                    nBitCount, pData);
     253           0 : }
     254             : 
     255      454545 : VirtualDevice::~VirtualDevice()
     256             : {
     257             :     SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" );
     258      151516 :     disposeOnce();
     259      303029 : }
     260             : 
     261      151516 : void VirtualDevice::dispose()
     262             : {
     263             :     SAL_INFO( "vcl.gdi", "VirtualDevice::dispose()" );
     264             : 
     265      151516 :     ImplSVData* pSVData = ImplGetSVData();
     266             : 
     267      151516 :     ReleaseGraphics();
     268             : 
     269      151516 :     delete mpVirDev;
     270             : 
     271             :     // remove this VirtualDevice from the double-linked global list
     272      151516 :     if( mpPrev )
     273       62836 :         mpPrev->mpNext = mpNext;
     274             :     else
     275       88680 :         pSVData->maGDIData.mpFirstVirDev = mpNext;
     276             : 
     277      151516 :     if( mpNext )
     278      149551 :         mpNext->mpPrev = mpPrev;
     279             :     else
     280        1965 :         pSVData->maGDIData.mpLastVirDev = mpPrev;
     281             : 
     282      151516 :     OutputDevice::dispose();
     283      151516 : }
     284             : 
     285       83843 : bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
     286             :                                                  const basebmp::RawMemorySharedArray &pBuffer,
     287             :                                                  const bool bTopDown )
     288             : {
     289             :     SAL_INFO( "vcl.gdi",
     290             :               "VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
     291             :               << rNewSize.Height() << ", " << int(bErase) << " )" );
     292             : 
     293       83843 :     if ( !mpVirDev )
     294           0 :         return false;
     295       83843 :     else if ( rNewSize == GetOutputSizePixel() )
     296             :     {
     297        7580 :         if ( bErase )
     298        7580 :             Erase();
     299             :         // Yeah, so trying to re-use a VirtualDevice but this time using a
     300             :         // pre-allocated buffer won't work. Big deal.
     301        7580 :         return true;
     302             :     }
     303             : 
     304             :     bool bRet;
     305       76263 :     long nNewWidth = rNewSize.Width(), nNewHeight = rNewSize.Height();
     306             : 
     307       76263 :     if ( nNewWidth < 1 )
     308         140 :         nNewWidth = 1;
     309             : 
     310       76263 :     if ( nNewHeight < 1 )
     311         112 :         nNewHeight = 1;
     312             : 
     313       76263 :     if ( bErase )
     314             :     {
     315       73514 :         if ( pBuffer )
     316           0 :             bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer, bTopDown );
     317             :         else
     318       73514 :             bRet = mpVirDev->SetSize( nNewWidth, nNewHeight );
     319             : 
     320       73514 :         if ( bRet )
     321             :         {
     322       73514 :             mnOutWidth  = rNewSize.Width();
     323       73514 :             mnOutHeight = rNewSize.Height();
     324       73514 :             Erase();
     325             :         }
     326             :     }
     327             :     else
     328             :     {
     329             :         SalVirtualDevice*   pNewVirDev;
     330        2749 :         ImplSVData*         pSVData = ImplGetSVData();
     331             : 
     332             :         // we need a graphics
     333        2749 :         if ( !mpGraphics )
     334             :         {
     335           0 :             if ( !AcquireGraphics() )
     336           0 :                 return false;
     337             :         }
     338             : 
     339        2749 :         pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, nNewWidth, nNewHeight, mnBitCount );
     340        2749 :         if ( pNewVirDev )
     341             :         {
     342        2749 :             SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
     343        2749 :             if ( pGraphics )
     344             :             {
     345             :                 long nWidth;
     346             :                 long nHeight;
     347        2749 :                 if ( mnOutWidth < nNewWidth )
     348        2171 :                     nWidth = mnOutWidth;
     349             :                 else
     350         578 :                     nWidth = nNewWidth;
     351        2749 :                 if ( mnOutHeight < nNewHeight )
     352        2318 :                     nHeight = mnOutHeight;
     353             :                 else
     354         431 :                     nHeight = nNewHeight;
     355        2749 :                 SalTwoRect aPosAry(0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight);
     356        2749 :                 pGraphics->CopyBits( aPosAry, mpGraphics, this, this );
     357        2749 :                 pNewVirDev->ReleaseGraphics( pGraphics );
     358        2749 :                 ReleaseGraphics();
     359        2749 :                 delete mpVirDev;
     360        2749 :                 mpVirDev = pNewVirDev;
     361        2749 :                 mnOutWidth  = rNewSize.Width();
     362        2749 :                 mnOutHeight = rNewSize.Height();
     363        2749 :                 bRet = true;
     364             :             }
     365             :             else
     366             :             {
     367           0 :                 bRet = false;
     368           0 :                 delete pNewVirDev;
     369             :             }
     370             :         }
     371             :         else
     372           0 :             bRet = false;
     373             :     }
     374             : 
     375       76263 :     return bRet;
     376             : }
     377             : 
     378             : // #i32109#: Fill opaque areas correctly (without relying on
     379             : // fill/linecolor state)
     380           2 : void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
     381             : {
     382             :     // Set line and fill color to black (->opaque),
     383             :     // fill rect with that (linecolor, too, because of
     384             :     // those pesky missing pixel problems)
     385           2 :     Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
     386           2 :     SetLineColor( COL_BLACK );
     387           2 :     SetFillColor( COL_BLACK );
     388           2 :     DrawRect( rRect );
     389           2 :     Pop();
     390           2 : }
     391             : 
     392       71054 : bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase,
     393             :                                             const basebmp::RawMemorySharedArray &pBuffer,
     394             :                                             const bool bTopDown )
     395             : {
     396       71054 :     if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer, bTopDown) )
     397             :     {
     398       71054 :         if( mnAlphaDepth != -1 )
     399             :         {
     400             :             // #110958# Setup alpha bitmap
     401       12798 :             if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
     402             :             {
     403           3 :                 mpAlphaVDev.disposeAndClear();
     404             :             }
     405             : 
     406       12798 :             if( !mpAlphaVDev )
     407             :             {
     408       12789 :                 mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, mnAlphaDepth );
     409             :                 mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase,
     410             :                                                          basebmp::RawMemorySharedArray(),
     411       12789 :                                                          bTopDown );
     412             :             }
     413             : 
     414             :             // TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev
     415       12798 :             if( GetLineColor() != Color( COL_TRANSPARENT ) )
     416       12792 :                 mpAlphaVDev->SetLineColor( COL_BLACK );
     417             : 
     418       12798 :             if( GetFillColor() != Color( COL_TRANSPARENT ) )
     419       12798 :                 mpAlphaVDev->SetFillColor( COL_BLACK );
     420             : 
     421       12798 :             mpAlphaVDev->SetMapMode( GetMapMode() );
     422             :         }
     423             : 
     424       71054 :         return true;
     425             :     }
     426             : 
     427           0 :     return false;
     428             : }
     429             : 
     430       70484 : void VirtualDevice::EnableRTL( bool bEnable )
     431             : {
     432             :     // virdevs default to not mirroring, they will only be set to mirroring
     433             :     // under rare circumstances in the UI, eg the valueset control
     434             :     // because each virdev has its own SalGraphics we can safely switch the SalGraphics here
     435             :     // ...hopefully
     436       70484 :     if( AcquireGraphics() )
     437       70484 :         mpGraphics->SetLayout( bEnable ? SalLayoutFlags::BiDiRtl : SalLayoutFlags::NONE );
     438             : 
     439       70484 :     OutputDevice::EnableRTL(bEnable);
     440       70484 : }
     441             : 
     442       71054 : bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase )
     443             : {
     444       71054 :     return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray(), false );
     445             : }
     446             : 
     447           0 : bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
     448             :     const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset,
     449             :     const basebmp::RawMemorySharedArray &pBuffer, const bool bTopDown )
     450             : {
     451           0 :     if (pBuffer) {
     452           0 :         MapMode mm = GetMapMode();
     453           0 :         mm.SetOrigin( rNewOffset );
     454           0 :         mm.SetScaleX( rScale );
     455           0 :         mm.SetScaleY( rScale );
     456           0 :         SetMapMode( mm );
     457             :     }
     458           0 :     return ImplSetOutputSizePixel( rNewSize, true, pBuffer, bTopDown );
     459             : }
     460             : 
     461        3640 : void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )
     462             : {
     463        3640 :     sal_Int32 nDPIX = 600, nDPIY = 600;
     464        3640 :     switch( i_eRefDevMode )
     465             :     {
     466             :     case REFDEV_NONE:
     467             :     default:
     468             :         DBG_ASSERT( false, "VDev::SetRefDev illegal argument!" );
     469           0 :         break;
     470             :     case REFDEV_MODE06:
     471          24 :         nDPIX = nDPIY = 600;
     472          24 :         break;
     473             :     case REFDEV_MODE_MSO1:
     474        3616 :         nDPIX = nDPIY = 6*1440;
     475        3616 :         break;
     476             :     case REFDEV_MODE_PDF1:
     477           0 :         nDPIX = nDPIY = 720;
     478           0 :         break;
     479             :     }
     480        3640 :     ImplSetReferenceDevice( i_eRefDevMode, nDPIX, nDPIY );
     481        3640 : }
     482             : 
     483           0 : void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
     484             : {
     485           0 :     ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY );
     486           0 : }
     487             : 
     488        3640 : void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
     489             : {
     490        3640 :     mnDPIX = i_nDPIX;
     491        3640 :     mnDPIY = i_nDPIY;
     492        3640 :     mnDPIScaleFactor = 1;
     493             : 
     494        3640 :     EnableOutput( false );  // prevent output on reference device
     495        3640 :     mbScreenComp = false;
     496             : 
     497             :     // invalidate currently selected fonts
     498        3640 :     mbInitFont = true;
     499        3640 :     mbNewFont = true;
     500             : 
     501             :     // avoid adjusting font lists when already in refdev mode
     502        3640 :     sal_uInt8 nOldRefDevMode = meRefDevMode;
     503        3640 :     sal_uInt8 nOldCompatFlag = (sal_uInt8)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD;
     504        3640 :     meRefDevMode = (sal_uInt8)(i_eRefDevMode | nOldCompatFlag);
     505        3640 :     if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE )
     506        3643 :         return;
     507             : 
     508             :     // the reference device should have only scalable fonts
     509             :     // => clean up the original font lists before getting new ones
     510        3637 :     if ( mpFontEntry )
     511             :     {
     512           0 :         mpFontCache->Release( mpFontEntry );
     513           0 :         mpFontEntry = NULL;
     514             :     }
     515        3637 :     if ( mpGetDevFontList )
     516             :     {
     517           0 :         delete mpGetDevFontList;
     518           0 :         mpGetDevFontList = NULL;
     519             :     }
     520        3637 :     if ( mpGetDevSizeList )
     521             :     {
     522           0 :         delete mpGetDevSizeList;
     523           0 :         mpGetDevSizeList = NULL;
     524             :     }
     525             : 
     526             :     // preserve global font lists
     527        3637 :     ImplSVData* pSVData = ImplGetSVData();
     528        3637 :     if( mpFontCollection && (mpFontCollection != pSVData->maGDIData.mpScreenFontList) )
     529           0 :         delete mpFontCollection;
     530        3637 :     if( mpFontCache && (mpFontCache != pSVData->maGDIData.mpScreenFontCache) )
     531           0 :         delete mpFontCache;
     532             : 
     533             :     // get font list with scalable fonts only
     534        3637 :     AcquireGraphics();
     535        3637 :     mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone( true, false );
     536             : 
     537             :     // prepare to use new font lists
     538        3637 :     mpFontCache = new ImplFontCache();
     539             : }
     540             : 
     541      155877 : sal_uInt16 VirtualDevice::GetBitCount() const
     542             : {
     543      155877 :     return mnBitCount;
     544             : }
     545             : 
     546           0 : sal_uInt16 VirtualDevice::GetAlphaBitCount() const
     547             : {
     548           0 :     if (mpAlphaVDev)
     549           0 :         return mpAlphaVDev->GetBitCount();
     550             : 
     551           0 :     return 0;
     552             : }
     553             : 
     554           0 : bool VirtualDevice::UsePolyPolygonForComplexGradient()
     555             : {
     556           0 :     return true;
     557             : }
     558             : 
     559          10 : void VirtualDevice::Compat_ZeroExtleadBug()
     560             : {
     561          10 :     meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD;
     562          10 : }
     563             : 
     564      544111 : long VirtualDevice::GetFontExtLeading() const
     565             : {
     566             : #ifdef UNX
     567             :     // backwards compatible line metrics after fixing #i60945#
     568      544111 :     if ( ForceZeroExtleadBug() )
     569         540 :         return 0;
     570             : #endif
     571             : 
     572      543571 :     ImplFontEntry*      pEntry = mpFontEntry;
     573      543571 :     ImplFontMetricData* pMetric = &(pEntry->maMetric);
     574             : 
     575      543571 :     return pMetric->mnExtLeading;
     576         801 : }
     577             : 
     578             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11