| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |