Kaydet (Commit) 9d64cdc4 authored tarafından Chris Sherlock's avatar Chris Sherlock Kaydeden (comit) Caolán McNamara

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/7777Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 4a1bb120
......@@ -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.
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment