| 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 "SkTArray.h" | 12 #include "SkTArray.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 class SaveLayerInfo { | 19 class SaveLayerInfo { |
| 20 public: | 20 public: |
| 21 SaveLayerInfo() : fPicture(NULL), fPaint(NULL) {} | 21 SaveLayerInfo() : fPicture(NULL), fPaint(NULL) {} |
| 22 ~SaveLayerInfo() { SkSafeUnref(fPicture); SkDELETE(fPaint); } | 22 ~SaveLayerInfo() { SkSafeUnref(fPicture); SkDELETE(fPaint); } |
| 23 | 23 |
| 24 // True if the SaveLayerInfo is valid. False if 'fOffset' is | |
| 25 // invalid (due to a non-invertible CTM). | |
| 26 // TODO: remove fValid | |
| 27 bool fValid; | |
| 28 // The picture owning the layer. If the owning picture is the top-most | 24 // The picture owning the layer. If the owning picture is the top-most |
| 29 // one (i.e., the picture for which this GrAccelData was created) then | 25 // one (i.e., the picture for which this GrAccelData was created) then |
| 30 // this pointer is NULL. If it is a nested picture then the pointer | 26 // this pointer is NULL. If it is a nested picture then the pointer |
| 31 // is non-NULL and owns a ref on the picture. | 27 // is non-NULL and owns a ref on the picture. |
| 32 const SkPicture* fPicture; | 28 const SkPicture* fPicture; |
| 33 // The size of the saveLayer | 29 // The size of the saveLayer |
| 34 SkISize fSize; | 30 SkISize fSize; |
| 35 // The matrix state in which this layer's draws must occur. It does not | 31 // The matrix state in which this layer's draws must occur. It does not |
| 36 // include the translation needed to map the layer's top-left point to t
he origin. | 32 // include the translation needed to map the layer's top-left point to t
he origin. |
| 37 SkMatrix fOriginXform; | 33 SkMatrix fOriginXform; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 67 |
| 72 private: | 68 private: |
| 73 SkTArray<SaveLayerInfo, true> fSaveLayerInfo; | 69 SkTArray<SaveLayerInfo, true> fSaveLayerInfo; |
| 74 | 70 |
| 75 typedef SkPicture::AccelData INHERITED; | 71 typedef SkPicture::AccelData INHERITED; |
| 76 }; | 72 }; |
| 77 | 73 |
| 78 const GrAccelData* GPUOptimize(const SkPicture* pict); | 74 const GrAccelData* GPUOptimize(const SkPicture* pict); |
| 79 | 75 |
| 80 #endif // GrPictureUtils_DEFINED | 76 #endif // GrPictureUtils_DEFINED |
| OLD | NEW |