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