| 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 SkPictureContentInfo_DEFINED | 8 #ifndef SkPictureContentInfo_DEFINED |
| 9 #define SkPictureContentInfo_DEFINED | 9 #define SkPictureContentInfo_DEFINED |
| 10 | 10 |
| 11 class GrContext; | 11 class GrContext; |
| 12 | 12 |
| 13 class SkPictureContentInfo { | 13 class SkPictureContentInfo { |
| 14 public: | 14 public: |
| 15 SkPictureContentInfo() { this->reset(); } | 15 SkPictureContentInfo() { this->reset(); } |
| 16 SkPictureContentInfo(const SkPictureContentInfo& src) { this->set(src); } | 16 SkPictureContentInfo(const SkPictureContentInfo& src) { this->set(src); } |
| 17 | 17 |
| 18 int numOperations() const { return fNumOperations; } | 18 int numOperations() const { return fNumOperations; } |
| 19 bool hasText() const { return fNumTexts > 0; } | 19 bool hasText() const { return fNumTexts > 0; } |
| 20 |
| 21 int numLayers() const { return fNumLayers; } |
| 22 int numInteriorLayers() const { return fNumInteriorLayers; } |
| 23 int numLeafLayers() const { return fNumLeafLayers; } |
| 24 |
| 20 bool suitableForGpuRasterization(GrContext* context, const char **reason, | 25 bool suitableForGpuRasterization(GrContext* context, const char **reason, |
| 21 int sampleCount) const; | 26 int sampleCount) const; |
| 22 | 27 |
| 23 void addOperation() { ++fNumOperations; } | 28 void addOperation() { ++fNumOperations; } |
| 24 | 29 |
| 25 void onDrawPoints(size_t count, const SkPaint& paint); | 30 void onDrawPoints(size_t count, const SkPaint& paint); |
| 26 void onDrawPath(const SkPath& path, const SkPaint& paint); | 31 void onDrawPath(const SkPath& path, const SkPaint& paint); |
| 27 void onAddPaintPtr(const SkPaint* paint); | 32 void onAddPaintPtr(const SkPaint* paint); |
| 28 void onDrawText() { ++fNumTexts; } | 33 void onDrawText() { ++fNumTexts; } |
| 29 | 34 |
| 35 void onSaveLayer(); |
| 36 void onSave(); |
| 37 void onRestore(); |
| 38 void rescindLastSave(); |
| 39 void rescindLastSaveLayer(); |
| 40 |
| 30 void set(const SkPictureContentInfo& src); | 41 void set(const SkPictureContentInfo& src); |
| 31 void reset(); | 42 void reset(); |
| 32 void swap(SkPictureContentInfo* other); | 43 void swap(SkPictureContentInfo* other); |
| 33 | 44 |
| 34 private: | 45 private: |
| 35 // Raw count of operations in the picture | 46 // Raw count of operations in the picture |
| 36 int fNumOperations; | 47 int fNumOperations; |
| 37 // Count of all forms of drawText | 48 // Count of all forms of drawText |
| 38 int fNumTexts; | 49 int fNumTexts; |
| 39 | 50 |
| 40 // This field is incremented every time a paint with a path effect is | 51 // This field is incremented every time a paint with a path effect is |
| 41 // used (i.e., it is not a de-duplicated count) | 52 // used (i.e., it is not a de-duplicated count) |
| 42 int fNumPaintWithPathEffectUses; | 53 int fNumPaintWithPathEffectUses; |
| 43 // This field is incremented every time a paint with a path effect that is | 54 // This field is incremented every time a paint with a path effect that is |
| 44 // dashed, we are drawing a line, and we can use the gpu fast path | 55 // dashed, we are drawing a line, and we can use the gpu fast path |
| 45 int fNumFastPathDashEffects; | 56 int fNumFastPathDashEffects; |
| 46 // This field is incremented every time an anti-aliased drawPath call is | 57 // This field is incremented every time an anti-aliased drawPath call is |
| 47 // issued with a concave path | 58 // issued with a concave path |
| 48 int fNumAAConcavePaths; | 59 int fNumAAConcavePaths; |
| 49 // This field is incremented every time a drawPath call is | 60 // This field is incremented every time a drawPath call is |
| 50 // issued for a hairline stroked concave path. | 61 // issued for a hairline stroked concave path. |
| 51 int fNumAAHairlineConcavePaths; | 62 int fNumAAHairlineConcavePaths; |
| 63 // These fields track the different layer flavors. fNumLayers is just |
| 64 // a count of all saveLayers, fNumInteriorLayers is the number of layers |
| 65 // with a layer inside them, fNumLeafLayers is the number of layers with |
| 66 // no layer inside them. |
| 67 int fNumLayers; |
| 68 int fNumInteriorLayers; |
| 69 int fNumLeafLayers; |
| 70 |
| 71 enum Flags { |
| 72 kSave_Flag = 0x1, |
| 73 kSaveLayer_Flag = 0x2, |
| 74 |
| 75 // Did the current save or saveLayer contain another saveLayer. |
| 76 // Percolated back down the save stack. |
| 77 kContainedSaveLayer_Flag = 0x4 |
| 78 }; |
| 79 |
| 80 // Stack of save vs saveLayer information to track nesting |
| 81 SkTDArray<uint32_t> fSaveStack; |
| 52 }; | 82 }; |
| 53 | 83 |
| 54 #endif | 84 #endif |
| OLD | NEW |