OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTextureStripAtlas.h" | 8 #include "GrTextureStripAtlas.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 texDesc.fConfig = fDesc.fConfig; | 196 texDesc.fConfig = fDesc.fConfig; |
197 | 197 |
198 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 198 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
199 GrUniqueKey key; | 199 GrUniqueKey key; |
200 GrUniqueKey::Builder builder(&key, kDomain, 1); | 200 GrUniqueKey::Builder builder(&key, kDomain, 1); |
201 builder[0] = static_cast<uint32_t>(fCacheKey); | 201 builder[0] = static_cast<uint32_t>(fCacheKey); |
202 builder.finish(); | 202 builder.finish(); |
203 | 203 |
204 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k
ey); | 204 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k
ey); |
205 if (nullptr == fTexture) { | 205 if (nullptr == fTexture) { |
206 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, tru
e, nullptr, 0); | 206 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, SkB
udgeted::kYes, |
| 207 nullptr, 0); |
207 if (!fTexture) { | 208 if (!fTexture) { |
208 return; | 209 return; |
209 } | 210 } |
210 fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, fTextur
e); | 211 fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, fTextur
e); |
211 // This is a new texture, so all of our cache info is now invalid | 212 // This is a new texture, so all of our cache info is now invalid |
212 this->initLRU(); | 213 this->initLRU(); |
213 fKeyTable.rewind(); | 214 fKeyTable.rewind(); |
214 } | 215 } |
215 SkASSERT(fTexture); | 216 SkASSERT(fTexture); |
216 } | 217 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 342 |
342 // If we have locked rows, we should have a locked texture, otherwise | 343 // If we have locked rows, we should have a locked texture, otherwise |
343 // it should be unlocked | 344 // it should be unlocked |
344 if (fLockedRows == 0) { | 345 if (fLockedRows == 0) { |
345 SkASSERT(nullptr == fTexture); | 346 SkASSERT(nullptr == fTexture); |
346 } else { | 347 } else { |
347 SkASSERT(fTexture); | 348 SkASSERT(fTexture); |
348 } | 349 } |
349 } | 350 } |
350 #endif | 351 #endif |
OLD | NEW |