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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 : fCacheKey(sk_atomic_inc(&gCacheCount)) | 73 : fCacheKey(sk_atomic_inc(&gCacheCount)) |
74 , fLockedRows(0) | 74 , fLockedRows(0) |
75 , fDesc(desc) | 75 , fDesc(desc) |
76 , fNumRows(desc.fHeight / desc.fRowHeight) | 76 , fNumRows(desc.fHeight / desc.fRowHeight) |
77 , fTexture(NULL) | 77 , fTexture(NULL) |
78 , fRows(SkNEW_ARRAY(AtlasRow, fNumRows)) | 78 , fRows(SkNEW_ARRAY(AtlasRow, fNumRows)) |
79 , fLRUFront(NULL) | 79 , fLRUFront(NULL) |
80 , fLRUBack(NULL) { | 80 , fLRUBack(NULL) { |
81 SkASSERT(fNumRows * fDesc.fRowHeight == fDesc.fHeight); | 81 SkASSERT(fNumRows * fDesc.fRowHeight == fDesc.fHeight); |
82 this->initLRU(); | 82 this->initLRU(); |
| 83 fNormalizedYHeight = SK_Scalar1 / fDesc.fHeight; |
83 VALIDATE; | 84 VALIDATE; |
84 } | 85 } |
85 | 86 |
86 GrTextureStripAtlas::~GrTextureStripAtlas() { | 87 GrTextureStripAtlas::~GrTextureStripAtlas() { |
87 SkDELETE_ARRAY(fRows); | 88 SkDELETE_ARRAY(fRows); |
88 } | 89 } |
89 | 90 |
90 int GrTextureStripAtlas::lockRow(const SkBitmap& data) { | 91 int GrTextureStripAtlas::lockRow(const SkBitmap& data) { |
91 VALIDATE; | 92 VALIDATE; |
92 if (0 == fLockedRows) { | 93 if (0 == fLockedRows) { |
(...skipping 244 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 SkASSERT(NULL == fTexture); | 342 SkASSERT(NULL == fTexture); |
342 } else { | 343 } else { |
343 SkASSERT(fTexture); | 344 SkASSERT(fTexture); |
344 } | 345 } |
345 } | 346 } |
346 #endif | 347 #endif |
OLD | NEW |