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

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

Issue 1409373011: Dedup SkPaths by gen-ID when going to .skp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 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 | « no previous file | src/core/SkPictureRecord.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 * 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 #include <new> 7 #include <new>
8 #include "SkImageGenerator.h" 8 #include "SkImageGenerator.h"
9 #include "SkPictureData.h" 9 #include "SkPictureData.h"
10 #include "SkPictureRecord.h" 10 #include "SkPictureRecord.h"
(...skipping 28 matching lines...) Expand all
39 : fInfo(info) { 39 : fInfo(info) {
40 40
41 this->init(); 41 this->init();
42 42
43 fOpData = record.opData(deepCopyOps); 43 fOpData = record.opData(deepCopyOps);
44 44
45 fContentInfo.set(record.fContentInfo); 45 fContentInfo.set(record.fContentInfo);
46 46
47 fBitmaps = record.fBitmaps; 47 fBitmaps = record.fBitmaps;
48 fPaints = record.fPaints; 48 fPaints = record.fPaints;
49 fPaths = record.fPaths; 49
50 fPaths.reset(record.fPaths.count());
51 record.fPaths.foreach([this](const SkPath& path, int n) {
52 // These indices are logically 1-based, but we need to serialize them
53 // 0-based to keep the deserializing SkPictureData::getPath() working.
54 fPaths[n-1] = path;
55 });
50 56
51 this->initForPlayback(); 57 this->initForPlayback();
52 58
53 const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs(); 59 const SkTDArray<const SkPicture* >& pictures = record.getPictureRefs();
54 fPictureCount = pictures.count(); 60 fPictureCount = pictures.count();
55 if (fPictureCount > 0) { 61 if (fPictureCount > 0) {
56 fPictureRefs = new const SkPicture* [fPictureCount]; 62 fPictureRefs = new const SkPicture* [fPictureCount];
57 for (int i = 0; i < fPictureCount; i++) { 63 for (int i = 0; i < fPictureCount; i++) {
58 fPictureRefs[i] = pictures[i]; 64 fPictureRefs[i] = pictures[i];
59 fPictureRefs[i]->ref(); 65 fPictureRefs[i]->ref();
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 625 }
620 } 626 }
621 627
622 bool SkPictureData::suitableForLayerOptimization() const { 628 bool SkPictureData::suitableForLayerOptimization() const {
623 return fContentInfo.numLayers() > 0; 629 return fContentInfo.numLayers() > 0;
624 } 630 }
625 #endif 631 #endif
626 /////////////////////////////////////////////////////////////////////////////// 632 ///////////////////////////////////////////////////////////////////////////////
627 633
628 634
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698