| 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 17 matching lines...) Expand all Loading... |
| 28 // will be the only one able to modify it, so it does not | 28 // will be the only one able to modify it, so it does not |
| 29 // need to be an atomic operation. | 29 // need to be an atomic operation. |
| 30 fRefCount = count; | 30 fRefCount = count; |
| 31 } else { | 31 } else { |
| 32 sk_atomic_add(&fRefCount, count); | 32 sk_atomic_add(&fRefCount, count); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
| 37 | 37 |
| 38 static bool operator<(const SkIPoint& a, const SkIPoint& b) { |
| 39 return *(const int64_t*)&a < *(const int64_t*)&b; |
| 40 } |
| 41 |
| 42 static bool operator>(const SkIPoint& a, const SkIPoint& b) { |
| 43 return *(const int64_t*)&a > *(const int64_t*)&b; |
| 44 } |
| 45 |
| 38 bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a, | 46 bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a, |
| 39 const SkBitmapHeap::LookupEntry& b) { | 47 const SkBitmapHeap::LookupEntry& b) { |
| 40 if (a.fGenerationId < b.fGenerationId) { | 48 if (a.fGenerationId < b.fGenerationId) { |
| 41 return true; | 49 return true; |
| 42 } else if (a.fGenerationId > b.fGenerationId) { | 50 } else if (a.fGenerationId > b.fGenerationId) { |
| 43 return false; | 51 return false; |
| 44 } else if (a.fPixelOffset < b.fPixelOffset) { | 52 } else if (a.fPixelOrigin < b.fPixelOrigin) { |
| 45 return true; | 53 return true; |
| 46 } else if (a.fPixelOffset > b.fPixelOffset) { | 54 } else if (a.fPixelOrigin > b.fPixelOrigin) { |
| 47 return false; | 55 return false; |
| 48 } else if (a.fWidth < b.fWidth) { | 56 } else if (a.fWidth < b.fWidth) { |
| 49 return true; | 57 return true; |
| 50 } else if (a.fWidth > b.fWidth) { | 58 } else if (a.fWidth > b.fWidth) { |
| 51 return false; | 59 return false; |
| 52 } else if (a.fHeight < b.fHeight) { | 60 } else if (a.fHeight < b.fHeight) { |
| 53 return true; | 61 return true; |
| 54 } | 62 } |
| 55 return false; | 63 return false; |
| 56 } | 64 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 for (int i = 0; i < fDeferredEntries.count(); i++) { | 398 for (int i = 0; i < fDeferredEntries.count(); i++) { |
| 391 SkASSERT(fOwnerCount != IGNORE_OWNERS); | 399 SkASSERT(fOwnerCount != IGNORE_OWNERS); |
| 392 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); | 400 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); |
| 393 SkASSERT(heapEntry != NULL); | 401 SkASSERT(heapEntry != NULL); |
| 394 heapEntry->addReferences(fOwnerCount); | 402 heapEntry->addReferences(fOwnerCount); |
| 395 } | 403 } |
| 396 } | 404 } |
| 397 fDeferAddingOwners = false; | 405 fDeferAddingOwners = false; |
| 398 fDeferredEntries.reset(); | 406 fDeferredEntries.reset(); |
| 399 } | 407 } |
| OLD | NEW |