OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkPictureAnalyzer_DEFINED | 8 #ifndef SkPictureAnalyzer_DEFINED |
9 #define SkPictureAnalyzer_DEFINED | 9 #define SkPictureAnalyzer_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkRegion.h" |
12 #include "SkTypes.h" | 13 #include "SkTypes.h" |
13 | 14 |
14 #if SK_SUPPORT_GPU | 15 #if SK_SUPPORT_GPU |
15 #include "GrContext.h" | 16 #include "GrContext.h" |
16 | 17 |
| 18 class SkPath; |
17 class SkPicture; | 19 class SkPicture; |
18 | 20 |
19 /** \class SkPictureGpuAnalyzer | 21 /** \class SkPictureGpuAnalyzer |
20 | 22 |
21 Gathers GPU-related statistics for one or more SkPictures. | 23 Gathers GPU-related statistics for one or more SkPictures. |
22 */ | 24 */ |
23 class SK_API SkPictureGpuAnalyzer final : public SkNoncopyable { | 25 class SK_API SkPictureGpuAnalyzer final : public SkNoncopyable { |
24 public: | 26 public: |
25 explicit SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> = nullptr); | 27 explicit SkPictureGpuAnalyzer(sk_sp<GrContextThreadSafeProxy> = nullptr); |
26 explicit SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, | 28 explicit SkPictureGpuAnalyzer(const sk_sp<SkPicture>& picture, |
27 sk_sp<GrContextThreadSafeProxy> = nullptr); | 29 sk_sp<GrContextThreadSafeProxy> = nullptr); |
28 | 30 |
29 /** | 31 /** |
30 * Process the given picture and accumulate its stats. | 32 * Process the given picture and accumulate its stats. |
31 */ | 33 */ |
32 void analyze(const SkPicture*); | 34 void analyzePicture(const SkPicture*); |
| 35 |
| 36 // Legacy/transitional alias. |
| 37 void analyze(const SkPicture* picture) { this->analyzePicture(picture); } |
| 38 |
| 39 /** |
| 40 * Process an explicit clipPath op. |
| 41 */ |
| 42 void analyzeClipPath(const SkPath&, SkRegion::Op, bool doAntiAlias); |
33 | 43 |
34 /** | 44 /** |
35 * Reset all accumulated stats. | 45 * Reset all accumulated stats. |
36 */ | 46 */ |
37 void reset(); | 47 void reset(); |
38 | 48 |
39 /** | 49 /** |
40 * Returns true if the analyzed pictures are suitable for rendering on the
GPU. | 50 * Returns true if the analyzed pictures are suitable for rendering on the
GPU. |
41 */ | 51 */ |
42 bool suitableForGpuRasterization(const char** whyNot = nullptr) const; | 52 bool suitableForGpuRasterization(const char** whyNot = nullptr) const; |
43 | 53 |
44 private: | 54 private: |
45 uint32_t fNumSlowPaths; | 55 uint32_t fNumSlowPaths; |
46 | 56 |
47 typedef SkNoncopyable INHERITED; | 57 typedef SkNoncopyable INHERITED; |
48 }; | 58 }; |
49 | 59 |
50 #endif // SK_SUPPORT_GPU | 60 #endif // SK_SUPPORT_GPU |
51 | 61 |
52 #endif // SkPictureAnalyzer_DEFINED | 62 #endif // SkPictureAnalyzer_DEFINED |
OLD | NEW |