5#include "flutter/testing/mock_canvas.h"
7#include "flutter/fml/logging.h"
8#include "flutter/testing/display_list_testing.h"
22 : base_layer_size_({
width,
height}), current_layer_(0) {
27 EXPECT_EQ(current_layer_, 0);
31 return base_layer_size_;
40 draw_calls_.emplace_back(
42 state_stack_.emplace_back(state_stack_.back());
55 current_layer_ + 1}});
56 state_stack_.emplace_back(state_stack_.back());
63 draw_calls_.emplace_back(
65 state_stack_.pop_back();
92 draw_calls_.emplace_back(
94 state_stack_.back().transform(*
matrix);
99 state_stack_.back().transform(*
matrix);
103 draw_calls_.emplace_back(
105 state_stack_.back().setTransform(*
matrix);
110 state_stack_.back().setTransform(*
matrix);
115 state_stack_.back().setIdentity();
135 return state_stack_.back().matrix_4x4();
139 return state_stack_.back().matrix_3x3();
164 const std::shared_ptr<impeller::TextFrame>& text_frame,
182 bool transparent_occluder,
194 draw_calls_.emplace_back(
198 draw_calls_.emplace_back(
206 draw_calls_.emplace_back(
212 draw_calls_.emplace_back(
214 state_stack_.back().clipRect(
rect, op, is_aa);
219 draw_calls_.emplace_back(
221 state_stack_.back().clipRRect(
rrect, op, is_aa);
226 draw_calls_.emplace_back(
228 state_stack_.back().clipPath(
path, op, is_aa);
232 return state_stack_.back().device_cull_rect();
236 return state_stack_.back().local_cull_rect();
240 return state_stack_.back().content_culled(
bounds);
343 return os <<
"XY: " << r.
fX <<
", " << r.
fY;
347 return os <<
"LTRB: " << r.
fLeft <<
", " << r.
fTop <<
", " << r.
fRight <<
", "
357 return os <<
"Valid: " << r.
isValid()
358 <<
", FillType: " <<
static_cast<int>(r.
getFillType())
364 os <<
m.rc(0, 0) <<
", " <<
m.rc(0, 1) <<
", " <<
m.rc(0, 2) <<
", "
365 <<
m.rc(0, 3) << std::endl;
366 os <<
m.rc(1, 0) <<
", " <<
m.rc(1, 1) <<
", " <<
m.rc(1, 2) <<
", "
367 <<
m.rc(1, 3) << std::endl;
368 os <<
m.rc(2, 0) <<
", " <<
m.rc(2, 1) <<
", " <<
m.rc(2, 2) <<
", "
369 <<
m.rc(2, 3) << std::endl;
370 os <<
m.rc(3, 0) <<
", " <<
m.rc(3, 1) <<
", " <<
m.rc(3, 2) <<
", "
376 return a.save_to_layer ==
b.save_to_layer;
380 return os <<
data.save_to_layer;
385 return a.save_bounds ==
b.save_bounds &&
a.restore_paint ==
b.restore_paint &&
386 Equals(
a.backdrop_filter,
b.backdrop_filter) &&
387 a.save_to_layer ==
b.save_to_layer;
392 return os <<
data.save_bounds <<
" " <<
data.restore_paint <<
" "
393 <<
data.backdrop_filter <<
" " <<
data.save_to_layer;
398 return a.restore_to_layer ==
b.restore_to_layer;
403 return os <<
data.restore_to_layer;
408 return a.matrix ==
b.matrix;
413 return os <<
data.matrix;
418 return a.matrix ==
b.matrix;
423 return os <<
data.matrix;
428 return a.rect ==
b.rect &&
a.paint ==
b.paint;
433 return os <<
data.rect <<
" " <<
data.paint;
438 return a.path ==
b.path &&
a.paint ==
b.paint;
443 return os <<
data.path <<
" " <<
data.paint;
448 return a.serialized_text->equals(
b.serialized_text.get()) &&
449 a.paint ==
b.paint &&
a.offset ==
b.offset;
454 return os <<
data.serialized_text <<
" " <<
data.paint <<
" " <<
data.offset;
459 return a.image ==
b.image &&
a.
x ==
b.x &&
a.
y ==
b.y &&
460 a.options ==
b.options &&
a.paint ==
b.paint;
465 return os <<
data.image <<
" " <<
data.x <<
" " <<
data.y <<
" "
466 <<
data.options <<
" " <<
data.paint;
471 return a.image ==
b.image &&
a.
x ==
b.x &&
a.
y ==
b.y &&
472 a.options ==
b.options;
477 return os <<
data.image <<
" " <<
data.x <<
" " <<
data.y <<
" "
483 return a.display_list->Equals(
b.display_list) &&
a.opacity ==
b.opacity;
488 auto dl =
data.display_list;
489 return os <<
"[" << dl->unique_id() <<
" " << dl->op_count() <<
" "
490 << dl->bytes() <<
"] " <<
data.opacity;
495 return a.path ==
b.path &&
a.color ==
b.color &&
a.elevation ==
b.elevation &&
496 a.transparent_occluder ==
b.transparent_occluder &&
a.dpr ==
b.dpr;
501 return os <<
data.path <<
" " <<
data.color <<
" " <<
data.elevation <<
" "
502 <<
data.transparent_occluder <<
" " <<
data.dpr;
507 return a.rect ==
b.rect &&
a.clip_op ==
b.clip_op &&
a.style ==
b.style;
518 return os <<
data.rect <<
" " <<
data.clip_op <<
" " <<
data.style;
523 return a.rrect ==
b.rrect &&
a.clip_op ==
b.clip_op &&
a.style ==
b.style;
528 return os <<
data.rrect <<
" " <<
data.clip_op <<
" " <<
data.style;
533 return a.path ==
b.path &&
a.clip_op ==
b.clip_op &&
a.style ==
b.style;
538 return os <<
data.path <<
" " <<
data.clip_op <<
" " <<
data.style;
543 std::visit([&os](
auto&
d) { os <<
d; },
data);
548 return a.layer ==
b.layer &&
a.data ==
b.data;
552 return os <<
"[Layer: " <<
draw.layer <<
", Data: " <<
draw.data <<
"]";
557 return a.paint ==
b.paint;
562 return os <<
data.paint;
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
static sk_sp< SkData > MakeUninitialized(size_t length)
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
static SkMatrix RotateDeg(SkScalar deg)
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
static SkMatrix Skew(SkScalar kx, SkScalar ky)
SkPathFillType getFillType() const
const SkRect & getBounds() const
const SkRect & rect() const
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 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
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
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
#define FML_DCHECK(condition)
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< const SkImage > image
sk_sp< const SkImageFilter > backdrop
sk_sp< SkBlender > blender SkRect rect
static std::ostream & operator<<(std::ostream &os, const SkPoint &r)
bool operator==(const CGRect &lhs, const CGRect &rhs)
impeller::Scalar DlScalar
bool Equals(const T *a, const T *b)
impeller::Matrix DlMatrix
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
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 constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo MakeUnknown()
static constexpr SkPoint Make(float x, float y)
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
SkScalar fTop
smaller y-axis bounds
static constexpr TRect MakeXYWH(Type x, Type y, Type width, Type height)