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

Generated by: LCOV version 1.10