OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 void SkPictureData::initForPlayback() const { | 29 void SkPictureData::initForPlayback() const { |
30 // ensure that the paths bounds are pre-computed | 30 // ensure that the paths bounds are pre-computed |
31 for (int i = 0; i < fPaths.count(); i++) { | 31 for (int i = 0; i < fPaths.count(); i++) { |
32 fPaths[i].updateBoundsCache(); | 32 fPaths[i].updateBoundsCache(); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 SkPictureData::SkPictureData(const SkPictureRecord& record, | 36 SkPictureData::SkPictureData(const SkPictureRecord& record, |
37 const SkPictInfo& info, | 37 const SkPictInfo& info) |
38 bool deepCopyOps) | |
39 : fInfo(info) { | 38 : fInfo(info) { |
40 | 39 |
41 this->init(); | 40 this->init(); |
42 | 41 |
43 fOpData = record.opData(deepCopyOps); | 42 fOpData = record.opData(); |
44 | 43 |
45 fContentInfo.set(record.fContentInfo); | 44 fContentInfo.set(record.fContentInfo); |
46 | 45 |
47 fBitmaps = record.fBitmaps; | 46 fBitmaps = record.fBitmaps; |
48 fPaints = record.fPaints; | 47 fPaints = record.fPaints; |
49 | 48 |
50 fPaths.reset(record.fPaths.count()); | 49 fPaths.reset(record.fPaths.count()); |
51 record.fPaths.foreach([this](const SkPath& path, int n) { | 50 record.fPaths.foreach([this](const SkPath& path, int n) { |
52 // These indices are logically 1-based, but we need to serialize them | 51 // These indices are logically 1-based, but we need to serialize them |
53 // 0-based to keep the deserializing SkPictureData::getPath() working. | 52 // 0-based to keep the deserializing SkPictureData::getPath() working. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } else { | 659 } else { |
661 return this->suitableForGpuRasterization(nullptr, reason); | 660 return this->suitableForGpuRasterization(nullptr, reason); |
662 } | 661 } |
663 } | 662 } |
664 | 663 |
665 bool SkPictureData::suitableForLayerOptimization() const { | 664 bool SkPictureData::suitableForLayerOptimization() const { |
666 return fContentInfo.numLayers() > 0; | 665 return fContentInfo.numLayers() > 0; |
667 } | 666 } |
668 #endif | 667 #endif |
669 /////////////////////////////////////////////////////////////////////////////// | 668 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |