| 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 return obj ? obj->count() : 0; | 23 return obj ? obj->count() : 0; |
| 24 } | 24 } |
| 25 | 25 |
| 26 SkPictureData::SkPictureData(const SkPictInfo& info) | 26 SkPictureData::SkPictureData(const SkPictInfo& info) |
| 27 : fInfo(info) { | 27 : fInfo(info) { |
| 28 this->init(); | 28 this->init(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void SkPictureData::initForPlayback() const { | 31 void SkPictureData::initForPlayback() const { |
| 32 // ensure that the paths bounds are pre-computed | 32 // ensure that the paths bounds are pre-computed |
| 33 if (NULL != fPathHeap.get()) { | 33 if (fPathHeap.get()) { |
| 34 for (int i = 0; i < fPathHeap->count(); i++) { | 34 for (int i = 0; i < fPathHeap->count(); i++) { |
| 35 (*fPathHeap.get())[i].updateBoundsCache(); | 35 (*fPathHeap.get())[i].updateBoundsCache(); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 SkPictureData::SkPictureData(const SkPictureRecord& record, | 40 SkPictureData::SkPictureData(const SkPictureRecord& record, |
| 41 const SkPictInfo& info, | 41 const SkPictInfo& info, |
| 42 bool deepCopyOps) | 42 bool deepCopyOps) |
| 43 : fInfo(info) { | 43 : fInfo(info) { |
| 44 | 44 |
| 45 this->init(); | 45 this->init(); |
| 46 | 46 |
| 47 fOpData = record.opData(deepCopyOps); | 47 fOpData = record.opData(deepCopyOps); |
| 48 | 48 |
| 49 fBoundingHierarchy = record.fBoundingHierarchy; | 49 fBoundingHierarchy = record.fBoundingHierarchy; |
| 50 fStateTree = record.fStateTree; | 50 fStateTree = record.fStateTree; |
| 51 | 51 |
| 52 SkSafeRef(fBoundingHierarchy); | 52 SkSafeRef(fBoundingHierarchy); |
| 53 SkSafeRef(fStateTree); | 53 SkSafeRef(fStateTree); |
| 54 fContentInfo.set(record.fContentInfo); | 54 fContentInfo.set(record.fContentInfo); |
| 55 | 55 |
| 56 if (NULL != fBoundingHierarchy) { | 56 if (fBoundingHierarchy) { |
| 57 fBoundingHierarchy->flushDeferredInserts(); | 57 fBoundingHierarchy->flushDeferredInserts(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // copy over the refcnt dictionary to our reader | 60 // copy over the refcnt dictionary to our reader |
| 61 record.fFlattenableHeap.setupPlaybacks(); | 61 record.fFlattenableHeap.setupPlaybacks(); |
| 62 | 62 |
| 63 fBitmaps = record.fBitmapHeap->extractBitmaps(); | 63 fBitmaps = record.fBitmapHeap->extractBitmaps(); |
| 64 fPaints = record.fPaints.unflattenToArray(); | 64 fPaints = record.fPaints.unflattenToArray(); |
| 65 | 65 |
| 66 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); | 66 fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap)); |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 662 } |
| 663 } | 663 } |
| 664 | 664 |
| 665 bool SkPictureData::suitableForLayerOptimization() const { | 665 bool SkPictureData::suitableForLayerOptimization() const { |
| 666 return fContentInfo.numLayers() > 0; | 666 return fContentInfo.numLayers() > 0; |
| 667 } | 667 } |
| 668 #endif | 668 #endif |
| 669 /////////////////////////////////////////////////////////////////////////////// | 669 /////////////////////////////////////////////////////////////////////////////// |
| 670 | 670 |
| 671 | 671 |
| OLD | NEW |