OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 : fBitmap(bitmap) | 172 : fBitmap(bitmap) |
173 , fGenID(genID) | 173 , fGenID(genID) |
174 , fBytesAllocated(0) | 174 , fBytesAllocated(0) |
175 , fMoreRecentlyUsed(NULL) | 175 , fMoreRecentlyUsed(NULL) |
176 , fLessRecentlyUsed(NULL) | 176 , fLessRecentlyUsed(NULL) |
177 , fToBeDrawnCount(toBeDrawnCount) | 177 , fToBeDrawnCount(toBeDrawnCount) |
178 {} | 178 {} |
179 | 179 |
180 ~BitmapInfo() { | 180 ~BitmapInfo() { |
181 SkASSERT(0 == fToBeDrawnCount); | 181 SkASSERT(0 == fToBeDrawnCount); |
182 SkDELETE(fBitmap); | 182 delete fBitmap; |
183 } | 183 } |
184 | 184 |
185 void addDraws(int drawsToAdd) { | 185 void addDraws(int drawsToAdd) { |
186 if (0 == fToBeDrawnCount) { | 186 if (0 == fToBeDrawnCount) { |
187 // The readers will only ever decrement the count, so once the | 187 // The readers will only ever decrement the count, so once the |
188 // count is zero, the writer will be the only one modifying it, | 188 // count is zero, the writer will be the only one modifying it, |
189 // so it does not need to be an atomic operation. | 189 // so it does not need to be an atomic operation. |
190 fToBeDrawnCount = drawsToAdd; | 190 fToBeDrawnCount = drawsToAdd; |
191 } else { | 191 } else { |
192 sk_atomic_add(&fToBeDrawnCount, drawsToAdd); | 192 sk_atomic_add(&fToBeDrawnCount, drawsToAdd); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK)); | 305 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK)); |
306 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK)); | 306 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK)); |
307 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK)); | 307 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK)); |
308 | 308 |
309 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | | 309 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | |
310 (flags << PAINTOPS_DATA_BITS) | | 310 (flags << PAINTOPS_DATA_BITS) | |
311 data; | 311 data; |
312 } | 312 } |
313 | 313 |
314 #endif | 314 #endif |
OLD | NEW |