| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void GrTextureStripAtlas::initLRU() { | 222 void GrTextureStripAtlas::initLRU() { |
| 223 fLRUFront = NULL; | 223 fLRUFront = NULL; |
| 224 fLRUBack = NULL; | 224 fLRUBack = NULL; |
| 225 // Initially all the rows are in the LRU list | 225 // Initially all the rows are in the LRU list |
| 226 for (int i = 0; i < fNumRows; ++i) { | 226 for (int i = 0; i < fNumRows; ++i) { |
| 227 fRows[i].fKey = kEmptyAtlasRowKey; | 227 fRows[i].fKey = kEmptyAtlasRowKey; |
| 228 fRows[i].fNext = NULL; | 228 fRows[i].fNext = NULL; |
| 229 fRows[i].fPrev = NULL; | 229 fRows[i].fPrev = NULL; |
| 230 this->appendLRU(fRows + i); | 230 this->appendLRU(fRows + i); |
| 231 } | 231 } |
| 232 GrAssert(NULL == fLRUFront->fPrev && NULL == fLRUBack->fNext); | 232 GrAssert(NULL == fLRUFront || NULL == fLRUFront->fPrev); |
| 233 GrAssert(NULL == fLRUBack || NULL == fLRUBack->fNext); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void GrTextureStripAtlas::appendLRU(AtlasRow* row) { | 236 void GrTextureStripAtlas::appendLRU(AtlasRow* row) { |
| 236 GrAssert(NULL == row->fPrev && NULL == row->fNext); | 237 GrAssert(NULL == row->fPrev && NULL == row->fNext); |
| 237 if (NULL == fLRUFront && NULL == fLRUBack) { | 238 if (NULL == fLRUFront && NULL == fLRUBack) { |
| 238 fLRUFront = row; | 239 fLRUFront = row; |
| 239 fLRUBack = row; | 240 fLRUBack = row; |
| 240 } else { | 241 } else { |
| 241 row->fPrev = fLRUBack; | 242 row->fPrev = fLRUBack; |
| 242 fLRUBack->fNext = row; | 243 fLRUBack->fNext = row; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 // If we have locked rows, we should have a locked texture, otherwise | 339 // If we have locked rows, we should have a locked texture, otherwise |
| 339 // it should be unlocked | 340 // it should be unlocked |
| 340 if (fLockedRows == 0) { | 341 if (fLockedRows == 0) { |
| 341 GrAssert(NULL == fTexture); | 342 GrAssert(NULL == fTexture); |
| 342 } else { | 343 } else { |
| 343 GrAssert(NULL != fTexture); | 344 GrAssert(NULL != fTexture); |
| 344 } | 345 } |
| 345 } | 346 } |
| 346 #endif | 347 #endif |
| OLD | NEW |