summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-21 21:22:59 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-21 21:24:27 +0000
commitae1c7443a8411569fbdbf9b188b4715b86b969e4 (patch)
treeac91c4f032c3d89b3fa0919f76ede498c92524e8
parentf22d153a07231f2d41c7be9ba0e6b7ce963a0762 (diff)
avoid the same thing ever happening in the vcl cairo text renderer
Change-Id: I6cc9694b14366f022f1cef440d03ac4a1be94c4a
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 5434ddbe40bf..bf1297e88021 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -199,6 +199,13 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout )
if (cairo_glyphs.empty())
return;
+ ServerFont& rFont = rLayout.GetServerFont();
+ const FontSelectPattern& rFSD = rFont.GetFontSelData();
+ int nHeight = rFSD.mnHeight;
+ int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight;
+ if (nWidth == 0 || nHeight == 0)
+ return;
+
/*
* It might be ideal to cache surface and cairo context between calls and
* only destroy it when the drawable changes, but to do that we need to at
@@ -227,8 +234,6 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout )
SALCOLOR_GREEN(mnTextColor)/255.0,
SALCOLOR_BLUE(mnTextColor)/255.0);
- ServerFont& rFont = rLayout.GetServerFont();
-
FT_Face aFace = rFont.GetFtFace();
CairoFontsCache::CacheId aId;
aId.maFace = aFace;
@@ -236,9 +241,6 @@ void CairoTextRender::DrawServerFontLayout( const ServerFontLayout& rLayout )
aId.mbEmbolden = rFont.NeedsArtificialBold();
cairo_matrix_t m;
- const FontSelectPattern& rFSD = rFont.GetFontSelData();
- int nHeight = rFSD.mnHeight;
- int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight;
std::vector<int>::const_iterator aEnd = glyph_extrarotation.end();
std::vector<int>::const_iterator aStart = glyph_extrarotation.begin();