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

Side by Side Diff: src/gpu/GrGpuResource.cpp

Issue 639873002: Use presence of a content key as non-scratch indicator (Closed) Base URL: https://skia.googlesource.com/skia.git@pp
Patch Set: rebase again Created 6 years, 2 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/gpu/GrContext.cpp ('k') | src/gpu/GrResourceCache.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 9
10 #include "GrGpuResource.h" 10 #include "GrGpuResource.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 } 85 }
86 86
87 void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) { 87 void GrGpuResource::setScratchKey(const GrResourceKey& scratchKey) {
88 SkASSERT(fScratchKey.isNullScratch()); 88 SkASSERT(fScratchKey.isNullScratch());
89 SkASSERT(scratchKey.isScratch()); 89 SkASSERT(scratchKey.isScratch());
90 SkASSERT(!scratchKey.isNullScratch()); 90 SkASSERT(!scratchKey.isNullScratch());
91 fScratchKey = scratchKey; 91 fScratchKey = scratchKey;
92 } 92 }
93 93
94 const GrResourceKey* GrGpuResource::getContentKey() const {
95 if (fCacheEntry && !fCacheEntry->key().isScratch()) {
96 return &fCacheEntry->key();
97 }
98 return NULL;
99 }
100
101 bool GrGpuResource::isScratch() const {
102 // Currently scratch resources have a cache entry in GrResourceCache with a scratch key.
103 return NULL != fCacheEntry && fCacheEntry->key().isScratch();
104 }
105
94 uint32_t GrGpuResource::CreateUniqueID() { 106 uint32_t GrGpuResource::CreateUniqueID() {
95 static int32_t gUniqueID = SK_InvalidUniqueID; 107 static int32_t gUniqueID = SK_InvalidUniqueID;
96 uint32_t id; 108 uint32_t id;
97 do { 109 do {
98 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 110 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
99 } while (id == SK_InvalidUniqueID); 111 } while (id == SK_InvalidUniqueID);
100 return id; 112 return id;
101 } 113 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698