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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 row->fKey = key; | 149 row->fKey = key; |
150 row->fLocks = 1; | 150 row->fLocks = 1; |
151 fKeyTable.insert(index, 1, &row); | 151 fKeyTable.insert(index, 1, &row); |
152 rowNumber = static_cast<int>(row - fRows); | 152 rowNumber = static_cast<int>(row - fRows); |
153 | 153 |
154 SkAutoLockPixels lock(data); | 154 SkAutoLockPixels lock(data); |
155 | 155 |
156 // Pass in the kDontFlush flag, since we know we're writing to a part of
this texture | 156 // Pass in the kDontFlush flag, since we know we're writing to a part of
this texture |
157 // that is not currently in use | 157 // that is not currently in use |
158 fDesc.fContext->writeTexturePixels(fTexture, | 158 fTexture->writePixels(0, rowNumber * fDesc.fRowHeight, |
159 0, rowNumber * fDesc.fRowHeight, | 159 fDesc.fWidth, fDesc.fRowHeight, |
160 fDesc.fWidth, fDesc.fRowHeight, | 160 SkImageInfo2GrPixelConfig(data.info()), |
161 SkImageInfo2GrPixelConfig(data.info()
), | 161 data.getPixels(), |
162 data.getPixels(), | 162 data.rowBytes(), |
163 data.rowBytes(), | 163 GrContext::kDontFlush_PixelOpsFlag); |
164 GrContext::kDontFlush_PixelOpsFlag); | |
165 } | 164 } |
166 | 165 |
167 SkASSERT(rowNumber >= 0); | 166 SkASSERT(rowNumber >= 0); |
168 VALIDATE; | 167 VALIDATE; |
169 return rowNumber; | 168 return rowNumber; |
170 } | 169 } |
171 | 170 |
172 void GrTextureStripAtlas::unlockRow(int row) { | 171 void GrTextureStripAtlas::unlockRow(int row) { |
173 VALIDATE; | 172 VALIDATE; |
174 --fRows[row].fLocks; | 173 --fRows[row].fLocks; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 337 |
339 // If we have locked rows, we should have a locked texture, otherwise | 338 // If we have locked rows, we should have a locked texture, otherwise |
340 // it should be unlocked | 339 // it should be unlocked |
341 if (fLockedRows == 0) { | 340 if (fLockedRows == 0) { |
342 SkASSERT(NULL == fTexture); | 341 SkASSERT(NULL == fTexture); |
343 } else { | 342 } else { |
344 SkASSERT(fTexture); | 343 SkASSERT(fTexture); |
345 } | 344 } |
346 } | 345 } |
347 #endif | 346 #endif |
OLD | NEW |