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 "SkBitmapHeap.h" | 9 #include "SkBitmapHeap.h" |
10 | 10 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // If the bitmap is mutable, we need to do a deep copy, since the | 252 // If the bitmap is mutable, we need to do a deep copy, since the |
253 // caller may modify it afterwards. | 253 // caller may modify it afterwards. |
254 if (originalBitmap.isImmutable()) { | 254 if (originalBitmap.isImmutable()) { |
255 copiedBitmap = originalBitmap; | 255 copiedBitmap = originalBitmap; |
256 // TODO if we have the pixel ref in the heap we could pass it here to avoid a po
tential deep copy | 256 // TODO if we have the pixel ref in the heap we could pass it here to avoid a po
tential deep copy |
257 // else if (sharedPixelRef != NULL) { | 257 // else if (sharedPixelRef != NULL) { |
258 // copiedBitmap = orig; | 258 // copiedBitmap = orig; |
259 // copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset
()); | 259 // copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset
()); |
260 } else if (originalBitmap.empty()) { | 260 } else if (originalBitmap.empty()) { |
261 copiedBitmap.reset(); | 261 copiedBitmap.reset(); |
262 } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.getConfi
g())) { | 262 } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.config()
)) { |
263 return false; | 263 return false; |
264 } | 264 } |
265 copiedBitmap.setImmutable(); | 265 copiedBitmap.setImmutable(); |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) { | 269 int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) { |
270 // remove the bitmap index for the deleted entry | 270 // remove the bitmap index for the deleted entry |
271 SkDEBUGCODE(int count = fLookupTable.count();) | 271 SkDEBUGCODE(int count = fLookupTable.count();) |
272 int index = this->findInLookupTable(*entry, NULL); | 272 int index = this->findInLookupTable(*entry, NULL); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 for (int i = 0; i < fDeferredEntries.count(); i++) { | 393 for (int i = 0; i < fDeferredEntries.count(); i++) { |
394 SkASSERT(fOwnerCount != IGNORE_OWNERS); | 394 SkASSERT(fOwnerCount != IGNORE_OWNERS); |
395 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); | 395 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); |
396 SkASSERT(heapEntry != NULL); | 396 SkASSERT(heapEntry != NULL); |
397 heapEntry->addReferences(fOwnerCount); | 397 heapEntry->addReferences(fOwnerCount); |
398 } | 398 } |
399 } | 399 } |
400 fDeferAddingOwners = false; | 400 fDeferAddingOwners = false; |
401 fDeferredEntries.reset(); | 401 fDeferredEntries.reset(); |
402 } | 402 } |
OLD | NEW |