| 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 28 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |