From 089130c24e29dd0ffc53f0396acdc8f0b50dabd4 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 12 Dec 2011 21:52:18 +0000 Subject: [PATCH] check for empty glyph run and exit early if so. git-svn-id: http://skia.googlecode.com/svn/trunk@2858 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/device/xps/SkXPSDevice.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index f9d8254..cce7323 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -2264,7 +2264,12 @@ void SkXPSDevice::drawText(const SkDraw& d, text_draw_init(paint, text, byteLen, *typeface->glyphsUsed, myDraw, procs); myDraw.drawText(static_cast(text), byteLen, x, y, paint); - + + // SkDraw may have clipped out the glyphs, so we need to check + if (procs.xpsGlyphs.count() == 0) { + return; + } + XPS_POINT origin = { procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, @@ -2312,6 +2317,11 @@ void SkXPSDevice::drawPosText(const SkDraw& d, pos, constY, scalarsPerPos, paint); + // SkDraw may have clipped out the glyphs, so we need to check + if (procs.xpsGlyphs.count() == 0) { + return; + } + XPS_POINT origin = { procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, -- 2.7.4