5#ifndef FLUTTER_TESTING_MOCK_CANVAS_H_
6#define FLUTTER_TESTING_MOCK_CANVAS_H_
12#include "flutter/display_list/dl_canvas.h"
13#include "flutter/display_list/utils/dl_matrix_clip_tracker.h"
14#include "gtest/gtest.h"
162 const std::vector<DrawCall>&
draw_calls()
const {
return draw_calls_; }
168 void Save()
override;
175 while (current_layer_ > restore_count) {
281 void DrawTextFrame(
const std::shared_ptr<impeller::TextFrame>& text_frame,
288 bool transparent_occluder,
291 void Flush()
override;
295 std::vector<DisplayListMatrixClipState> state_stack_;
296 std::vector<DrawCall> draw_calls_;
300extern bool operator==(
const MockCanvas::SaveData&
a,
301 const MockCanvas::SaveData&
b);
302extern std::ostream&
operator<<(std::ostream& os,
303 const MockCanvas::SaveData&
data);
304extern bool operator==(
const MockCanvas::SaveLayerData&
a,
305 const MockCanvas::SaveLayerData&
b);
306extern std::ostream&
operator<<(std::ostream& os,
307 const MockCanvas::SaveLayerData&
data);
308extern bool operator==(
const MockCanvas::RestoreData&
a,
309 const MockCanvas::RestoreData&
b);
310extern std::ostream&
operator<<(std::ostream& os,
311 const MockCanvas::RestoreData&
data);
312extern bool operator==(
const MockCanvas::ConcatMatrixData&
a,
313 const MockCanvas::ConcatMatrixData&
b);
314extern std::ostream&
operator<<(std::ostream& os,
315 const MockCanvas::ConcatMatrixData&
data);
316extern bool operator==(
const MockCanvas::SetMatrixData&
a,
317 const MockCanvas::SetMatrixData&
b);
318extern std::ostream&
operator<<(std::ostream& os,
319 const MockCanvas::SetMatrixData&
data);
320extern bool operator==(
const MockCanvas::DrawRectData&
a,
321 const MockCanvas::DrawRectData&
b);
322extern std::ostream&
operator<<(std::ostream& os,
323 const MockCanvas::DrawRectData&
data);
324extern bool operator==(
const MockCanvas::DrawPathData&
a,
325 const MockCanvas::DrawPathData&
b);
326extern std::ostream&
operator<<(std::ostream& os,
327 const MockCanvas::DrawPathData&
data);
328extern bool operator==(
const MockCanvas::DrawTextData&
a,
329 const MockCanvas::DrawTextData&
b);
330extern std::ostream&
operator<<(std::ostream& os,
331 const MockCanvas::DrawTextData&
data);
332extern bool operator==(
const MockCanvas::DrawImageData&
a,
333 const MockCanvas::DrawImageData&
b);
334extern std::ostream&
operator<<(std::ostream& os,
335 const MockCanvas::DrawImageData&
data);
336extern bool operator==(
const MockCanvas::DrawImageDataNoPaint&
a,
337 const MockCanvas::DrawImageDataNoPaint&
b);
338extern std::ostream&
operator<<(std::ostream& os,
339 const MockCanvas::DrawImageDataNoPaint&
data);
340extern bool operator==(
const MockCanvas::DrawDisplayListData&
a,
341 const MockCanvas::DrawDisplayListData&
b);
342extern std::ostream&
operator<<(std::ostream& os,
343 const MockCanvas::DrawDisplayListData&
data);
344extern bool operator==(
const MockCanvas::DrawShadowData&
a,
345 const MockCanvas::DrawShadowData&
b);
346extern std::ostream&
operator<<(std::ostream& os,
347 const MockCanvas::DrawShadowData&
data);
348extern bool operator==(
const MockCanvas::ClipRectData&
a,
349 const MockCanvas::ClipRectData&
b);
350extern std::ostream&
operator<<(std::ostream& os,
351 const MockCanvas::ClipRectData&
data);
352extern bool operator==(
const MockCanvas::ClipRRectData&
a,
353 const MockCanvas::ClipRRectData&
b);
354extern std::ostream&
operator<<(std::ostream& os,
355 const MockCanvas::ClipRRectData&
data);
356extern bool operator==(
const MockCanvas::ClipPathData&
a,
357 const MockCanvas::ClipPathData&
b);
358extern std::ostream&
operator<<(std::ostream& os,
359 const MockCanvas::ClipPathData&
data);
360extern std::ostream&
operator<<(std::ostream& os,
362extern bool operator==(
const MockCanvas::DrawCall&
a,
363 const MockCanvas::DrawCall&
b);
364extern std::ostream&
operator<<(std::ostream& os,
365 const MockCanvas::DrawCall&
draw);
366extern bool operator==(
const MockCanvas::DrawPaintData&
a,
367 const MockCanvas::DrawPaintData&
b);
368extern std::ostream&
operator<<(std::ostream& os,
369 const MockCanvas::DrawPaintData&
data);
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Developer-facing API for rendering anything within the engine.
virtual void Transform(const SkMatrix *matrix)=0
virtual void SetTransform(const SkMatrix *matrix)=0
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
SkM44 GetTransformFullPerspective() const override
void TransformFullPerspective(SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt, SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt, SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) override
void RestoreToCount(int restore_count)
void Translate(SkScalar tx, SkScalar ty) override
void DrawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void SetTransform(const SkMatrix *matrix) override
void DrawCircle(const SkPoint ¢er, SkScalar radius, const DlPaint &paint) override
SkMatrix GetTransform() const override
void Transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
void DrawTextBlob(const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const DlPaint &paint) override
SkRect GetLocalClipBounds() const override
SkRect GetDestinationClipBounds() const override
SkISize GetBaseLayerSize() const override
const std::vector< DrawCall > & draw_calls() const
void DrawImageNine(const sk_sp< DlImage > &image, const SkIRect ¢er, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr) override
SkImageInfo GetImageInfo() const override
void ClipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
void Transform(const SkMatrix *matrix) override
void DrawPaint(const DlPaint &paint) override
void DrawLine(const SkPoint &p0, const SkPoint &p1, const DlPaint &paint) override
void DrawImage(const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
void Scale(SkScalar sx, SkScalar sy) override
void Rotate(SkScalar degrees) override
void ClipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
void ClipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
void DrawImageRect(const sk_sp< DlImage > &image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, const DlPaint *paint=nullptr, SrcRectConstraint constraint=SrcRectConstraint::kFast) override
void DrawColor(DlColor color, DlBlendMode mode) override
void TransformReset() override
void DrawVertices(const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint) override
std::variant< SaveData, SaveLayerData, RestoreData, ConcatMatrixData, SetMatrixData, DrawRectData, DrawPathData, DrawTextData, DrawImageDataNoPaint, DrawImageData, DrawDisplayListData, DrawShadowData, ClipRectData, ClipRRectData, ClipPathData, DrawPaintData > DrawCallData
void DrawRect(const SkRect &rect, const DlPaint &paint) override
void DrawPath(const SkPath &path, const DlPaint &paint) override
void DrawRRect(const SkRRect &rrect, const DlPaint &paint) override
void DrawPoints(PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint) override
void DrawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity) override
void DrawAtlas(const sk_sp< DlImage > &atlas, const SkRSXform xform[], const SkRect tex[], const DlColor colors[], int count, DlBlendMode mode, DlImageSampling sampling, const SkRect *cullRect, const DlPaint *paint=nullptr) override
void DrawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y, const DlPaint &paint) override
void SaveLayer(const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
void Skew(SkScalar sx, SkScalar sy) override
void DrawDRRect(const SkRRect &outer, const SkRRect &inner, const DlPaint &paint) override
bool QuickReject(const SkRect &bounds) const override
void DrawOval(const SkRect &bounds, const DlPaint &paint) override
void DrawDashedLine(const DlPoint &p0, const DlPoint &p1, DlScalar on_length, DlScalar off_length, const DlPaint &paint) override
void DrawArc(const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint) override
sk_sp< const SkImage > atlas
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< const SkImageFilter > backdrop
sk_sp< SkBlender > blender SkRect rect
PODArray< SkColor > colors
SkSamplingOptions sampling
static std::ostream & operator<<(std::ostream &os, const SkPoint &r)
bool operator==(const CGRect &lhs, const CGRect &rhs)
static constexpr SkRect kEmptyRect
impeller::Scalar DlScalar
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
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
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 mode
static constexpr SkRect MakeEmpty()
sk_sp< DisplayList > display_list
bool transparent_occluder
sk_sp< SkData > serialized_text
std::shared_ptr< DlImageFilter > backdrop_filter