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 SkLayerInfo_DEFINED | 8 #ifndef SkLayerInfo_DEFINED |
9 #define SkLayerInfo_DEFINED | 9 #define SkLayerInfo_DEFINED |
10 | 10 |
11 #include "SkBigPicture.h" | 11 #include "SkBigPicture.h" |
12 #include "SkTArray.h" | 12 #include "SkTArray.h" |
13 | 13 |
14 // This class stores information about the saveLayer/restore pairs found | 14 // This class stores information about the saveLayer/restore pairs found |
15 // within an SkPicture. It is used by Ganesh to perform layer hoisting. | 15 // within an SkPicture. It is used by Ganesh to perform layer hoisting. |
16 class SkLayerInfo : public SkBigPicture::AccelData { | 16 class SkLayerInfo : public SkBigPicture::AccelData { |
17 public: | 17 public: |
18 // Information about a given saveLayer/restore block in an SkPicture | 18 // Information about a given saveLayer/restore block in an SkPicture |
19 class BlockInfo { | 19 class BlockInfo { |
20 public: | 20 public: |
21 BlockInfo() : fPicture(NULL), fPaint(NULL), fKey(NULL), fKeySize(0) {} | 21 BlockInfo() : fPicture(NULL), fPaint(NULL), fKey(NULL), fKeySize(0) {} |
22 ~BlockInfo() { SkSafeUnref(fPicture); SkDELETE(fPaint); SkDELETE_ARRAY(f
Key); } | 22 ~BlockInfo() { |
| 23 SkSafeUnref(fPicture); |
| 24 delete fPaint; |
| 25 delete[] fKey; |
| 26 } |
23 | 27 |
24 // The picture owning the layer. If the owning picture is the top-most | 28 // The picture owning the layer. If the owning picture is the top-most |
25 // one (i.e., the picture for which this SkLayerInfo was created) then | 29 // one (i.e., the picture for which this SkLayerInfo was created) then |
26 // this pointer is NULL. If it is a nested picture then the pointer | 30 // this pointer is NULL. If it is a nested picture then the pointer |
27 // is non-NULL and owns a ref on the picture. | 31 // is non-NULL and owns a ref on the picture. |
28 const SkPicture* fPicture; | 32 const SkPicture* fPicture; |
29 // The device space bounds of this layer. | 33 // The device space bounds of this layer. |
30 SkRect fBounds; | 34 SkRect fBounds; |
31 // If not-empty, the optional bounds parameter passed in to the saveLaye
r | 35 // If not-empty, the optional bounds parameter passed in to the saveLaye
r |
32 // call. | 36 // call. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return fBlocks[index]; | 76 return fBlocks[index]; |
73 } | 77 } |
74 | 78 |
75 private: | 79 private: |
76 SkTArray<BlockInfo, true> fBlocks; | 80 SkTArray<BlockInfo, true> fBlocks; |
77 | 81 |
78 typedef SkBigPicture::AccelData INHERITED; | 82 typedef SkBigPicture::AccelData INHERITED; |
79 }; | 83 }; |
80 | 84 |
81 #endif // SkLayerInfo_DEFINED | 85 #endif // SkLayerInfo_DEFINED |
OLD | NEW |