22 const DlRect& rect)
const {
35 const DlScalar max_interval = one_frame_ms * 3.0;
40 size_t required_storage =
42 if (vertices_storage_.size() < required_storage) {
43 vertices_storage_.resize(required_storage);
44 color_storage_.resize(required_storage);
59 const DlScalar bar_top = bottom - sample_unit_height;
60 const DlScalar bar_right =
x + (
i + 1) * sample_unit_width;
73 if (max_interval > one_frame_ms) {
75 size_t count =
static_cast<size_t>(max_interval / one_frame_ms);
82 for (uint32_t
i = 0u;
i < count;
i++) {
91 y + frame_height + 1),
106 const DlScalar l =
x + sample * sample_unit_width;
108 const DlScalar r = l + sample_unit_width;
124 std::vector<DlColor>& color_storage)
125 : vertices_(vertices_storage), colors_(color_storage) {}
133 FML_DCHECK(6 + colors_offset_ <= vertices_.size());
134 FML_DCHECK(6 + colors_offset_ <= colors_.size());
137 vertices_[vertices_offset_++] =
DlPoint(left, top);
138 vertices_[vertices_offset_++] =
DlPoint(right, top);
139 vertices_[vertices_offset_++] =
DlPoint(right, bottom);
140 vertices_[vertices_offset_++] =
DlPoint(right, bottom);
141 vertices_[vertices_offset_++] =
DlPoint(left, bottom);
142 vertices_[vertices_offset_++] =
DlPoint(left, top);
143 for (
size_t i = 0u;
i < 6u;
i++) {
144 colors_[colors_offset_++] = color;
149 const DlRect& bounds_rect) {
Developer-facing API for rendering anything within the engine.
virtual void DrawVertices(const std::shared_ptr< DlVertices > &vertices, DlBlendMode mode, const DlPaint &paint)=0
DlPaint & setBlendMode(DlBlendMode mode)
void Visualize(DlCanvas *canvas, const DlRect &rect) const override
Renders the stopwatch as a graph.
Provides canvas-like painting methods that actually build vertices.
std::shared_ptr< DlVertices > IntoVertices(const DlRect &bounds_rect)
void DrawRect(const DlRect &rect, const DlColor &color)
Draws a rectangle with the given color to a buffer.
DlVertexPainter(std::vector< DlPoint > &vertices_storage, std::vector< DlColor > &color_storage)
static std::shared_ptr< DlVertices > Make(DlVertexMode mode, int vertex_count, const DlPoint vertices[], const DlPoint texture_coordinates[], const DlColor colors[], int index_count=0, const uint16_t indices[]=nullptr, const DlRect *bounds=nullptr)
Constructs a DlVector with compact inline storage for all of its required and optional lists of data.
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
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.
constexpr double ToMillisecondsF() const
#define FML_DCHECK(condition)
impeller::Scalar DlScalar
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
static const size_t kMaxSamples
static const size_t kMaxFrameMarkers
static constexpr DlColor kRed()
static constexpr DlColor kGreen()
constexpr auto GetBottom() const
constexpr Type GetY() const
Returns the Y coordinate of the upper left corner, equivalent to |GetOrigin().y|.
constexpr auto GetTop() const
constexpr Type GetHeight() const
Returns the height of the rectangle, equivalent to |GetSize().height|.
constexpr auto GetLeft() const
constexpr Type GetX() const
Returns the X coordinate of the upper left corner, equivalent to |GetOrigin().x|.
constexpr auto GetRight() const
constexpr Type GetWidth() const
Returns the width of the rectangle, equivalent to |GetSize().width|.
static constexpr TRect MakeLTRB(Type left, Type top, Type right, Type bottom)