15#include "third_party/skia/include/core/SkFont.h"
16#include "third_party/skia/include/core/SkFontMgr.h"
17#include "third_party/skia/include/core/SkTextBlob.h"
18#include "third_party/skia/include/core/SkTypeface.h"
20#ifdef IMPELLER_SUPPORTS_RENDERING
28void VisualizeStopWatch(DlCanvas* canvas,
29 const bool impeller_enabled,
30 const Stopwatch& stopwatch,
37 const std::string& label_prefix,
38 std::vector<DlPoint>& point_storage,
39 std::vector<DlColor>& color_storage,
41 const int label_x = 8;
42 const int label_y = -10;
46 DlStopwatchVisualizer(stopwatch, point_storage, color_storage)
47 .Visualize(canvas, visualization_rect);
55#ifdef IMPELLER_SUPPORTS_RENDERING
56 if (impeller_enabled) {
59 x + label_x,
y +
height + label_y, paint);
73 if (font_path ==
"") {
74 if (sk_sp<SkTypeface> face = font_mgr->matchFamilyStyle(
nullptr, {})) {
75 return SkFont(face, 15);
80 return SkFont(font_mgr->legacyMakeTypeface(
nullptr, {}), 15);
83 return SkFont(font_mgr->makeFromFile(font_path.data()), 15);
91 std::string_view label_prefix) {
93 FML_DCHECK(font.getTypeface()->countGlyphs() > 0);
97 std::stringstream stream;
98 stream.setf(std::ios::fixed | std::ios::showpoint);
99 stream << std::setprecision(1);
100 stream << label_prefix <<
" " <<
"max " << max_ms_per_frame <<
" ms/frame, "
101 <<
"avg " << average_ms_per_frame <<
" ms/frame";
102 auto text = stream.str();
103 return SkTextBlob::MakeFromText(
text.c_str(),
text.size(), font,
104 SkTextEncoding::kUTF8);
108 const char* font_path)
109 : options_(options) {
110 if (font_path !=
nullptr) {
111 font_path_ = font_path;
116 const Layer* old_layer) {
140 std::vector<DlPoint> vertices_storage;
141 std::vector<DlColor> color_storage;
148 vertices_storage, color_storage, font);
154 vertices_storage, color_storage, font);
void SetLayerPaintRegion(const Layer *layer, const PaintRegion ®ion)
void MarkSubtreeDirty(const PaintRegion &previous_paint_region=PaintRegion())
PaintRegion CurrentSubtreeRegion() const
PaintRegion GetOldLayerPaintRegion(const Layer *layer) const
bool IsSubtreeDirty() const
void AddLayerBounds(const DlRect &rect)
static std::shared_ptr< DlTextImpeller > Make(const std::shared_ptr< impeller::TextFrame > &frame)
static std::shared_ptr< DlTextSkia > Make(const sk_sp< SkTextBlob > &blob)
virtual const PerformanceOverlayLayer * as_performance_overlay_layer() const
const DlRect & paint_bounds() const
fml::TimeDelta MaxDelta() const
fml::TimeDelta AverageDelta() const
constexpr double ToMillisecondsF() const
#define FML_DCHECK(condition)
Vector2 padding
The halo padding in source space.
const int kVisualizeEngineStatistics
impeller::Scalar DlScalar
const int kDisplayEngineStatistics
const int kVisualizeRasterizerStatistics
const int kDisplayRasterizerStatistics
std::shared_ptr< TextFrame > MakeTextFrameFromTextBlobSkia(const sk_sp< SkTextBlob > &blob)
sk_sp< SkFontMgr > GetDefaultFontManager(uint32_t font_initialization_data)
const Stopwatch & raster_time
const Stopwatch & ui_time
LayerStateStack & state_stack
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.