5#include "flutter/flow/stopwatch_dl.h"
21 const SkRect& rect)
const {
26 auto const x = rect.x();
27 auto const y = rect.y();
28 auto const width = rect.width();
29 auto const height = rect.height();
30 auto const bottom = rect.bottom();
34 auto const max_interval = one_frame_ms * 3.0;
39 painter.DrawRect(rect,
DlColor(0x99FFFFFF));
45 auto const sample_unit_height =
49 auto const bar_width =
width * sample_unit_width;
50 auto const bar_height =
height * sample_unit_height;
51 auto const bar_left =
x +
width * sample_unit_width * i;
63 if (max_interval > one_frame_ms) {
65 auto count =
static_cast<size_t>(max_interval / one_frame_ms);
72 for (
auto i =
size_t(0); i <
count; i++) {
73 auto const frame_height =
81 y + frame_height + 1),
98 auto const r = l +
width * sample_unit_width;
99 auto const b = rect.bottom();
114 auto const left = rect.x();
115 auto const top = rect.y();
116 auto const right = rect.right();
117 auto const bottom = rect.bottom();
119 auto const vertices = std::array<SkPoint, 6>{
128 auto const colors = std::array<DlColor, 6>{
137 vertices_.insert(vertices_.end(), vertices.begin(), vertices.end());
138 colors_.insert(colors_.end(), colors.begin(), colors.end());
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
Developer-facing API for rendering anything within the engine.
virtual void DrawVertices(const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint)=0
void Visualize(DlCanvas *canvas, const SkRect &rect) const override
Renders the stopwatch as a graph.
Provides canvas-like painting methods that actually build vertices.
void DrawRect(const SkRect &rect, const DlColor &color)
Draws a rectangle with the given color to a buffer.
std::shared_ptr< DlVertices > IntoVertices()
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const SkPoint vertices[], const SkPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
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 GetLapsCount() const
Return a reference to all the laps.
size_t GetCurrentSample() const
constexpr double ToMillisecondsF() const
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
static const size_t kMaxSamples
static const size_t kMaxFrameMarkers
@ kSrcOver
r = s + (1-sa)*d
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
static constexpr DlColor kRed()
static constexpr DlColor kGreen()