| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SKIA_EXT_ANALYSIS_CANVAS_H_ | 5 #ifndef SKIA_EXT_ANALYSIS_CANVAS_H_ |
| 6 #define SKIA_EXT_ANALYSIS_CANVAS_H_ | 6 #define SKIA_EXT_ANALYSIS_CANVAS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | |
| 13 #include "third_party/skia/include/core/SkPicture.h" | 12 #include "third_party/skia/include/core/SkPicture.h" |
| 13 #include "third_party/skia/include/utils/SkNoDrawCanvas.h" |
| 14 | 14 |
| 15 namespace skia { | 15 namespace skia { |
| 16 | 16 |
| 17 // Does not render anything, but gathers statistics about a region | 17 // Does not render anything, but gathers statistics about a region |
| 18 // (specified as a clip rectangle) of an SkPicture as the picture is | 18 // (specified as a clip rectangle) of an SkPicture as the picture is |
| 19 // played back through it. | 19 // played back through it. |
| 20 // To use: play a picture into the canvas, and then check result. | 20 // To use: play a picture into the canvas, and then check result. |
| 21 class SK_API AnalysisCanvas : public SkCanvas, public SkPicture::AbortCallback { | 21 class SK_API AnalysisCanvas final : public SkNoDrawCanvas, |
| 22 public SkPicture::AbortCallback { |
| 22 public: | 23 public: |
| 23 AnalysisCanvas(int width, int height); | 24 AnalysisCanvas(int width, int height); |
| 24 ~AnalysisCanvas() override; | 25 ~AnalysisCanvas() override; |
| 25 | 26 |
| 26 // Returns true when a SkColor can be used to represent result. | 27 // Returns true when a SkColor can be used to represent result. |
| 27 bool GetColorIfSolid(SkColor* color) const; | 28 bool GetColorIfSolid(SkColor* color) const; |
| 28 | 29 |
| 29 void SetForceNotSolid(bool flag); | 30 void SetForceNotSolid(bool flag); |
| 30 void SetForceNotTransparent(bool flag); | 31 void SetForceNotTransparent(bool flag); |
| 31 | 32 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SkScalar x, | 119 SkScalar x, |
| 119 SkScalar y, | 120 SkScalar y, |
| 120 const SkPaint& paint) override; | 121 const SkPaint& paint) override; |
| 121 void onDrawDRRect(const SkRRect& outer, | 122 void onDrawDRRect(const SkRRect& outer, |
| 122 const SkRRect& inner, | 123 const SkRRect& inner, |
| 123 const SkPaint&) override; | 124 const SkPaint&) override; |
| 124 | 125 |
| 125 void OnComplexClip(); | 126 void OnComplexClip(); |
| 126 | 127 |
| 127 private: | 128 private: |
| 128 typedef SkCanvas INHERITED; | 129 typedef SkNoDrawCanvas INHERITED; |
| 129 | 130 |
| 130 int saved_stack_size_; | 131 int saved_stack_size_; |
| 131 int force_not_solid_stack_level_; | 132 int force_not_solid_stack_level_; |
| 132 int force_not_transparent_stack_level_; | 133 int force_not_transparent_stack_level_; |
| 133 | 134 |
| 134 bool is_forced_not_solid_; | 135 bool is_forced_not_solid_; |
| 135 bool is_forced_not_transparent_; | 136 bool is_forced_not_transparent_; |
| 136 bool is_solid_color_; | 137 bool is_solid_color_; |
| 137 SkColor color_; | 138 SkColor color_; |
| 138 bool is_transparent_; | 139 bool is_transparent_; |
| 139 int draw_op_count_; | 140 int draw_op_count_; |
| 140 int rejected_op_count_; | 141 int rejected_op_count_; |
| 141 }; | 142 }; |
| 142 | 143 |
| 143 } // namespace skia | 144 } // namespace skia |
| 144 | 145 |
| 145 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_ | 146 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_ |
| 146 | 147 |
| OLD | NEW |