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

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

Issue 167683006: Offer single-param version of deepCopyTo -- much easier to migrate to colortypes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/image/SkSurface_Raster.cpp » ('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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698