From 98029c825b9234e6b90721d910cc180885fcab1d Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 17 Jun 2011 15:47:07 -0700 Subject: Fix rendering issue with paths when the stroke width is 0 Change-Id: I5d8ac23dc69e9e17df4ef6b5195186b5207e2524 --- libs/hwui/ShapeCache.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/hwui/ShapeCache.h') diff --git a/libs/hwui/ShapeCache.h b/libs/hwui/ShapeCache.h index b5cc29c9a691..b048469a3fec 100644 --- a/libs/hwui/ShapeCache.h +++ b/libs/hwui/ShapeCache.h @@ -537,15 +537,16 @@ PathTexture* ShapeCache::addTexture(const Entry& entry, const SkPath *pat const float pathWidth = fmax(bounds.width(), 1.0f); const float pathHeight = fmax(bounds.height(), 1.0f); - if (pathWidth > mMaxTextureSize || pathHeight > mMaxTextureSize) { - LOGW("Shape %s too large to be rendered into a texture", mName); - return NULL; - } + const float offset = fmax(paint->getStrokeWidth(), 1.0f) * 1.5f; - const float offset = paint->getStrokeWidth() * 1.5f; const uint32_t width = uint32_t(pathWidth + offset * 2.0 + 0.5); const uint32_t height = uint32_t(pathHeight + offset * 2.0 + 0.5); + if (width > mMaxTextureSize || height > mMaxTextureSize) { + LOGW("Shape %s too large to be rendered into a texture", mName); + return NULL; + } + const uint32_t size = width * height; // Don't even try to cache a bitmap that's bigger than the cache if (size < mMaxSize) { -- cgit v1.2.3-59-g8ed1b