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

Side by Side Diff: src/gpu/GrGpuResourceCacheAccess.h

Issue 864343005: Revert of make getContentKey() available in GrGpuResource public interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrResourceCache2.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef GrGpuResourceCacheAccess_DEFINED 9 #ifndef GrGpuResourceCacheAccess_DEFINED
10 #define GrGpuResourceCacheAccess_DEFINED 10 #define GrGpuResourceCacheAccess_DEFINED
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 bool setContentKey(const GrContentKey& contentKey) { 27 bool setContentKey(const GrContentKey& contentKey) {
28 return fResource->setContentKey(contentKey); 28 return fResource->setContentKey(contentKey);
29 } 29 }
30 30
31 /** 31 /**
32 * Is the resource currently cached as scratch? This means it is cached, has a valid scratch 32 * Is the resource currently cached as scratch? This means it is cached, has a valid scratch
33 * key, and does not have a content key. 33 * key, and does not have a content key.
34 */ 34 */
35 bool isScratch() const { 35 bool isScratch() const {
36 return !fResource->getContentKey().isValid() && fResource->fScratchKey.i sValid() && 36 return !this->getContentKey().isValid() && fResource->fScratchKey.isVali d() &&
37 this->isBudgeted(); 37 this->isBudgeted();
38 } 38 }
39 39
40 /** 40 /**
41 * If this resource can be used as a scratch resource this returns a valid s cratch key. 41 * If this resource can be used as a scratch resource this returns a valid s cratch key.
42 * Otherwise it returns a key for which isNullScratch is true. The resource may currently be 42 * Otherwise it returns a key for which isNullScratch is true. The resource may currently be
43 * used as a content resource rather than scratch. Check isScratch(). 43 * used as a content resource rather than scratch. Check isScratch().
44 */ 44 */
45 const GrScratchKey& getScratchKey() const { return fResource->fScratchKey; } 45 const GrScratchKey& getScratchKey() const { return fResource->fScratchKey; }
46 46
47 /** 47 /**
48 * If the resource has a scratch key, the key will be removed. Since scratch keys are installed 48 * If the resource has a scratch key, the key will be removed. Since scratch keys are installed
49 * at resource creation time, this means the resource will never again be us ed as scratch. 49 * at resource creation time, this means the resource will never again be us ed as scratch.
50 */ 50 */
51 void removeScratchKey() const { fResource->removeScratchKey(); } 51 void removeScratchKey() const { fResource->removeScratchKey(); }
52 52
53 /** 53 /**
54 * If the resource is currently cached by a content key, the key is returned , otherwise NULL.
55 */
56 const GrContentKey& getContentKey() const { return fResource->fContentKey; }
57
58 /**
54 * Is the resource object wrapping an externally allocated GPU resource? 59 * Is the resource object wrapping an externally allocated GPU resource?
55 */ 60 */
56 bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResour ce->fLifeCycle; } 61 bool isWrapped() const { return GrGpuResource::kWrapped_LifeCycle == fResour ce->fLifeCycle; }
57 62
58 /** 63 /**
59 * Does the resource count against the resource budget? 64 * Does the resource count against the resource budget?
60 */ 65 */
61 bool isBudgeted() const { 66 bool isBudgeted() const {
62 bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle; 67 bool ret = GrGpuResource::kCached_LifeCycle == fResource->fLifeCycle;
63 SkASSERT(ret || !fResource->getContentKey().isValid()); 68 SkASSERT(ret || !this->getContentKey().isValid());
64 return ret; 69 return ret;
65 } 70 }
66 71
67 /** 72 /**
68 * If the resource is uncached make it cached. Has no effect on resources th at are wrapped or 73 * If the resource is uncached make it cached. Has no effect on resources th at are wrapped or
69 * already cached. 74 * already cached.
70 */ 75 */
71 void makeBudgeted() { fResource->makeBudgeted(); } 76 void makeBudgeted() { fResource->makeBudgeted(); }
72 77
73 /** 78 /**
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 friend class GrGpuResource; // to construct/copy this type. 115 friend class GrGpuResource; // to construct/copy this type.
111 }; 116 };
112 117
113 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc ess(this); } 118 inline GrGpuResource::CacheAccess GrGpuResource::cacheAccess() { return CacheAcc ess(this); }
114 119
115 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const { 120 inline const GrGpuResource::CacheAccess GrGpuResource::cacheAccess() const {
116 return CacheAccess(const_cast<GrGpuResource*>(this)); 121 return CacheAccess(const_cast<GrGpuResource*>(this));
117 } 122 }
118 123
119 #endif 124 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/gpu/GrResourceCache2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698