| 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 // 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 |
| 25 // 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 |
| 26 // 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 |
| 27 // is non-NULL and owns a ref on the picture. | 27 // is non-NULL and owns a ref on the picture. |
| 28 const SkPicture* fPicture; | 28 const SkPicture* fPicture; |
| 29 // The device space bounds of this layer. | 29 // The device space bounds of this layer. |
| 30 SkIRect fBounds; | 30 SkRect fBounds; |
| 31 // The pre-matrix begins as the identity and accumulates the transforms | 31 // The pre-matrix begins as the identity and accumulates the transforms |
| 32 // of the containing SkPictures (if any). This matrix state has to be | 32 // of the containing SkPictures (if any). This matrix state has to be |
| 33 // part of the initial matrix during replay so that it will be | 33 // part of the initial matrix during replay so that it will be |
| 34 // preserved across setMatrix calls. | 34 // preserved across setMatrix calls. |
| 35 SkMatrix fPreMat; | 35 SkMatrix fPreMat; |
| 36 // The matrix state (in the leaf picture) in which this layer's draws | 36 // The matrix state (in the leaf picture) in which this layer's draws |
| 37 // must occur. It will/can be overridden by setMatrix calls in the | 37 // must occur. It will/can be overridden by setMatrix calls in the |
| 38 // layer itself. It does not include the translation needed to map the | 38 // layer itself. It does not include the translation needed to map the |
| 39 // layer's top-left point to the origin (which must be part of the | 39 // layer's top-left point to the origin (which must be part of the |
| 40 // initial matrix). | 40 // initial matrix). |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 SkTArray<SaveLayerInfo, true> fSaveLayerInfo; | 74 SkTArray<SaveLayerInfo, true> fSaveLayerInfo; |
| 75 | 75 |
| 76 typedef SkPicture::AccelData INHERITED; | 76 typedef SkPicture::AccelData INHERITED; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 const GrAccelData* GPUOptimize(const SkPicture* pict); | 79 const GrAccelData* GPUOptimize(const SkPicture* pict); |
| 80 | 80 |
| 81 #endif // GrPictureUtils_DEFINED | 81 #endif // GrPictureUtils_DEFINED |
| OLD | NEW |