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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "third_party/skia/include/core/SkDrawPictureCallback.h" | 10 #include "third_party/skia/include/core/SkPicture.h" |
11 | 11 |
12 namespace skia { | 12 namespace skia { |
13 | 13 |
14 // Does not render anything, but gathers statistics about a region | 14 // Does not render anything, but gathers statistics about a region |
15 // (specified as a clip rectangle) of an SkPicture as the picture is | 15 // (specified as a clip rectangle) of an SkPicture as the picture is |
16 // played back through it. | 16 // played back through it. |
17 // To use: play a picture into the canvas, and then check result. | 17 // To use: play a picture into the canvas, and then check result. |
18 class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback { | 18 class SK_API AnalysisCanvas : public SkCanvas, public SkPicture::AbortCallback { |
19 public: | 19 public: |
20 AnalysisCanvas(int width, int height); | 20 AnalysisCanvas(int width, int height); |
21 ~AnalysisCanvas() override; | 21 ~AnalysisCanvas() override; |
22 | 22 |
23 // Returns true when a SkColor can be used to represent result. | 23 // Returns true when a SkColor can be used to represent result. |
24 bool GetColorIfSolid(SkColor* color) const; | 24 bool GetColorIfSolid(SkColor* color) const; |
25 | 25 |
26 void SetForceNotSolid(bool flag); | 26 void SetForceNotSolid(bool flag); |
27 void SetForceNotTransparent(bool flag); | 27 void SetForceNotTransparent(bool flag); |
28 | 28 |
29 // SkDrawPictureCallback override. | 29 // SkPicture::AbortCallback override. |
30 bool abortDrawing() override; | 30 bool abort() override; |
31 | 31 |
32 // SkCanvas overrides. | 32 // SkCanvas overrides. |
33 void onDrawPaint(const SkPaint& paint) override; | 33 void onDrawPaint(const SkPaint& paint) override; |
34 void onDrawPoints(PointMode, | 34 void onDrawPoints(PointMode, |
35 size_t count, | 35 size_t count, |
36 const SkPoint pts[], | 36 const SkPoint pts[], |
37 const SkPaint&) override; | 37 const SkPaint&) override; |
38 void onDrawOval(const SkRect&, const SkPaint&) override; | 38 void onDrawOval(const SkRect&, const SkPaint&) override; |
39 void onDrawRect(const SkRect&, const SkPaint&) override; | 39 void onDrawRect(const SkRect&, const SkPaint&) override; |
40 void onDrawRRect(const SkRRect&, const SkPaint&) override; | 40 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 bool is_solid_color_; | 133 bool is_solid_color_; |
134 SkColor color_; | 134 SkColor color_; |
135 bool is_transparent_; | 135 bool is_transparent_; |
136 int draw_op_count_; | 136 int draw_op_count_; |
137 }; | 137 }; |
138 | 138 |
139 } // namespace skia | 139 } // namespace skia |
140 | 140 |
141 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_ | 141 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_ |
142 | 142 |
OLD | NEW |