5#include "flutter/flow/stopwatch_sk.h"
18void SkStopwatchVisualizer::InitVisualizeSurface(
SkISize size)
const {
20 if (visualize_cache_surface_) {
21 if (
size.width() != visualize_cache_surface_->
width() ||
22 size.height() != visualize_cache_surface_->
height()) {
33 visualize_cache_surface_ =
45 paint.setColor(0x99FFFFFF);
51 const double max_interval = one_frame_ms * 3.0;
58 path.setIsVolatile(
true);
64 double unit_next_x = 0.0;
67 unit_next_x = (
static_cast<double>(
i + 1) /
kMaxSamples);
68 const double sample_y =
72 path.lineTo(
x +
width * unit_next_x, sample_y);
84 paint.setColor(0xAA0000FF);
105 const double max_interval = one_frame_ms * 3.0;
108 const double sample_unit_width = (1.0 /
kMaxSamples);
111 paint.setColor(0x99FFFFFF);
112 paint.setStyle(SkPaint::Style::kFill_Style);
117 sample_x,
y, sample_x +
width * sample_unit_width,
height);
121 paint.setColor(0xAA0000FF);
137 paint.setStrokeWidth(0);
138 paint.setStyle(SkPaint::Style::kStroke_Style);
139 paint.setColor(0xCC000000);
141 if (max_interval > one_frame_ms) {
143 size_t frame_marker_count =
144 static_cast<size_t>(max_interval / one_frame_ms);
149 frame_marker_count = 1;
152 for (
size_t frame_index = 0; frame_index < frame_marker_count;
154 const double frame_height =
165 paint.setStyle(SkPaint::Style::kFill_Style);
177 sample_x,
y, sample_x +
width * sample_unit_width,
height);
@ kSrcOver
r = s + (1-sa)*d
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
sk_sp< SkImage > makeImageSnapshot()
Developer-facing API for rendering anything within the engine.
virtual void DrawImage(const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr)=0
static sk_sp< DlImage > Make(const SkImage *image)
void Visualize(DlCanvas *canvas, const SkRect &rect) const override
Renders the stopwatch as a graph.
double UnitHeight(double time_ms, double max_height) const
Converts a raster time to a unit height.
const Stopwatch & stopwatch_
fml::Milliseconds GetFrameBudget() const
double UnitFrameInterval(double time_ms) const
Converts a raster time to a unit interval.
const fml::TimeDelta & GetLap(size_t index) const
const fml::TimeDelta & LastLap() const
size_t GetCurrentSample() const
constexpr double ToMillisecondsF() const
sk_sp< const SkImage > image
sk_sp< SkBlender > blender SkRect rect
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
static const size_t kMaxSamples
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static const size_t kMaxFrameMarkers
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)