commit | 8b2f41b606d961992c19382bd01ac832f9859480 | [log] [tgz] |
---|---|---|
author | junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | Fri Feb 01 16:41:47 2013 +0000 |
committer | junov@google.com <junov@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | Fri Feb 01 16:41:47 2013 +0000 |
tree | 42975ed4d1d45d7a59a4ce43d55390630d4e6e34 | |
parent | d9b0f480be398cb37c447605109c419e8314cf61 [diff] [blame] |
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
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index 4ddc566..d8041df 100644 --- a/src/utils/SkPictureUtils.cpp +++ b/src/utils/SkPictureUtils.cpp
@@ -58,7 +58,11 @@ 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()); } }