Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: src/effects/gradients/SkGradientShader.cpp

Issue 241603002: Revert of Fix memory leak in SkGradientShader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkGradientShader.cpp
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 3547fbec94f4e372c5ee3dc70e7c0bd4a03effdd..666204e0aed451ad0f236c4cb72c26a7fa7945be 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -211,7 +211,7 @@
const SkGradientShaderBase& shader, const SkBitmap& device,
const SkPaint& paint, const SkMatrix& matrix)
: INHERITED(shader, device, paint, matrix)
- , fCache(shader.refCache(getPaintAlpha()))
+ , fCache(shader.getCache(getPaintAlpha()))
{
const SkMatrix& inverse = this->getTotalInverse();
@@ -558,7 +558,7 @@
* The gradient holds a cache for the most recent value of alpha. Successive
* callers with the same alpha value will share the same cache.
*/
-SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::refCache(U8CPU alpha) const {
+SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::getCache(U8CPU alpha) const {
SkAutoMutexAcquire ama(fCacheMutex);
if (!fCache || fCache->getAlpha() != alpha) {
fCache.reset(SkNEW_ARGS(GradientShaderCache, (alpha, *this)));
@@ -581,7 +581,7 @@
void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap) const {
// our caller assumes no external alpha, so we ensure that our cache is
// built with 0xFF
- SkAutoTUnref<GradientShaderCache> cache(this->refCache(0xFF));
+ GradientShaderCache* cache = this->getCache(0xFF);
// don't have a way to put the mapper into our cache-key yet
if (fMapper) {
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698