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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 builder[0] = static_cast<uint32_t>(fCacheKey); | 202 builder[0] = static_cast<uint32_t>(fCacheKey); |
203 builder.finish(); | 203 builder.finish(); |
204 | 204 |
205 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k
ey); | 205 fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(k
ey); |
206 if (nullptr == fTexture) { | 206 if (nullptr == fTexture) { |
207 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, SkB
udgeted::kYes, | 207 fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, SkB
udgeted::kYes, |
208 nullptr, 0); | 208 nullptr, 0); |
209 if (!fTexture) { | 209 if (!fTexture) { |
210 return; | 210 return; |
211 } | 211 } |
| 212 |
| 213 // We will be issuing writes to the surface using kDontFlush_PixelOpsFla
g, so we |
| 214 // need to make sure any existing IO is flushed |
| 215 fDesc.fContext->flushSurfaceIO(fTexture); |
212 fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, fTextur
e); | 216 fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, fTextur
e); |
213 // This is a new texture, so all of our cache info is now invalid | 217 // This is a new texture, so all of our cache info is now invalid |
214 this->initLRU(); | 218 this->initLRU(); |
215 fKeyTable.rewind(); | 219 fKeyTable.rewind(); |
216 } | 220 } |
217 SkASSERT(fTexture); | 221 SkASSERT(fTexture); |
218 } | 222 } |
219 | 223 |
220 void GrTextureStripAtlas::unlockTexture() { | 224 void GrTextureStripAtlas::unlockTexture() { |
221 SkASSERT(fTexture && 0 == fLockedRows); | 225 SkASSERT(fTexture && 0 == fLockedRows); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 347 |
344 // If we have locked rows, we should have a locked texture, otherwise | 348 // If we have locked rows, we should have a locked texture, otherwise |
345 // it should be unlocked | 349 // it should be unlocked |
346 if (fLockedRows == 0) { | 350 if (fLockedRows == 0) { |
347 SkASSERT(nullptr == fTexture); | 351 SkASSERT(nullptr == fTexture); |
348 } else { | 352 } else { |
349 SkASSERT(fTexture); | 353 SkASSERT(fTexture); |
350 } | 354 } |
351 } | 355 } |
352 #endif | 356 #endif |
OLD | NEW |