diff options
author | 2013-02-01 16:41:47 +0000 | |
---|---|---|
committer | 2013-02-01 16:41:47 +0000 | |
commit | 8b2f41b606d961992c19382bd01ac832f9859480 (patch) | |
tree | 42975ed4d1d45d7a59a4ce43d55390630d4e6e34 | |
parent | d9b0f480be398cb37c447605109c419e8314cf61 (diff) |
Prevent SkPictureUtils::GatherPixelRefs from generating bitmaps from gradient
shaders.
BUG=https://code.google.com/p/chromium/issues/detail?id=173657
Review URL: https://codereview.appspot.com/7220074
git-svn-id: http://skia.googlecode.com/svn/trunk@7517 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 4ddc566dac..d8041df3ba 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp @@ -58,7 +58,11 @@ private: SkShader* shader = paint.getShader(); if (shader) { SkBitmap bm; - if (shader->asABitmap(&bm, NULL, NULL)) { + // Check whether the shader is a gradient in order to short-circuit + // call to asABitmap to prevent generation of bitmaps from + // gradient shaders, which implement asABitmap. + if (SkShader::kNone_GradientType == shader->asAGradient(NULL) && + shader->asABitmap(&bm, NULL, NULL)) { fPRSet->add(bm.pixelRef()); } } |