summaryrefslogtreecommitdiff
path: root/vcl/headless/svpframe.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/headless/svpframe.cxx')
-rw-r--r--vcl/headless/svpframe.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index 3f79ead63783..fb7a81d08b7a 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -141,11 +141,24 @@ void SvpSalFrame::LoseFocus()
}
}
+basegfx::B2IVector SvpSalFrame::GetSurfaceFrameSize() const
+{
+ basegfx::B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight );
+ if( aFrameSize.getX() == 0 )
+ aFrameSize.setX( 1 );
+ if( aFrameSize.getY() == 0 )
+ aFrameSize.setY( 1 );
+ // Creating backing surfaces for invisible windows costs a big chunk of RAM.
+ if (Application::IsHeadlessModeEnabled())
+ aFrameSize = basegfx::B2IVector( 1, 1 );
+ return aFrameSize;
+}
+
SalGraphics* SvpSalFrame::AcquireGraphics()
{
SvpSalGraphics* pGraphics = new SvpSalGraphics();
#ifndef IOS
- pGraphics->setSurface(m_pSurface, basegfx::B2IVector(maGeometry.nWidth, maGeometry.nHeight));
+ pGraphics->setSurface(m_pSurface, GetSurfaceFrameSize());
#endif
m_aGraphics.push_back( pGraphics );
return pGraphics;
@@ -252,22 +265,13 @@ void SvpSalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth
maGeometry.nHeight = m_nMinHeight;
}
#ifndef IOS
- basegfx::B2IVector aFrameSize( maGeometry.nWidth, maGeometry.nHeight );
+ basegfx::B2IVector aFrameSize = GetSurfaceFrameSize();
if (!m_pSurface || cairo_image_surface_get_width(m_pSurface) != aFrameSize.getX() ||
cairo_image_surface_get_height(m_pSurface) != aFrameSize.getY() )
{
- if( aFrameSize.getX() == 0 )
- aFrameSize.setX( 1 );
- if( aFrameSize.getY() == 0 )
- aFrameSize.setY( 1 );
-
if (m_pSurface)
cairo_surface_destroy(m_pSurface);
- // Creating backing surfaces for invisible windows costs a big chunk of RAM.
- if (Application::IsHeadlessModeEnabled())
- aFrameSize = basegfx::B2IVector( 1, 1 );
-
m_pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
aFrameSize.getX(),
aFrameSize.getY());