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

Side by Side Diff: src/image/SkImage_Generator.cpp

Issue 1352883004: Purge cached resources on SkImage destruction. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/image/SkImage_Base.h ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImage_Base.h" 8 #include "SkImage_Base.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 const void* SkImage_Generator::onPeekPixels(SkImageInfo* infoPtr, size_t* rowByt esPtr) const { 71 const void* SkImage_Generator::onPeekPixels(SkImageInfo* infoPtr, size_t* rowByt esPtr) const {
72 return NULL; 72 return NULL;
73 } 73 }
74 74
75 SkData* SkImage_Generator::onRefEncoded() const { 75 SkData* SkImage_Generator::onRefEncoded() const {
76 return fCache->refEncoded(); 76 return fCache->refEncoded();
77 } 77 }
78 78
79 bool SkImage_Generator::getROPixels(SkBitmap* bitmap) const { 79 bool SkImage_Generator::getROPixels(SkBitmap* bitmap) const {
80 return fCache->lockAsBitmap(bitmap); 80 return fCache->lockAsBitmap(bitmap, this);
81 } 81 }
82 82
83 GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, SkImageUsageType usag e) const { 83 GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, SkImageUsageType usag e) const {
84 return fCache->lockAsTexture(ctx, usage); 84 return fCache->lockAsTexture(ctx, usage, this);
85 } 85 }
86 86
87 SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* s ubset) { 87 SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* s ubset) {
88 SkImageCacherator* cache = SkImageCacherator::NewFromGenerator(generator, su bset); 88 SkImageCacherator* cache = SkImageCacherator::NewFromGenerator(generator, su bset);
89 if (!cache) { 89 if (!cache) {
90 return nullptr; 90 return nullptr;
91 } 91 }
92 return SkNEW_ARGS(SkImage_Generator, (cache)); 92 return SkNEW_ARGS(SkImage_Generator, (cache));
93 } 93 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Base.h ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698