| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
|---|---|
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ |
| 6 | #define FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "flutter/flow/instrumentation.h" |
| 11 | #include "flutter/flow/layers/layer.h" |
| 12 | #include "flutter/fml/macros.h" |
| 13 | |
| 14 | class SkTextBlob; |
| 15 | |
| 16 | namespace flutter { |
| 17 | |
| 18 | const int kDisplayRasterizerStatistics = 1 << 0; |
| 19 | const int kVisualizeRasterizerStatistics = 1 << 1; |
| 20 | const int kDisplayEngineStatistics = 1 << 2; |
| 21 | const int kVisualizeEngineStatistics = 1 << 3; |
| 22 | |
| 23 | class PerformanceOverlayLayer : public Layer { |
| 24 | public: |
| 25 | static sk_sp<SkTextBlob> MakeStatisticsText(const Stopwatch& stopwatch, |
| 26 | const std::string& label_prefix, |
| 27 | const std::string& font_path); |
| 28 | |
| 29 | explicit PerformanceOverlayLayer(uint64_t options, |
| 30 | const char* font_path = nullptr); |
| 31 | |
| 32 | void Paint(PaintContext& context) const override; |
| 33 | |
| 34 | private: |
| 35 | int options_; |
| 36 | std::string font_path_; |
| 37 | |
| 38 | FML_DISALLOW_COPY_AND_ASSIGN(PerformanceOverlayLayer); |
| 39 | }; |
| 40 | |
| 41 | } // namespace flutter |
| 42 | |
| 43 | #endif // FLUTTER_FLOW_LAYERS_PERFORMANCE_OVERLAY_LAYER_H_ |
| 44 |