| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #ifndef GrPictureUtils_DEFINED | 8 #ifndef GrPictureUtils_DEFINED |
| 9 #define GrPictureUtils_DEFINED | 9 #define GrPictureUtils_DEFINED |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 size_t fRestoreOpID; | 38 size_t fRestoreOpID; |
| 39 // True if this saveLayer has at least one other saveLayer nested within
it. | 39 // True if this saveLayer has at least one other saveLayer nested within
it. |
| 40 // False otherwise. | 40 // False otherwise. |
| 41 bool fHasNestedLayers; | 41 bool fHasNestedLayers; |
| 42 // True if this saveLayer is nested within another. False otherwise. | 42 // True if this saveLayer is nested within another. False otherwise. |
| 43 bool fIsNested; | 43 bool fIsNested; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 GPUAccelData(Key key) : INHERITED(key) { } | 46 GPUAccelData(Key key) : INHERITED(key) { } |
| 47 | 47 |
| 48 virtual ~GPUAccelData() { |
| 49 for (int i = 0; i < fSaveLayerInfo.count(); ++i) { |
| 50 SkDELETE(fSaveLayerInfo[i].fPaint); |
| 51 } |
| 52 } |
| 53 |
| 48 void addSaveLayerInfo(const SaveLayerInfo& info) { | 54 void addSaveLayerInfo(const SaveLayerInfo& info) { |
| 49 SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID); | 55 SkASSERT(info.fSaveLayerOpID < info.fRestoreOpID); |
| 50 *fSaveLayerInfo.push() = info; | 56 *fSaveLayerInfo.push() = info; |
| 51 } | 57 } |
| 52 | 58 |
| 53 int numSaveLayers() const { return fSaveLayerInfo.count(); } | 59 int numSaveLayers() const { return fSaveLayerInfo.count(); } |
| 54 | 60 |
| 55 const SaveLayerInfo& saveLayerInfo(int index) const { | 61 const SaveLayerInfo& saveLayerInfo(int index) const { |
| 56 SkASSERT(index < fSaveLayerInfo.count()); | 62 SkASSERT(index < fSaveLayerInfo.count()); |
| 57 | 63 |
| 58 return fSaveLayerInfo[index]; | 64 return fSaveLayerInfo[index]; |
| 59 } | 65 } |
| 60 | 66 |
| 61 // We may, in the future, need to pass in the GPUDevice in order to | 67 // We may, in the future, need to pass in the GPUDevice in order to |
| 62 // incorporate the clip and matrix state into the key | 68 // incorporate the clip and matrix state into the key |
| 63 static SkPicture::AccelData::Key ComputeAccelDataKey(); | 69 static SkPicture::AccelData::Key ComputeAccelDataKey(); |
| 64 | 70 |
| 65 protected: | 71 protected: |
| 66 SkTDArray<SaveLayerInfo> fSaveLayerInfo; | 72 SkTDArray<SaveLayerInfo> fSaveLayerInfo; |
| 67 | 73 |
| 68 private: | 74 private: |
| 69 typedef SkPicture::AccelData INHERITED; | 75 typedef SkPicture::AccelData INHERITED; |
| 70 }; | 76 }; |
| 71 | 77 |
| 72 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData); | 78 void GatherGPUInfo(SkPicture* pict, GPUAccelData* accelData); |
| 73 | 79 |
| 74 #endif // GrPictureUtils_DEFINED | 80 #endif // GrPictureUtils_DEFINED |
| OLD | NEW |