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

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

Issue 1187523005: Add support for creating texture backed images where Skia will delete the texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default param to support Chrome's current callers Created 5 years, 6 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/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.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 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 #include "GrGpuResource.h" 9 #include "GrGpuResource.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 // There is no need to call our notifyAllCntsAreZero function at this point since we already 139 // There is no need to call our notifyAllCntsAreZero function at this point since we already
140 // told the cache about the state of cnts. 140 // told the cache about the state of cnts.
141 return false; 141 return false;
142 } 142 }
143 143
144 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) { 144 void GrGpuResource::setScratchKey(const GrScratchKey& scratchKey) {
145 SkASSERT(!fScratchKey.isValid()); 145 SkASSERT(!fScratchKey.isValid());
146 SkASSERT(scratchKey.isValid()); 146 SkASSERT(scratchKey.isValid());
147 // Wrapped resources can never have a scratch key. 147 // Wrapped resources can never have a scratch key.
148 if (this->isWrapped()) { 148 if (this->cacheAccess().isExternal()) {
149 return; 149 return;
150 } 150 }
151 fScratchKey = scratchKey; 151 fScratchKey = scratchKey;
152 } 152 }
153 153
154 void GrGpuResource::removeScratchKey() { 154 void GrGpuResource::removeScratchKey() {
155 if (!this->wasDestroyed() && fScratchKey.isValid()) { 155 if (!this->wasDestroyed() && fScratchKey.isValid()) {
156 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this); 156 get_resource_cache(fGpu)->resourceAccess().willRemoveScratchKey(this);
157 fScratchKey.reset(); 157 fScratchKey.reset();
158 } 158 }
(...skipping 14 matching lines...) Expand all
173 } 173 }
174 174
175 uint32_t GrGpuResource::CreateUniqueID() { 175 uint32_t GrGpuResource::CreateUniqueID() {
176 static int32_t gUniqueID = SK_InvalidUniqueID; 176 static int32_t gUniqueID = SK_InvalidUniqueID;
177 uint32_t id; 177 uint32_t id;
178 do { 178 do {
179 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 179 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
180 } while (id == SK_InvalidUniqueID); 180 } while (id == SK_InvalidUniqueID);
181 return id; 181 return id;
182 } 182 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrGpuResourceCacheAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698