Index: src/core/SkBitmapHeap.cpp |
diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp |
index 48194b1eaaeba37351dddb4de84b3bbcf4663f2e..f3428db64f13039bdf025d8bb5652c44bff7a229 100644 |
--- a/src/core/SkBitmapHeap.cpp |
+++ b/src/core/SkBitmapHeap.cpp |
@@ -38,26 +38,24 @@ void SkBitmapHeapEntry::addReferences(int count) { |
/////////////////////////////////////////////////////////////////////////////// |
-int SkBitmapHeap::LookupEntry::Compare(const SkBitmapHeap::LookupEntry *a, |
- const SkBitmapHeap::LookupEntry *b) { |
- if (a->fGenerationId < b->fGenerationId) { |
- return -1; |
- } else if (a->fGenerationId > b->fGenerationId) { |
- return 1; |
- } else if (a->fPixelOffset < b->fPixelOffset) { |
- return -1; |
- } else if (a->fPixelOffset > b->fPixelOffset) { |
- return 1; |
- } else if (a->fWidth < b->fWidth) { |
- return -1; |
- } else if (a->fWidth > b->fWidth) { |
- return 1; |
- } else if (a->fHeight < b->fHeight) { |
- return -1; |
- } else if (a->fHeight > b->fHeight) { |
- return 1; |
+bool SkBitmapHeap::LookupEntry::Less(const SkBitmapHeap::LookupEntry& a, |
+ const SkBitmapHeap::LookupEntry& b) { |
+ if (a.fGenerationId < b.fGenerationId) { |
+ return true; |
+ } else if (a.fGenerationId > b.fGenerationId) { |
+ return false; |
+ } else if (a.fPixelOffset < b.fPixelOffset) { |
+ return true; |
+ } else if (a.fPixelOffset > b.fPixelOffset) { |
+ return false; |
+ } else if (a.fWidth < b.fWidth) { |
+ return true; |
+ } else if (a.fWidth > b.fWidth) { |
+ return false; |
+ } else if (a.fHeight < b.fHeight) { |
+ return true; |
} |
- return 0; |
+ return false; |
} |
/////////////////////////////////////////////////////////////////////////////// |
@@ -231,9 +229,10 @@ size_t SkBitmapHeap::freeMemoryIfPossible(size_t bytesToFree) { |
} |
int SkBitmapHeap::findInLookupTable(const LookupEntry& indexEntry, SkBitmapHeapEntry** entry) { |
- int index = SkTSearch<const LookupEntry>((const LookupEntry**)fLookupTable.begin(), |
+ int index = SkTSearch<const LookupEntry, LookupEntry::Less>( |
+ (const LookupEntry**)fLookupTable.begin(), |
fLookupTable.count(), |
- &indexEntry, sizeof(void*), LookupEntry::Compare); |
+ &indexEntry, sizeof(void*)); |
if (index < 0) { |
// insert ourselves into the bitmapIndex |