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

Side by Side Diff: src/core/SkPictureFlat.h

Issue 91453002: Speed up GrResourceCache add and lookup by using TDynamicHash (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | src/core/SkTDynamicHash.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #ifndef SkPictureFlat_DEFINED 8 #ifndef SkPictureFlat_DEFINED
9 #define SkPictureFlat_DEFINED 9 #define SkPictureFlat_DEFINED
10 10
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return flat; 418 return flat;
419 } 419 }
420 420
421 // findAndReturnMutableFlat gave us index (fNextIndex-1), but we'll use the old one. 421 // findAndReturnMutableFlat gave us index (fNextIndex-1), but we'll use the old one.
422 fIndexedData.remove(flat->index()); 422 fIndexedData.remove(flat->index());
423 fNextIndex--; 423 fNextIndex--;
424 flat->setIndex(found->index()); 424 flat->setIndex(found->index());
425 fIndexedData[flat->index()] = flat; 425 fIndexedData[flat->index()] = flat;
426 426
427 // findAndReturnMutableFlat already called fHash.add(), so we just clean up the old entry. 427 // findAndReturnMutableFlat already called fHash.add(), so we just clean up the old entry.
428 fHash.remove(*found); 428 fHash.remove(found);
429 fController->unalloc((void*)found); 429 fController->unalloc((void*)found);
430 SkASSERT(this->count() == oldCount); 430 SkASSERT(this->count() == oldCount);
431 431
432 *replaced = true; 432 *replaced = true;
433 return flat; 433 return flat;
434 } 434 }
435 435
436 /** 436 /**
437 * Unflatten the objects and return them in SkTRefArray, or return NULL 437 * Unflatten the objects and return them in SkTRefArray, or return NULL
438 * if there no objects. Caller takes ownership of result. 438 * if there no objects. Caller takes ownership of result.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 static void flattenRegion(SkOrderedWriteBuffer& buffer, const void* obj) { 673 static void flattenRegion(SkOrderedWriteBuffer& buffer, const void* obj) {
674 buffer.getWriter32()->writeRegion(*(SkRegion*)obj); 674 buffer.getWriter32()->writeRegion(*(SkRegion*)obj);
675 } 675 }
676 676
677 static void unflattenRegion(SkOrderedReadBuffer& buffer, void* obj) { 677 static void unflattenRegion(SkOrderedReadBuffer& buffer, void* obj) {
678 buffer.getReader32()->readRegion((SkRegion*)obj); 678 buffer.getReader32()->readRegion((SkRegion*)obj);
679 } 679 }
680 }; 680 };
681 681
682 #endif 682 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkScaledImageCache.cpp » ('j') | src/core/SkTDynamicHash.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698