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

Side by Side Diff: src/gpu/effects/GrTextureStripAtlas.cpp

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 years, 7 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/effects/GrConfigConversionEffect.cpp ('k') | src/image/SkSurface_Gpu.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 2012 Google Inc. 3 * Copyright 2012 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 "GrTextureStripAtlas.h" 9 #include "GrTextureStripAtlas.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 texDesc.fWidth = fDesc.fWidth; 197 texDesc.fWidth = fDesc.fWidth;
198 texDesc.fHeight = fDesc.fHeight; 198 texDesc.fHeight = fDesc.fHeight;
199 texDesc.fConfig = fDesc.fConfig; 199 texDesc.fConfig = fDesc.fConfig;
200 200
201 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 201 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
202 GrUniqueKey key; 202 GrUniqueKey key;
203 GrUniqueKey::Builder builder(&key, kDomain, 1); 203 GrUniqueKey::Builder builder(&key, kDomain, 1);
204 builder[0] = static_cast<uint32_t>(fCacheKey); 204 builder[0] = static_cast<uint32_t>(fCacheKey);
205 builder.finish(); 205 builder.finish();
206 206
207 fTexture = fDesc.fContext->findAndRefCachedTexture(key); 207 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k ey);
208 if (NULL == fTexture) { 208 if (NULL == fTexture) {
209 fTexture = fDesc.fContext->createTexture(texDesc, true, NULL, 0); 209 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, tru e, NULL, 0);
210 if (!fTexture) { 210 if (!fTexture) {
211 return; 211 return;
212 } 212 }
213 fDesc.fContext->addResourceToCache(key, fTexture); 213 fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, fTextur e);
214 // This is a new texture, so all of our cache info is now invalid 214 // This is a new texture, so all of our cache info is now invalid
215 this->initLRU(); 215 this->initLRU();
216 fKeyTable.rewind(); 216 fKeyTable.rewind();
217 } 217 }
218 SkASSERT(fTexture); 218 SkASSERT(fTexture);
219 } 219 }
220 220
221 void GrTextureStripAtlas::unlockTexture() { 221 void GrTextureStripAtlas::unlockTexture() {
222 SkASSERT(fTexture && 0 == fLockedRows); 222 SkASSERT(fTexture && 0 == fLockedRows);
223 fTexture->unref(); 223 fTexture->unref();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 // If we have locked rows, we should have a locked texture, otherwise 345 // If we have locked rows, we should have a locked texture, otherwise
346 // it should be unlocked 346 // it should be unlocked
347 if (fLockedRows == 0) { 347 if (fLockedRows == 0) {
348 SkASSERT(NULL == fTexture); 348 SkASSERT(NULL == fTexture);
349 } else { 349 } else {
350 SkASSERT(fTexture); 350 SkASSERT(fTexture);
351 } 351 }
352 } 352 }
353 #endif 353 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConfigConversionEffect.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698