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

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

Issue 190923002: Add deduping capability to SkPathHeap (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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/SkPathHeap.cpp ('k') | tests/CanvasTest.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkTSearch.h" 9 #include "SkTSearch.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 1637
1638 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) { 1638 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) {
1639 int index = flatPaint ? flatPaint->index() : 0; 1639 int index = flatPaint ? flatPaint->index() : 0;
1640 this->addInt(index); 1640 this->addInt(index);
1641 } 1641 }
1642 1642
1643 int SkPictureRecord::addPathToHeap(const SkPath& path) { 1643 int SkPictureRecord::addPathToHeap(const SkPath& path) {
1644 if (NULL == fPathHeap) { 1644 if (NULL == fPathHeap) {
1645 fPathHeap = SkNEW(SkPathHeap); 1645 fPathHeap = SkNEW(SkPathHeap);
1646 } 1646 }
1647 #ifdef SK_DEDUP_PICTURE_PATHS
1648 return fPathHeap->insert(path);
1649 #else
1647 return fPathHeap->append(path); 1650 return fPathHeap->append(path);
1651 #endif
1648 } 1652 }
1649 1653
1650 void SkPictureRecord::addPath(const SkPath& path) { 1654 void SkPictureRecord::addPath(const SkPath& path) {
1651 this->addInt(this->addPathToHeap(path)); 1655 this->addInt(this->addPathToHeap(path));
1652 } 1656 }
1653 1657
1654 void SkPictureRecord::addPicture(SkPicture& picture) { 1658 void SkPictureRecord::addPicture(SkPicture& picture) {
1655 int index = fPictureRefs.find(&picture); 1659 int index = fPictureRefs.find(&picture);
1656 if (index < 0) { // not found 1660 if (index < 0) { // not found
1657 index = fPictureRefs.count(); 1661 index = fPictureRefs.count();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 void SkPictureRecord::validateRegions() const { 1858 void SkPictureRecord::validateRegions() const {
1855 int count = fRegions.count(); 1859 int count = fRegions.count();
1856 SkASSERT((unsigned) count < 0x1000); 1860 SkASSERT((unsigned) count < 0x1000);
1857 for (int index = 0; index < count; index++) { 1861 for (int index = 0; index < count; index++) {
1858 const SkFlatData* region = fRegions[index]; 1862 const SkFlatData* region = fRegions[index];
1859 SkASSERT(region); 1863 SkASSERT(region);
1860 // region->validate(); 1864 // region->validate();
1861 } 1865 }
1862 } 1866 }
1863 #endif 1867 #endif
OLDNEW
« no previous file with comments | « src/core/SkPathHeap.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698