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

Side by Side Diff: src/core/SkBitmapProvider.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 | « gm/image_pict.cpp ('k') | src/core/SkImageCacherator.h » ('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 "SkBitmapProvider.h" 8 #include "SkBitmapProvider.h"
9 #include "SkImage_Base.h" 9 #include "SkImage_Base.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const { 55 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const {
56 return fImage ? SkBitmapCacheDesc::Make(fImage, w, h) : SkBitmapCacheDesc::M ake(fBitmap, w, h); 56 return fImage ? SkBitmapCacheDesc::Make(fImage, w, h) : SkBitmapCacheDesc::M ake(fBitmap, w, h);
57 } 57 }
58 58
59 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const { 59 SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
60 return fImage ? SkBitmapCacheDesc::Make(fImage) : SkBitmapCacheDesc::Make(fB itmap); 60 return fImage ? SkBitmapCacheDesc::Make(fImage) : SkBitmapCacheDesc::Make(fB itmap);
61 } 61 }
62 62
63 void SkBitmapProvider::notifyAddedToCache() const { 63 void SkBitmapProvider::notifyAddedToCache() const {
64 if (fImage) { 64 if (fImage) {
65 // TODO 65 as_IB(fImage)->notifyAddedToCache();
66 } else { 66 } else {
67 fBitmap.pixelRef()->notifyAddedToCache(); 67 fBitmap.pixelRef()->notifyAddedToCache();
68 } 68 }
69 } 69 }
70 70
71 bool SkBitmapProvider::asBitmap(SkBitmap* bm) const { 71 bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
72 if (fImage) { 72 if (fImage) {
73 return as_IB(fImage)->getROPixels(bm); 73 return as_IB(fImage)->getROPixels(bm);
74 } else { 74 } else {
75 *bm = fBitmap; 75 *bm = fBitmap;
76 return true; 76 return true;
77 } 77 }
78 } 78 }
79 79
OLDNEW
« no previous file with comments | « gm/image_pict.cpp ('k') | src/core/SkImageCacherator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698