diff options
author | 2010-10-18 23:29:36 +0000 | |
---|---|---|
committer | 2010-10-18 23:29:36 +0000 | |
commit | 17f694b0386ae42e66e76ffa19a0dabbc2191c62 (patch) | |
tree | 20066ca9cbc731c1ef041bd709977b3d5497fef3 | |
parent | 6b9de8cb93f2aa970f2d407381c3768ae505f710 (diff) |
Clamp the maximum size of glyph width we will attempt to render.
Review URL: http://codereview.appspot.com/2519045
git-svn-id: http://skia.googlecode.com/svn/trunk@607 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | include/core/SkScalerContext.h | 2 | ||||
-rw-r--r-- | src/core/SkGlyphCache.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index 7cb0d2f81b..ab43b14011 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -31,6 +31,8 @@ class SkRasterizer; // needs to be != to any valid SkMask::Format #define MASK_FORMAT_JUST_ADVANCE (0xFF) +#define kMaxGlyphWidth (1<<13) + struct SkGlyph { void* fImage; SkPath* fPath; diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index cfd355c57a..c744dfe540 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -306,7 +306,7 @@ SkGlyph* SkGlyphCache::lookupMetrics(uint32_t id, MetricsType mtype) { } const void* SkGlyphCache::findImage(const SkGlyph& glyph) { - if (glyph.fWidth) { + if (glyph.fWidth > 0 && glyph.fWidth < kMaxGlyphWidth) { if (glyph.fImage == NULL) { size_t size = glyph.computeImageSize(); const_cast<SkGlyph&>(glyph).fImage = fImageAlloc.alloc(size, |