| 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 | |
| 25 bool suitableForGpuRasterization(GrContext* context, const char **reason, | 20 bool suitableForGpuRasterization(GrContext* context, const char **reason, |
| 26 int sampleCount) const; | 21 int sampleCount) const; |
| 27 | 22 |
| 28 void addOperation() { ++fNumOperations; } | 23 void addOperation() { ++fNumOperations; } |
| 29 | 24 |
| 30 void onDrawPoints(size_t count, const SkPaint& paint); | 25 void onDrawPoints(size_t count, const SkPaint& paint); |
| 31 void onDrawPath(const SkPath& path, const SkPaint& paint); | 26 void onDrawPath(const SkPath& path, const SkPaint& paint); |
| 32 void onAddPaintPtr(const SkPaint* paint); | 27 void onAddPaintPtr(const SkPaint* paint); |
| 33 void onDrawText() { ++fNumTexts; } | 28 void onDrawText() { ++fNumTexts; } |
| 34 | 29 |
| 35 void onSaveLayer(); | |
| 36 void onSave(); | |
| 37 void onRestore(); | |
| 38 void rescindLastSave(); | |
| 39 void rescindLastSaveLayer(); | |
| 40 | |
| 41 void set(const SkPictureContentInfo& src); | 30 void set(const SkPictureContentInfo& src); |
| 42 void reset(); | 31 void reset(); |
| 43 void swap(SkPictureContentInfo* other); | 32 void swap(SkPictureContentInfo* other); |
| 44 | 33 |
| 45 private: | 34 private: |
| 46 // Raw count of operations in the picture | 35 // Raw count of operations in the picture |
| 47 int fNumOperations; | 36 int fNumOperations; |
| 48 // Count of all forms of drawText | 37 // Count of all forms of drawText |
| 49 int fNumTexts; | 38 int fNumTexts; |
| 50 | 39 |
| 51 // This field is incremented every time a paint with a path effect is | 40 // This field is incremented every time a paint with a path effect is |
| 52 // used (i.e., it is not a de-duplicated count) | 41 // used (i.e., it is not a de-duplicated count) |
| 53 int fNumPaintWithPathEffectUses; | 42 int fNumPaintWithPathEffectUses; |
| 54 // This field is incremented every time a paint with a path effect that is | 43 // This field is incremented every time a paint with a path effect that is |
| 55 // dashed, we are drawing a line, and we can use the gpu fast path | 44 // dashed, we are drawing a line, and we can use the gpu fast path |
| 56 int fNumFastPathDashEffects; | 45 int fNumFastPathDashEffects; |
| 57 // This field is incremented every time an anti-aliased drawPath call is | 46 // This field is incremented every time an anti-aliased drawPath call is |
| 58 // issued with a concave path | 47 // issued with a concave path |
| 59 int fNumAAConcavePaths; | 48 int fNumAAConcavePaths; |
| 60 // This field is incremented every time a drawPath call is | 49 // This field is incremented every time a drawPath call is |
| 61 // issued for a hairline stroked concave path. | 50 // issued for a hairline stroked concave path. |
| 62 int fNumAAHairlineConcavePaths; | 51 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; | |
| 82 }; | 52 }; |
| 83 | 53 |
| 84 #endif | 54 #endif |
| OLD | NEW |