4069417bc3
...without unlocking it again. This nonsense /does/ cause deadlocks and hours
of frustrated debugging on --enable-dbgutil Mac OS X, e.g., after this code is
called as
0 VirtualDevice::~VirtualDevice (this=0xa363200) at lo/core/vcl/source/gdi/virdev.cxx:187
1 0x05541677 in VirtualDevice::~VirtualDevice (this=0xa363200) at lo/core/vcl/source/gdi/virdev.cxx:182
2 0x0554164a in VirtualDevice::~VirtualDevice (this=0xa363200) at lo/core/vcl/source/gdi/virdev.cxx:182
3 0x05646a76 in StatusBar::~StatusBar (this=0xa362f10) at lo/core/vcl/source/window/status.cxx:176
4 0x05646947 in StatusBar::~StatusBar (this=0xa362f10) at lo/core/vcl/source/window/status.cxx:168
5 0x0564691a in StatusBar::~StatusBar (this=0xa362f10) at lo/core/vcl/source/window/status.cxx:168
6 0x0396cf2f in VCLXDevice::DestroyOutputDevice (this=0x390356cc) at lo/core/toolkit/source/awt/vclxdevice.cxx:56
7 0x039d4345 in VCLXWindow::dispose (this=0x390356cc) at lo/core/toolkit/source/awt/vclxwindow.cxx:956
8 0x039d452c in non-virtual thunk to VCLXWindow::dispose() (this=0x390356f8) at lo/core/toolkit/source/awt/vclxwindow.cxx:976
9 0x10dc6126 in framework::ProgressBarWrapper::setStatusBar (this=0x39002aac, rStatusBar=@0xb122e050, bOwnsInstance=0) at lo/core/framework/source/uielement/progressbarwrapper.cxx:63
10 0x10c17c84 in framework::LayoutManager::implts_backupProgressBarWrapper (this=0x19582c48) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:943
11 0x10c16ca7 in framework::LayoutManager::implts_destroyProgressBar (this=0x19582c48) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:959
12 0x10c13928 in framework::LayoutManager::implts_destroyStatusBar (this=0x19582c48) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:837
13 0x10c135cb in framework::LayoutManager::implts_destroyElements (this=0x19582c48) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:446
14 0x10c1a022 in framework::LayoutManager::setDockingAreaAcceptor (this=0x19582c48, xDockingAreaAcceptor=@0xb122e318) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:1344
15 0x10c1b199 in non-virtual thunk to framework::LayoutManager::setDockingAreaAcceptor(com::sun:⭐:uno::Reference<com::sun:⭐:ui::XDockingAreaAcceptor> const&) (this=0x19582c60, xDockingAreaAcceptor=@0xb122e318) at lo/core/framework/source/layoutmanager/layoutmanager.cxx:1363
16 0x10cc26fb in framework::lcl_disableLayoutManager (xLayoutManager=@0x39013338, xFrame=@0xb122e3d8) at lo/core/framework/source/services/frame.cxx:505
17 0x10cca452 in framework::Frame::dispose (this=0x3901320c) at lo/core/framework/source/services/frame.cxx:1851
18 0x10cc925e in framework::Frame::close (this=0x3901320c, bDeliverOwnership=1) at lo/core/framework/source/services/frame.cxx:1644
19 0x10cc933b in non-virtual thunk to framework::Frame::close(unsigned char) (this=0x39013238, bDeliverOwnership=1) at lo/core/framework/source/services/frame.cxx:1645
20 0x0cfb07ad in (anonymous namespace)::callVirtualMethod (pAdjustedThisPtr=0x39013238, nVtableIndex=5, pRegisterReturn=0x0, pReturnTypeDescr=0xa03e240, bSimpleReturn=true, pStackLongs=0xb122e610, nStackLongs=2) at lo/core/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx:75
21 0x0cfb01aa in (anonymous namespace)::cpp_call (pThis=0x179e2b20, aVtableSlot={offset = 0, index = 5}, pReturnTypeRef=0xa03e240, nParams=1, pParams=0x179ec9e0, pUnoReturn=0x0, pUnoArgs=0xa3652a0, ppUnoExc=0xb122eaac) at lo/core/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx:270
22 0x0cfaf785 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch (pUnoI=0x179e2b20, pMemberDescr=0x179ed690, pReturn=0x0, pArgs=0xa3652a0, ppException=0xb122eaac) at lo/core/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx:461
23 0x10817d68 in binaryurp::IncomingRequest::execute_throw (this=0x179edf90, returnValue=0xb122ed58, outArguments=0xb122ed48) at lo/core/binaryurp/source/incomingrequest.cxx:245
24 0x10816293 in binaryurp::IncomingRequest::execute (this=0x179edf90) at lo/core/binaryurp/source/incomingrequest.cxx:74
25 0x10829105 in request (pThreadSpecificData=0x179edf90) at lo/core/binaryurp/source/reader.cxx:85
26 0x00bc39fe in cppu_threadpool::JobQueue::enter (this=0x179db470, nDisposeId=171320704, bReturnWhenNoJob=1) at lo/core/cppu/source/threadpool/jobqueue.cxx:115
27 0x00bc67f1 in cppu_threadpool::ORequestThread::run (this=0xa362580) at lo/core/cppu/source/threadpool/thread.cxx:171
28 0x00bc698c in non-virtual thunk to cppu_threadpool::ORequestThread::run() (this=0xa362588) at lo/core/cppu/source/threadpool/thread.cxx:201
29 0x00bc81ad in threadFunc (param=0xa362588) at thread.hxx:187
30 0x00016f4c in osl_thread_start_Impl (pData=0xa362030) at lo/core/sal/osl/unx/thread.c:251
31 0x9560eed9 in _pthread_start ()
32 0x956126de in thread_start ()
in JunitTest_extensions_unoapi; but it is also called regularly when running a
plain backing-windows soffice instance,
0 VirtualDevice::~VirtualDevice (this=0xbfff7a60) at lo/core/vcl/source/gdi/virdev.cxx:187
1 0x05541677 in VirtualDevice::~VirtualDevice (this=0xbfff7a60) at lo/core/vcl/source/gdi/virdev.cxx:182
2 0x10ca4f3d in framework::BackingWindow::Paint (this=0xa9da800) at lo/core/framework/source/services/backingwindow.cxx:699
3 0x05698dd8 in Window::ImplCallPaint (this=0xa9da800, pRegion=0x179d55c0, nPaintFlags=60) at lo/core/vcl/source/window/window.cxx:2462
4 0x05698f4b in Window::ImplCallPaint (this=0xa08dad0, pRegion=0x179c7270, nPaintFlags=60) at lo/core/vcl/source/window/window.cxx:2486
5 0x05698f4b in Window::ImplCallPaint (this=0xa08dd90, pRegion=0x0, nPaintFlags=60) at lo/core/vcl/source/window/window.cxx:2486
6 0x0569a141 in Window::Update (this=0xa08dd90) at lo/core/vcl/source/window/window.cxx:7505
7 0x056c9881 in ImplHandlePaint (pWindow=0xa08dd90, rBoundRect=@0xbfff8198, bImmediateUpdate=true) at lo/core/vcl/source/window/winproc.cxx:1575
8 0x056c6e88 in ImplWindowFrameProc (pWindow=0xa08dd90, nEvent=8, pEvent=0xbfff82a0) at lo/core/vcl/source/window/winproc.cxx:2484
9 0x056f33a6 in SalFrame::CallCallback (this=0xa08e050, nEvent=8, pEvent=0xbfff82a0) at salframe.hxx:243
10 0x05727a93 in AquaSalFrame::SendPaintEvent (this=0xa08e050, pRect=0x0) at lo/core/vcl/aqua/source/window/salframe.cxx:423
11 0x057678d3 in -[SalFrameWindow windowDidBecomeKey:] (self=0xa08e130, _cmd=0x9402b075, pNotification=0x179d5240) at lo/core/vcl/aqua/source/window/salframeview.mm:227
12 0x9b556df1 in __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 ()
13 0x996ba903 in ___CFXNotificationPost_block_invoke_1 ()
14 0x99685688 in _CFXNotificationPost ()
15 0x9b541fde in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
16 0x9b557272 in -[NSNotificationCenter postNotificationName:object:] ()
17 0x937deec5 in -[NSWindow becomeKeyWindow] ()
18 0x9374af4d in _NXSendWindowNotification ()
19 0x937de618 in _NXShowKeyAndMain ()
20 0x9374477d in -[NSApplication sendEvent:] ()
21 0x0575388d in -[VCL_NSApplication sendEvent:] (self=0xa02d120, _cmd=0x94126a08, pEvent=0x179c8430) at lo/core/vcl/aqua/source/app/vclnsapp.mm:208
22 0x056f081e in AquaSalInstance::Yield (this=0xa315ff0, bWait=true, bHandleAllCurrentEvents=false) at lo/core/vcl/aqua/source/app/salinst.cxx:695
23 0x050acee2 in ImplYield (i_bWait=true, i_bAllEvents=false) at lo/core/vcl/source/app/svapp.cxx:422
24 0x050a81be in Application::Yield (i_bAllEvents=false) at lo/core/vcl/source/app/svapp.cxx:456
25 0x050a817a in Application::Execute () at lo/core/vcl/source/app/svapp.cxx:401
26 0x00124a3a in desktop::Desktop::Main (this=0xbfff95e0) at lo/core/desktop/source/app/app.cxx:1736
27 0x050b8934 in ImplSVMain () at lo/core/vcl/source/app/svmain.cxx:162
28 0x056eff73 in AquaSalInstance::handleAppDefinedEvent (pEvent=0xa324b20) at lo/core/vcl/aqua/source/app/salinst.cxx:538
29 0x05752faf in -[VCL_NSApplication sendEvent:] (self=0xa02d120, _cmd=0x94126a08, pEvent=0xa324b20) at lo/core/vcl/aqua/source/app/vclnsapp.mm:60
30 0x936d6b21 in -[NSApplication run] ()
31 0x93967ac5 in NSApplicationMain ()
32 0x056eec96 in ImplSVMainHook (pnInit=0xbfff9580) at lo/core/vcl/aqua/source/app/salinst.cxx:231
33 0x050b9ea1 in SVMain () at lo/core/vcl/source/app/svmain.cxx:195
34 0x0018e01d in soffice_main () at lo/core/desktop/source/app/sofficemain.cxx:82
35 0x00001f5b in sal_main () at lo/core/desktop/source/app/main.c:48
36 0x00001f40 in main (argc=5, argv=0xbfff966c) at lo/core/desktop/source/app/main.c:47
Whatever the root problem behind 8ed93fef13
"We need to acquire the yield mutex here," please fix it properly instead.
Change-Id: I281da60de1471f702ca34fd2b3239b6da83e2cf9
466 lines
15 KiB
C++
466 lines
15 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#include <vcl/settings.hxx>
|
|
#include <vcl/svapp.hxx>
|
|
#include <vcl/wrkwin.hxx>
|
|
#include <vcl/virdev.hxx>
|
|
|
|
#include <salinst.hxx>
|
|
#include <salgdi.hxx>
|
|
#include <salframe.hxx>
|
|
#include <salvd.hxx>
|
|
#include <outdev.h>
|
|
#include <svdata.hxx>
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
// =======================================================================
|
|
|
|
void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
|
|
long nDX, long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData )
|
|
{
|
|
SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << nBitCount << ")" );
|
|
|
|
if ( nDX < 1 )
|
|
nDX = 1;
|
|
|
|
if ( nDY < 1 )
|
|
nDY = 1;
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( !pOutDev )
|
|
pOutDev = ImplGetDefaultWindow();
|
|
if( !pOutDev )
|
|
return;
|
|
|
|
SalGraphics* pGraphics;
|
|
if ( !pOutDev->mpGraphics )
|
|
((OutputDevice*)pOutDev)->ImplGetGraphics();
|
|
pGraphics = pOutDev->mpGraphics;
|
|
if ( pGraphics )
|
|
mpVirDev = pSVData->mpDefInst->CreateVirtualDevice( pGraphics, nDX, nDY, nBitCount, pData );
|
|
else
|
|
mpVirDev = NULL;
|
|
if ( !mpVirDev )
|
|
{
|
|
// do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
|
|
throw ::com::sun::star::uno::RuntimeException(
|
|
OUString( "Could not create system bitmap!" ),
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
|
|
//GetpApp()->Exception( EXC_SYSOBJNOTCREATED );
|
|
}
|
|
|
|
mnBitCount = ( nBitCount ? nBitCount : pOutDev->GetBitCount() );
|
|
mnOutWidth = nDX;
|
|
mnOutHeight = nDY;
|
|
mbScreenComp = sal_True;
|
|
mnAlphaDepth = -1;
|
|
|
|
// #i59315# init vdev size from system object, when passed a
|
|
// SystemGraphicsData. Otherwise, output size will always
|
|
// incorrectly stay at (1,1)
|
|
if( pData && mpVirDev )
|
|
mpVirDev->GetSize(mnOutWidth,mnOutHeight);
|
|
|
|
if( mnBitCount < 8 )
|
|
SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
|
|
|
|
if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
|
|
mbScreenComp = sal_False;
|
|
else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
|
|
mbScreenComp = ((VirtualDevice*)pOutDev)->mbScreenComp;
|
|
|
|
meOutDevType = OUTDEV_VIRDEV;
|
|
mbDevOutput = sal_True;
|
|
mpFontList = pSVData->maGDIData.mpScreenFontList;
|
|
mpFontCache = pSVData->maGDIData.mpScreenFontCache;
|
|
mnDPIX = pOutDev->mnDPIX;
|
|
mnDPIY = pOutDev->mnDPIY;
|
|
maFont = pOutDev->maFont;
|
|
|
|
if( maTextColor != pOutDev->maTextColor )
|
|
{
|
|
maTextColor = pOutDev->maTextColor;
|
|
mbInitTextColor = true;
|
|
}
|
|
|
|
// Virtuelle Devices haben defaultmaessig einen weissen Hintergrund
|
|
SetBackground( Wallpaper( Color( COL_WHITE ) ) );
|
|
|
|
// #i59283# don't erase user-provided surface
|
|
if( !pData )
|
|
Erase();
|
|
|
|
// VirDev in Liste eintragen
|
|
mpNext = pSVData->maGDIData.mpFirstVirDev;
|
|
mpPrev = NULL;
|
|
if ( mpNext )
|
|
mpNext->mpPrev = this;
|
|
else
|
|
pSVData->maGDIData.mpLastVirDev = this;
|
|
pSVData->maGDIData.mpFirstVirDev = this;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
|
|
: mpVirDev( NULL ),
|
|
meRefDevMode( REFDEV_NONE )
|
|
{
|
|
SAL_WARN_IF( (nBitCount > 1 && nBitCount != 8), "vcl.gdi",
|
|
"VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for BitCount" );
|
|
SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
|
|
|
|
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount )
|
|
: mpVirDev( NULL ),
|
|
meRefDevMode( REFDEV_NONE )
|
|
{
|
|
SAL_WARN_IF( nBitCount > 1, "vcl.gdi",
|
|
"VirtualDevice::VirtualDevice(): Only 0 or 1 is for BitCount allowed" );
|
|
SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
|
|
|
|
ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount )
|
|
: mpVirDev( NULL ),
|
|
meRefDevMode( REFDEV_NONE )
|
|
{
|
|
SAL_WARN_IF( nBitCount > 1, "vcl.gdi",
|
|
"VirtualDevice::VirtualDevice(): Only 0 or 1 is for BitCount allowed" );
|
|
SAL_INFO( "vcl.gdi",
|
|
"VirtualDevice::VirtualDevice( " << nBitCount << ", " << nAlphaBitCount << " )" );
|
|
|
|
ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
|
|
|
|
// Enable alpha channel
|
|
mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount )
|
|
: mpVirDev( NULL ),
|
|
meRefDevMode( REFDEV_NONE )
|
|
{
|
|
SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" );
|
|
|
|
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData );
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
VirtualDevice::~VirtualDevice()
|
|
{
|
|
SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" );
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
ImplReleaseGraphics();
|
|
|
|
if ( mpVirDev )
|
|
pSVData->mpDefInst->DestroyVirtualDevice( mpVirDev );
|
|
|
|
// remove this VirtualDevice from the double-linked global list
|
|
if( mpPrev )
|
|
mpPrev->mpNext = mpNext;
|
|
else
|
|
pSVData->maGDIData.mpFirstVirDev = mpNext;
|
|
|
|
if( mpNext )
|
|
mpNext->mpPrev = mpPrev;
|
|
else
|
|
pSVData->maGDIData.mpLastVirDev = mpPrev;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
sal_Bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
|
|
{
|
|
SAL_INFO( "vcl.gdi",
|
|
"VirtualDevice::InnerImplSetOutputSizePixel( " << rNewSize.Width() << ", "
|
|
<< rNewSize.Height() << ", " << int(bErase) << " )" );
|
|
|
|
if ( !mpVirDev )
|
|
return sal_False;
|
|
else if ( rNewSize == GetOutputSizePixel() )
|
|
{
|
|
if ( bErase )
|
|
Erase();
|
|
// Yeah, so trying to re-use a VirtualDevice but this time using a
|
|
// pre-allocated buffer won't work. Big deal.
|
|
return sal_True;
|
|
}
|
|
|
|
sal_Bool bRet;
|
|
long nNewWidth = rNewSize.Width(), nNewHeight = rNewSize.Height();
|
|
|
|
if ( nNewWidth < 1 )
|
|
nNewWidth = 1;
|
|
|
|
if ( nNewHeight < 1 )
|
|
nNewHeight = 1;
|
|
|
|
if ( bErase )
|
|
{
|
|
if ( pBuffer )
|
|
bRet = mpVirDev->SetSizeUsingBuffer( nNewWidth, nNewHeight, pBuffer );
|
|
else
|
|
bRet = mpVirDev->SetSize( nNewWidth, nNewHeight );
|
|
|
|
if ( bRet )
|
|
{
|
|
mnOutWidth = rNewSize.Width();
|
|
mnOutHeight = rNewSize.Height();
|
|
Erase();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SalVirtualDevice* pNewVirDev;
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
// we need a graphics
|
|
if ( !mpGraphics )
|
|
{
|
|
if ( !ImplGetGraphics() )
|
|
return sal_False;
|
|
}
|
|
|
|
pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, nNewWidth, nNewHeight, mnBitCount );
|
|
if ( pNewVirDev )
|
|
{
|
|
SalGraphics* pGraphics = pNewVirDev->GetGraphics();
|
|
if ( pGraphics )
|
|
{
|
|
SalTwoRect aPosAry;
|
|
long nWidth;
|
|
long nHeight;
|
|
if ( mnOutWidth < nNewWidth )
|
|
nWidth = mnOutWidth;
|
|
else
|
|
nWidth = nNewWidth;
|
|
if ( mnOutHeight < nNewHeight )
|
|
nHeight = mnOutHeight;
|
|
else
|
|
nHeight = nNewHeight;
|
|
aPosAry.mnSrcX = 0;
|
|
aPosAry.mnSrcY = 0;
|
|
aPosAry.mnSrcWidth = nWidth;
|
|
aPosAry.mnSrcHeight = nHeight;
|
|
aPosAry.mnDestX = 0;
|
|
aPosAry.mnDestY = 0;
|
|
aPosAry.mnDestWidth = nWidth;
|
|
aPosAry.mnDestHeight = nHeight;
|
|
|
|
pGraphics->CopyBits( &aPosAry, mpGraphics, this, this );
|
|
pNewVirDev->ReleaseGraphics( pGraphics );
|
|
ImplReleaseGraphics();
|
|
pSVData->mpDefInst->DestroyVirtualDevice( mpVirDev );
|
|
mpVirDev = pNewVirDev;
|
|
mnOutWidth = rNewSize.Width();
|
|
mnOutHeight = rNewSize.Height();
|
|
bRet = sal_True;
|
|
}
|
|
else
|
|
{
|
|
bRet = sal_False;
|
|
pSVData->mpDefInst->DestroyVirtualDevice( pNewVirDev );
|
|
}
|
|
}
|
|
else
|
|
bRet = sal_False;
|
|
}
|
|
|
|
return bRet;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// #i32109#: Fill opaque areas correctly (without relying on
|
|
// fill/linecolor state)
|
|
void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
|
|
{
|
|
// Set line and fill color to black (->opaque),
|
|
// fill rect with that (linecolor, too, because of
|
|
// those pesky missing pixel problems)
|
|
Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
|
|
SetLineColor( COL_BLACK );
|
|
SetFillColor( COL_BLACK );
|
|
DrawRect( rRect );
|
|
Pop();
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
sal_Bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
|
|
{
|
|
if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
|
|
{
|
|
if( mnAlphaDepth != -1 )
|
|
{
|
|
// #110958# Setup alpha bitmap
|
|
if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
|
|
{
|
|
delete mpAlphaVDev;
|
|
mpAlphaVDev = 0L;
|
|
}
|
|
|
|
if( !mpAlphaVDev )
|
|
{
|
|
mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth );
|
|
mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, basebmp::RawMemorySharedArray() );
|
|
}
|
|
|
|
// TODO: copy full outdev state to new one, here. Also needed in outdev2.cxx:DrawOutDev
|
|
if( GetLineColor() != Color( COL_TRANSPARENT ) )
|
|
mpAlphaVDev->SetLineColor( COL_BLACK );
|
|
|
|
if( GetFillColor() != Color( COL_TRANSPARENT ) )
|
|
mpAlphaVDev->SetFillColor( COL_BLACK );
|
|
|
|
mpAlphaVDev->SetMapMode( GetMapMode() );
|
|
}
|
|
|
|
return sal_True;
|
|
}
|
|
|
|
return sal_False;
|
|
}
|
|
|
|
sal_Bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, sal_Bool bErase )
|
|
{
|
|
return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray() );
|
|
}
|
|
|
|
sal_Bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize, const Fraction& rScale, const Point& rNewOffset, const basebmp::RawMemorySharedArray &pBuffer )
|
|
{
|
|
if (pBuffer) {
|
|
MapMode mm = GetMapMode();
|
|
mm.SetOrigin( rNewOffset );
|
|
mm.SetScaleX( rScale );
|
|
mm.SetScaleY( rScale );
|
|
SetMapMode( mm );
|
|
}
|
|
return ImplSetOutputSizePixel( rNewSize, sal_True, pBuffer);
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )
|
|
{
|
|
sal_Int32 nDPIX = 600, nDPIY = 600;
|
|
switch( i_eRefDevMode )
|
|
{
|
|
case REFDEV_NONE:
|
|
default:
|
|
DBG_ASSERT( sal_False, "VDev::SetRefDev illegal argument!" );
|
|
break;
|
|
case REFDEV_MODE06:
|
|
nDPIX = nDPIY = 600;
|
|
break;
|
|
case REFDEV_MODE_MSO1:
|
|
nDPIX = nDPIY = 6*1440;
|
|
break;
|
|
case REFDEV_MODE_PDF1:
|
|
nDPIX = nDPIY = 720;
|
|
break;
|
|
}
|
|
ImplSetReferenceDevice( i_eRefDevMode, nDPIX, nDPIY );
|
|
}
|
|
|
|
void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
|
|
{
|
|
ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY );
|
|
}
|
|
|
|
void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY )
|
|
{
|
|
mnDPIX = i_nDPIX;
|
|
mnDPIY = i_nDPIY;
|
|
|
|
EnableOutput( sal_False ); // prevent output on reference device
|
|
mbScreenComp = sal_False;
|
|
|
|
// invalidate currently selected fonts
|
|
mbInitFont = sal_True;
|
|
mbNewFont = sal_True;
|
|
|
|
// avoid adjusting font lists when already in refdev mode
|
|
sal_uInt8 nOldRefDevMode = meRefDevMode;
|
|
sal_uInt8 nOldCompatFlag = (sal_uInt8)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD;
|
|
meRefDevMode = (sal_uInt8)(i_eRefDevMode | nOldCompatFlag);
|
|
if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE )
|
|
return;
|
|
|
|
// the reference device should have only scalable fonts
|
|
// => clean up the original font lists before getting new ones
|
|
if ( mpFontEntry )
|
|
{
|
|
mpFontCache->Release( mpFontEntry );
|
|
mpFontEntry = NULL;
|
|
}
|
|
if ( mpGetDevFontList )
|
|
{
|
|
delete mpGetDevFontList;
|
|
mpGetDevFontList = NULL;
|
|
}
|
|
if ( mpGetDevSizeList )
|
|
{
|
|
delete mpGetDevSizeList;
|
|
mpGetDevSizeList = NULL;
|
|
}
|
|
|
|
// preserve global font lists
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
if( mpFontList && (mpFontList != pSVData->maGDIData.mpScreenFontList) )
|
|
delete mpFontList;
|
|
if( mpFontCache && (mpFontCache != pSVData->maGDIData.mpScreenFontCache) )
|
|
delete mpFontCache;
|
|
|
|
// get font list with scalable fonts only
|
|
ImplGetGraphics();
|
|
mpFontList = pSVData->maGDIData.mpScreenFontList->Clone( true, false );
|
|
|
|
// prepare to use new font lists
|
|
mpFontCache = new ImplFontCache( false );
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
void VirtualDevice::Compat_ZeroExtleadBug()
|
|
{
|
|
meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD;
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|