Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/core/SkBitmapHeap.cpp

Issue 719113004: Followup: remove unnecessary SkTRefArray (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: count Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmapHeap.h ('k') | src/core/SkPictureData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 } 105 }
106 fBytesAllocated -= (fStorage.count() * sizeof(SkBitmapHeapEntry)); 106 fBytesAllocated -= (fStorage.count() * sizeof(SkBitmapHeapEntry));
107 ) 107 )
108 SkASSERT(0 == fBytesAllocated); 108 SkASSERT(0 == fBytesAllocated);
109 fStorage.deleteAll(); 109 fStorage.deleteAll();
110 SkSafeUnref(fExternalStorage); 110 SkSafeUnref(fExternalStorage);
111 fLookupTable.deleteAll(); 111 fLookupTable.deleteAll();
112 } 112 }
113 113
114 SkTRefArray<SkBitmap>* SkBitmapHeap::extractBitmaps() const {
115 const int size = fStorage.count();
116 SkTRefArray<SkBitmap>* array = NULL;
117 if (size > 0) {
118 array = SkTRefArray<SkBitmap>::Create(size);
119 for (int i = 0; i < size; i++) {
120 // make a shallow copy of the bitmap
121 array->writableAt(i) = fStorage[i]->fBitmap;
122 }
123 }
124 return array;
125 }
126
127 void SkBitmapHeap::removeFromLRU(SkBitmapHeap::LookupEntry* entry) { 114 void SkBitmapHeap::removeFromLRU(SkBitmapHeap::LookupEntry* entry) {
128 if (fMostRecentlyUsed == entry) { 115 if (fMostRecentlyUsed == entry) {
129 fMostRecentlyUsed = entry->fLessRecentlyUsed; 116 fMostRecentlyUsed = entry->fLessRecentlyUsed;
130 if (NULL == fMostRecentlyUsed) { 117 if (NULL == fMostRecentlyUsed) {
131 SkASSERT(fLeastRecentlyUsed == entry); 118 SkASSERT(fLeastRecentlyUsed == entry);
132 fLeastRecentlyUsed = NULL; 119 fLeastRecentlyUsed = NULL;
133 } else { 120 } else {
134 fMostRecentlyUsed->fMoreRecentlyUsed = NULL; 121 fMostRecentlyUsed->fMoreRecentlyUsed = NULL;
135 } 122 }
136 } else { 123 } else {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 for (int i = 0; i < fDeferredEntries.count(); i++) { 386 for (int i = 0; i < fDeferredEntries.count(); i++) {
400 SkASSERT(fOwnerCount != IGNORE_OWNERS); 387 SkASSERT(fOwnerCount != IGNORE_OWNERS);
401 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]); 388 SkBitmapHeapEntry* heapEntry = this->getEntry(fDeferredEntries[i]);
402 SkASSERT(heapEntry != NULL); 389 SkASSERT(heapEntry != NULL);
403 heapEntry->addReferences(fOwnerCount); 390 heapEntry->addReferences(fOwnerCount);
404 } 391 }
405 } 392 }
406 fDeferAddingOwners = false; 393 fDeferAddingOwners = false;
407 fDeferredEntries.reset(); 394 fDeferredEntries.reset();
408 } 395 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapHeap.h ('k') | src/core/SkPictureData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698