| 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 |
| 11 #include "SkPicture.h" | 11 #include "SkPicture.h" |
| 12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 13 | 13 |
| 14 // This class encapsulates the GPU-backend-specific acceleration data | 14 // This class encapsulates the GPU-backend-specific acceleration data |
| 15 // for a single SkPicture | 15 // for a single SkPicture |
| 16 class GrAccelData : public SkPicture::AccelData { | 16 class GrAccelData : public SkPicture::AccelData { |
| 17 public: | 17 public: |
| 18 // Information about a given saveLayer in an SkPicture | 18 // Information about a given saveLayer in an SkPicture |
| 19 struct SaveLayerInfo { | 19 struct SaveLayerInfo { |
| 20 // True if the SaveLayerInfo is valid. False if either 'fOffset' is | 20 // True if the SaveLayerInfo is valid. False if either 'fOffset' is |
| 21 // invalid (due to a non-invertible CTM) or 'fPaint' is NULL (due | 21 // invalid (due to a non-invertible CTM) or 'fPaint' is NULL (due |
| 22 // to a non-copyable paint). | 22 // to a non-copyable paint). |
| 23 bool fValid; | 23 bool fValid; |
| 24 // ID of the picture containing the layer. This can be the ID of | 24 // ID of the picture containing the layer. This can be the ID of |
| 25 // a sub-picture embedded within the picture owning the GrAccelData | 25 // a sub-picture embedded within the picture owning the GrAccelData |
| 26 uint32_t fPictureID; | 26 uint32_t fPictureID; |
| 27 // The size of the saveLayer | 27 // The size of the saveLayer |
| 28 SkISize fSize; | 28 SkISize fSize; |
| 29 // The matrix state in which this layer's draws must occur. It already i
ncorporates | 29 // The matrix state in which this layer's draws must occur. It does not |
| 30 // the translation needed to map the layer's top-left point to the origi
n. | 30 // include the translation needed to map the layer's top-left point to t
he origin. |
| 31 SkMatrix fOriginXform; | 31 SkMatrix fOriginXform; |
| 32 // The offset that needs to be passed to drawBitmap to correctly | 32 // The offset that needs to be passed to drawBitmap to correctly |
| 33 // position the pre-rendered layer. It is in device space. | 33 // position the pre-rendered layer. It is in device space. |
| 34 SkIPoint fOffset; | 34 SkIPoint fOffset; |
| 35 // The paint to use on restore. NULL if the paint was not copyable (and | 35 // The paint to use on restore. NULL if the paint was not copyable (and |
| 36 // thus that this layer should not be pulled forward). | 36 // thus that this layer should not be pulled forward). |
| 37 const SkPaint* fPaint; | 37 const SkPaint* fPaint; |
| 38 // The ID of this saveLayer in the picture. 0 is an invalid ID. | 38 // The ID of this saveLayer in the picture. 0 is an invalid ID. |
| 39 size_t fSaveLayerOpID; | 39 size_t fSaveLayerOpID; |
| 40 // The ID of the matching restore in the picture. 0 is an invalid ID. | 40 // The ID of the matching restore in the picture. 0 is an invalid ID. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 SkTDArray<SaveLayerInfo> fSaveLayerInfo; | 75 SkTDArray<SaveLayerInfo> fSaveLayerInfo; |
| 76 | 76 |
| 77 typedef SkPicture::AccelData INHERITED; | 77 typedef SkPicture::AccelData INHERITED; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 const GrAccelData* GPUOptimize(const SkPicture* pict); | 80 const GrAccelData* GPUOptimize(const SkPicture* pict); |
| 81 | 81 |
| 82 #endif // GrPictureUtils_DEFINED | 82 #endif // GrPictureUtils_DEFINED |
| OLD | NEW |