summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-02-02 23:51:27 +1100
committerCaolán McNamara <caolanm@redhat.com>2014-03-10 06:53:45 -0500
commit9d64cdc4cf2122bcbcf1fb670bd1103d09bbc7b3 (patch)
tree79b074d279ae4d37aa0151b1d348622c00887355 /vcl
parent4a1bb12034fc76b2d26291c373da7309bc26f9bc (diff)
Seperate initialization of OutputDevice instance
I have split OutputDevice::ImplInitGraphics() from OutputDevice::ImplGetGraphics(). In future, we need to further seperate out this initialization function into it's own seperate classes. Note that ImplGetGraphics still initializes if mpGraphics is not set. Change-Id: I17d4778f735aa9d03bf9b37079a9d695bf95866b Reviewed-on: https://gerrit.libreoffice.org/7777 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/outdev.cxx39
1 files changed, 34 insertions, 5 deletions
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index f721054b5898..c1f42d7ce875 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -183,7 +183,7 @@ bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGr
if( !pGraphics )
{
if( !mpGraphics )
- if( !ImplGetGraphics() )
+ if( !ImplInitGraphics() )
return false;
pGraphics = mpGraphics;
}
@@ -520,12 +520,39 @@ void OutputDevice::ReMirror( Region &rRegion ) const
}
-SalGraphics* OutputDevice::ImplGetGraphics() const
+SalGraphics* OutputDevice::ImplGetGraphics()
{
DBG_TESTSOLARMUTEX();
- if ( mpGraphics )
- return mpGraphics;
+ if ( !mpGraphics )
+ {
+ if ( !ImplInitGraphics() )
+ {
+ SAL_WARN("vcl", "No mpGraphics set");
+ }
+ }
+
+ return mpGraphics;
+}
+
+SalGraphics const *OutputDevice::ImplGetGraphics() const
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !mpGraphics )
+ {
+ if ( !ImplInitGraphics() )
+ {
+ SAL_WARN("vcl", "No mpGraphics set");
+ }
+ }
+
+ return mpGraphics;
+}
+
+bool OutputDevice::ImplInitGraphics() const
+{
+ DBG_TESTSOLARMUTEX();
mbInitLineColor = true;
mbInitFillColor = true;
@@ -534,6 +561,8 @@ SalGraphics* OutputDevice::ImplGetGraphics() const
mbInitClipRegion = true;
ImplSVData* pSVData = ImplGetSVData();
+
+ // TODO: move this out of OutputDevice and into subclasses
if ( meOutDevType == OUTDEV_WINDOW )
{
Window* pWindow = (Window*)this;
@@ -667,7 +696,7 @@ SalGraphics* OutputDevice::ImplGetGraphics() const
mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
- return mpGraphics;
+ return mpGraphics ? true : false;
}
void OutputDevice::ImplReleaseGraphics( bool bRelease )