diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 11:56:54 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-25 12:01:15 +1000 |
commit | 808d273db098e2269e53813595a6bfc7b160e28e (patch) | |
tree | 7c2e8d14f0e9b4a1453c208fd89f2db1d8cef15f | |
parent | 50708577850544920c746ebc382d47275452a761 (diff) |
Remove ImpInitOutDevData and ImplDeInitOutDevData in OutputDevice
All these do is some very, very basic initialization. There is no need
to lazy load the structure, it should be initialized when OutputDevice
is created in the constructor and deinitialized in the destructor.
Change-Id: I780caf4d02e9a2a7d094989cf0bba579493ca98d
-rw-r--r-- | include/vcl/outdev.hxx | 12 | ||||
-rw-r--r-- | vcl/source/outdev/map.cxx | 12 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 193 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 5 |
5 files changed, 94 insertions, 130 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 45986eeb0bde..377208fee32b 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -379,10 +379,10 @@ private: mutable bool mbRefPoint : 1; mutable bool mbEnableRTL : 1; -public: /** @name Initialization and accessor functions */ ///@{ +public: /** Get the graphic context that the output device uses to draw on. @@ -422,20 +422,12 @@ protected: physically released graphics device. */ virtual void ReleaseGraphics( bool bRelease = true ) = 0; - -public: - /** Initialize the graphics device's data structures. - */ - SAL_DLLPRIVATE void ImplInitOutDevData(); - - /** De-initialize the graphics device's data structures. - */ - SAL_DLLPRIVATE void ImplDeInitOutDevData(); ///@} /** @name Helper functions */ +public: ///@{ /** Get the output device's DPI x-axis value. diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index fe663fd343b6..9cc8bcc139e6 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -837,12 +837,6 @@ basegfx::B2DHomMatrix OutputDevice::GetViewTransformation() const { if(mbMap) { - // #i82615# - if(!mpOutDevData) - { - const_cast< OutputDevice* >(this)->ImplInitOutDevData(); - } - if(!mpOutDevData->mpViewTransform) { mpOutDevData->mpViewTransform = new basegfx::B2DHomMatrix; @@ -871,12 +865,6 @@ basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation() const { if(mbMap) { - // #i82615# - if(!mpOutDevData) - { - const_cast< OutputDevice* >(this)->ImplInitOutDevData(); - } - if(!mpOutDevData->mpInverseViewTransform) { GetViewTransformation(); diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index cc133327d585..84650595b0dc 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -182,82 +182,93 @@ OutputDevice::OutputDevice() : mxSettings( new AllSettings(Application::GetSettings()) ) { - mpGraphics = NULL; - mpUnoGraphicsList = NULL; - mpPrevGraphics = NULL; - mpNextGraphics = NULL; - mpMetaFile = NULL; - mpFontEntry = NULL; - mpFontCache = NULL; - mpFontCollection = NULL; - mpGetDevFontList = NULL; - mpGetDevSizeList = NULL; - mpObjStack = NULL; - mpOutDevData = NULL; - mpPDFWriter = NULL; - mpAlphaVDev = NULL; - mpExtOutDevData = NULL; - mnOutOffX = 0; - mnOutOffY = 0; - mnOutWidth = 0; - mnOutHeight = 0; - mnDPIX = 0; - mnDPIY = 0; - mnDPIScaleFactor = 1; - mnTextOffX = 0; - mnTextOffY = 0; - mnOutOffOrigX = 0; - mnOutOffLogicX = 0; - mnOutOffOrigY = 0; - mnOutOffLogicY = 0; - mnEmphasisAscent = 0; - mnEmphasisDescent = 0; - mnDrawMode = 0; - mnTextLayoutMode = TEXT_LAYOUT_DEFAULT; + mpGraphics = NULL; + mpUnoGraphicsList = NULL; + mpPrevGraphics = NULL; + mpNextGraphics = NULL; + mpMetaFile = NULL; + mpFontEntry = NULL; + mpFontCache = NULL; + mpFontCollection = NULL; + mpGetDevFontList = NULL; + mpGetDevSizeList = NULL; + mpObjStack = NULL; + mpOutDevData = NULL; + mpPDFWriter = NULL; + mpAlphaVDev = NULL; + mpExtOutDevData = NULL; + mnOutOffX = 0; + mnOutOffY = 0; + mnOutWidth = 0; + mnOutHeight = 0; + mnDPIX = 0; + mnDPIY = 0; + mnDPIScaleFactor = 1; + mnTextOffX = 0; + mnTextOffY = 0; + mnOutOffOrigX = 0; + mnOutOffLogicX = 0; + mnOutOffOrigY = 0; + mnOutOffLogicY = 0; + mnEmphasisAscent = 0; + mnEmphasisDescent = 0; + mnDrawMode = 0; + mnTextLayoutMode = TEXT_LAYOUT_DEFAULT; + if( Application::GetSettings().GetLayoutRTL() ) //#i84553# tip BiDi preference to RTL - mnTextLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT; - meOutDevType = OUTDEV_DONTKNOW; - meOutDevViewType = OUTDEV_VIEWTYPE_DONTKNOW; - mbMap = false; - mbMapIsDefault = true; - mbClipRegion = false; - mbBackground = false; - mbOutput = true; - mbDevOutput = false; - mbOutputClipped = false; - maTextColor = Color( COL_BLACK ); - maOverlineColor = Color( COL_TRANSPARENT ); - meTextAlign = maFont.GetAlign(); - meRasterOp = ROP_OVERPAINT; - mnAntialiasing = 0; - meTextLanguage = 0; // TODO: get default from configuration? - mbLineColor = true; - mbFillColor = true; - mbInitLineColor = true; - mbInitFillColor = true; - mbInitFont = true; - mbInitTextColor = true; - mbInitClipRegion = true; - mbClipRegionSet = false; - mbKerning = false; - mbNewFont = true; - mbTextLines = false; - mbTextSpecial = false; - mbRefPoint = false; - mbEnableRTL = false; // mirroring must be explicitly allowed (typically for windows only) + mnTextLayoutMode = TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT; + + meOutDevType = OUTDEV_DONTKNOW; + meOutDevViewType = OUTDEV_VIEWTYPE_DONTKNOW; + mbMap = false; + mbMapIsDefault = true; + mbClipRegion = false; + mbBackground = false; + mbOutput = true; + mbDevOutput = false; + mbOutputClipped = false; + maTextColor = Color( COL_BLACK ); + maOverlineColor = Color( COL_TRANSPARENT ); + meTextAlign = maFont.GetAlign(); + meRasterOp = ROP_OVERPAINT; + mnAntialiasing = 0; + meTextLanguage = 0; // TODO: get default from configuration? + mbLineColor = true; + mbFillColor = true; + mbInitLineColor = true; + mbInitFillColor = true; + mbInitFont = true; + mbInitTextColor = true; + mbInitClipRegion = true; + mbClipRegionSet = false; + mbKerning = false; + mbNewFont = true; + mbTextLines = false; + mbTextSpecial = false; + mbRefPoint = false; + mbEnableRTL = false; // mirroring must be explicitly allowed (typically for windows only) // struct ImplMapRes - maMapRes.mnMapOfsX = 0; - maMapRes.mnMapOfsY = 0; - maMapRes.mnMapScNumX = 1; - maMapRes.mnMapScNumY = 1; - maMapRes.mnMapScDenomX = 1; - maMapRes.mnMapScDenomY = 1; + maMapRes.mnMapOfsX = 0; + maMapRes.mnMapOfsY = 0; + maMapRes.mnMapScNumX = 1; + maMapRes.mnMapScNumY = 1; + maMapRes.mnMapScDenomX = 1; + maMapRes.mnMapScDenomY = 1; // struct ImplThresholdRes - maThresRes.mnThresLogToPixX = 0; - maThresRes.mnThresLogToPixY = 0; - maThresRes.mnThresPixToLogX = 0; - maThresRes.mnThresPixToLogY = 0; + maThresRes.mnThresLogToPixX = 0; + maThresRes.mnThresLogToPixY = 0; + maThresRes.mnThresPixToLogX = 0; + maThresRes.mnThresPixToLogY = 0; + + // struct ImplOutDevData- see #i82615# + mpOutDevData = new ImplOutDevData; + mpOutDevData->mpRotateDev = NULL; + mpOutDevData->mpRecordLayout = NULL; + + // #i75163# + mpOutDevData->mpViewTransform = NULL; + mpOutDevData->mpInverseViewTransform = NULL; } OutputDevice::~OutputDevice() @@ -273,7 +284,15 @@ OutputDevice::~OutputDevice() } if ( mpOutDevData ) - ImplDeInitOutDevData(); + { + if ( mpOutDevData->mpRotateDev ) + delete mpOutDevData->mpRotateDev; + + // #i75163# + ImplInvalidateViewTransform(); + + delete mpOutDevData; + } ImplObjStack* pData = mpObjStack; if ( pData ) @@ -406,20 +425,6 @@ SalGraphics const *OutputDevice::GetGraphics() const return mpGraphics; } -void OutputDevice::ImplInitOutDevData() -{ - if ( !mpOutDevData ) - { - mpOutDevData = new ImplOutDevData; - mpOutDevData->mpRotateDev = NULL; - mpOutDevData->mpRecordLayout = NULL; - - // #i75163# - mpOutDevData->mpViewTransform = NULL; - mpOutDevData->mpInverseViewTransform = NULL; - } -} - void OutputDevice::ImplReleaseFonts() { mpGraphics->ReleaseFonts(); @@ -469,20 +474,6 @@ bool OutputDevice::ImplIsRecordLayout() const return mpOutDevData && mpOutDevData->mpRecordLayout; } -void OutputDevice::ImplDeInitOutDevData() -{ - if ( mpOutDevData ) - { - if ( mpOutDevData->mpRotateDev ) - delete mpOutDevData->mpRotateDev; - - // #i75163# - ImplInvalidateViewTransform(); - - delete mpOutDevData; - } -} - void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rPosAry ) { SalGraphics* pGraphics2; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 88a99f11bbe7..dd03ac44a427 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -226,8 +226,6 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) } // cache virtual device for rotation - if ( !mpOutDevData ) - ImplInitOutDevData(); if ( !mpOutDevData->mpRotateDev ) mpOutDevData->mpRotateDev = new VirtualDevice( *this, 1 ); VirtualDevice* pVDev = mpOutDevData->mpRotateDev; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index f8f4bdaa214e..320f95a60c97 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -8787,11 +8787,6 @@ void Window::SetAccessibilityEventsSuppressed(bool bSuppressed) void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect ) { - if( ! mpOutDevData ) - { - OutputDevice *pOutDev = GetOutDev(); - pOutDev->ImplInitOutDevData(); - } assert(mpOutDevData); mpOutDevData->mpRecordLayout = pLayout; mpOutDevData->maRecordRect = rRect; |