[Libreoffice-commits] core.git: include/vcl vcl/source
Chris Sherlock
chris.sherlock79 at gmail.com
Mon Mar 10 04:54:04 PDT 2014
include/vcl/outdev.hxx | 11 ++++++++++-
vcl/source/gdi/outdev.cxx | 39 ++++++++++++++++++++++++++++++++++-----
2 files changed, 44 insertions(+), 6 deletions(-)
New commits:
commit 9d64cdc4cf2122bcbcf1fb670bd1103d09bbc7b3
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Sun Feb 2 23:51:27 2014 +1100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 9188568..9b012cc 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -359,9 +359,18 @@ public:
/** Get the graphic context that the output device uses to draw on.
+ If no graphics device exists, then initialize it.
+
@returns SalGraphics instance.
*/
- SAL_DLLPRIVATE SalGraphics* ImplGetGraphics() const;
+ SAL_DLLPRIVATE SalGraphics const *ImplGetGraphics() const;
+ SAL_DLLPRIVATE SalGraphics* ImplGetGraphics();
+
+ /** Initialize the graphics device that the output device uses to draw on.
+
+ @returns true if was able to initialize the graphics device, false otherwise.
+ */
+ SAL_DLLPRIVATE bool ImplInitGraphics() const;
/** Release the graphics device, and remove it from the graphics device
list.
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index f721054..c1f42d7 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 )
More information about the Libreoffice-commits
mailing list