| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // If the bitmap is mutable, we need to do a deep copy, since the | 258 // If the bitmap is mutable, we need to do a deep copy, since the |
| 259 // caller may modify it afterwards. | 259 // caller may modify it afterwards. |
| 260 if (originalBitmap.isImmutable()) { | 260 if (originalBitmap.isImmutable()) { |
| 261 copiedBitmap = originalBitmap; | 261 copiedBitmap = originalBitmap; |
| 262 // TODO if we have the pixel ref in the heap we could pass it here to avoid a po
tential deep copy | 262 // TODO if we have the pixel ref in the heap we could pass it here to avoid a po
tential deep copy |
| 263 // else if (sharedPixelRef != NULL) { | 263 // else if (sharedPixelRef != NULL) { |
| 264 // copiedBitmap = orig; | 264 // copiedBitmap = orig; |
| 265 // copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset
()); | 265 // copiedBitmap.setPixelRef(sharedPixelRef, originalBitmap.pixelRefOffset
()); |
| 266 } else if (originalBitmap.empty()) { | 266 } else if (originalBitmap.empty()) { |
| 267 copiedBitmap.reset(); | 267 copiedBitmap.reset(); |
| 268 } else if (!originalBitmap.deepCopyTo(&copiedBitmap, originalBitmap.config()
)) { | 268 } else if (!originalBitmap.deepCopyTo(&copiedBitmap)) { |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 copiedBitmap.setImmutable(); | 271 copiedBitmap.setImmutable(); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) { | 275 int SkBitmapHeap::removeEntryFromLookupTable(LookupEntry* entry) { |
| 276 // remove the bitmap index for the deleted entry | 276 // remove the bitmap index for the deleted entry |
| 277 SkDEBUGCODE(int count = fLookupTable.count();) | 277 SkDEBUGCODE(int count = fLookupTable.count();) |
| 278 int index = this->findInLookupTable(*entry, NULL); | 278 int index = this->findInLookupTable(*entry, NULL); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 for (int i = 0; i < fDeferredEntries.count(); i++) { | 399 for (int i = 0; i < fDeferredEntries.count(); i++) { |
| 400 SkASSERT(fOwnerCount != IGNORE_OWNERS); | 400 SkASSERT(fOwnerCount != IGNORE_OWNERS); |
| 401 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); | 401 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); |
| 402 SkASSERT(heapEntry != NULL); | 402 SkASSERT(heapEntry != NULL); |
| 403 heapEntry->addReferences(fOwnerCount); | 403 heapEntry->addReferences(fOwnerCount); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 fDeferAddingOwners = false; | 406 fDeferAddingOwners = false; |
| 407 fDeferredEntries.reset(); | 407 fDeferredEntries.reset(); |
| 408 } | 408 } |
| OLD | NEW |