5#include "flutter/testing/display_list_testing.h"
9#include "flutter/display_list/display_list.h"
22 <<
"not identical to ..." << std::endl
31 <<
"DisplayLists are both the same:" << std::endl
42 os << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
43 os <<
"DisplayList {" << std::endl;
45 os <<
"}" << std::endl;
51 <<
"isaa: " <<
paint.isAntiAlias() <<
", "
52 <<
paint.getColor() <<
", "
53 <<
paint.getBlendMode() <<
", "
54 <<
paint.getDrawStyle();
56 os <<
", width: " <<
paint.getStrokeWidth()
57 <<
", miter: " <<
paint.getStrokeMiter()
58 <<
", " <<
paint.getStrokeCap()
59 <<
", " <<
paint.getStrokeJoin();
61 if (
paint.getColorSource()) {
62 os <<
", " <<
paint.getColorSource();
64 if (
paint.getColorFilter()) {
65 os <<
", " <<
paint.getColorFilter();
67 if (
paint.getImageFilter()) {
68 os <<
", " <<
paint.getImageFilter();
70 if (
paint.getMaskFilter()) {
71 os <<
", " <<
paint.getMaskFilter();
73 if (
paint.isInvertColors()) {
74 os <<
", invertColors: " <<
paint.isInvertColors();
113 default:
return os <<
"BlendMode::????";
118 return os <<
"SaveLayerOptions("
119 <<
"can_distribute_opacity: " <<
options.can_distribute_opacity()
121 <<
"renders_with_attributes: " <<
options.renders_with_attributes()
126 return os <<
"SkPoint(" << point.
fX <<
", " << point.
fY <<
")";
130 return os <<
"SkIRect("
131 <<
"left: " << rect.fLeft <<
", "
132 <<
"top: " << rect.fTop <<
", "
133 <<
"right: " << rect.fRight <<
", "
134 <<
"bottom: " << rect.fBottom
139 return os <<
"SkRect("
140 <<
"left: " << rect.fLeft <<
", "
141 <<
"top: " << rect.fTop <<
", "
142 <<
"right: " << rect.fRight <<
", "
143 <<
"bottom: " << rect.fBottom
148 return rect ? (os <<
"&" << *rect) : os <<
"no rect";
152 return os <<
"SkRRect("
153 << rrect.
rect() <<
", "
166 return os <<
"SkPath("
167 <<
"bounds: " <<
path.getBounds()
173 return os <<
"SkMatrix("
174 <<
"[" << matrix[0] <<
", " << matrix[1] <<
", " << matrix[2] <<
"], "
175 <<
"[" << matrix[3] <<
", " << matrix[4] <<
", " << matrix[5] <<
"], "
176 <<
"[" << matrix[6] <<
", " << matrix[7] <<
", " << matrix[8] <<
"]"
181 if (matrix)
return os <<
"&" << *matrix;
182 return os <<
"no matrix";
186 return os <<
"SkRSXform("
187 <<
"scos: " << xform.
fSCos <<
", "
188 <<
"ssin: " << xform.
fSSin <<
", "
189 <<
"tx: " << xform.
fTx <<
", "
190 <<
"ty: " << xform.
fTy <<
")";
201 switch (constraint) {
203 return os <<
"SrcRectConstraint::kFast";
205 return os <<
"SrcRectConstraint::kStrict";
255 default:
return os <<
"FilterMode::????";
260 return os <<
"DlColor(" << std::hex <<
color.argb() << std::dec <<
")";
266 return os <<
"NearestSampling";
269 return os <<
"LinearSampling";
272 return os <<
"MipmapSampling";
275 return os <<
"CubicSampling";
281 if (blob ==
nullptr) {
282 return os <<
"no text";
284 return os <<
"&SkTextBlob(ID: " << blob->
uniqueID() <<
", " << blob->
bounds() <<
")";
289 if (
frame ==
nullptr) {
290 return os <<
"no text";
292 auto bounds =
frame->GetBounds();
293 return os <<
"&TextFrame("
294 << bounds.GetLeft() <<
", " << bounds.GetTop() <<
" => "
295 << bounds.GetRight() <<
", " << bounds.GetBottom() <<
")";
304 default:
return os <<
"VertexMode::????";
315 default:
return os <<
"TileMode::????";
320 if (
image ==
nullptr) {
321 return os <<
"null image";
324 if (
image->skia_image()) {
325 os <<
"skia(" <<
image->skia_image().get() <<
"), ";
327 if (
image->impeller_texture()) {
328 os <<
"impeller(" <<
image->impeller_texture().get() <<
"), ";
333std::ostream& DisplayListStreamDispatcher::startl() {
334 for (
int i = 0; i < cur_indent_; i++) {
341std::ostream& DisplayListStreamDispatcher::out_array(std::string
name,
344 if (array ==
nullptr ||
count < 0) {
345 return os_ <<
"no " <<
name;
347 os_ <<
name <<
"[" <<
count <<
"] = [" << std::endl;
350 for (
int i = 0; i <
count; i++) {
351 startl() << array[i] <<
"," << std::endl;
360 startl() <<
"setAntiAlias(" << aa <<
");" << std::endl;
363 startl() <<
"setStyle(" << style <<
");" << std::endl;
366 startl() <<
"setColor(" <<
color <<
");" << std::endl;
369 startl() <<
"setStrokeWidth(" <<
width <<
");" << std::endl;
372 startl() <<
"setStrokeMiter(" << limit <<
");" << std::endl;
375 startl() <<
"setStrokeCap(" << cap <<
");" << std::endl;
378 startl() <<
"setStrokeJoin(" << join <<
");" << std::endl;
382 startl() <<
"setColorSource(no ColorSource);" << std::endl;
385 startl() <<
"setColorSource(";
390 os_ <<
"DlColorColorSource(" << color_src->
color() <<
")";
396 os_ <<
"DlImageColorSource(image: " << image_src->
image()
407 os_ <<
"DlLinearGradientSource("
409 <<
", end: " << linear_src->
end_point() <<
", ";
410 out_array(
"colors", linear_src->
stop_count(), linear_src->
colors()) <<
", ";
411 out_array(
"stops", linear_src->
stop_count(), linear_src->
stops()) <<
", "
418 os_ <<
"DlRadialGradientSource("
419 <<
"center: " << radial_src->
center()
420 <<
", radius: " << radial_src->
radius() <<
", ";
421 out_array(
"colors", radial_src->
stop_count(), radial_src->
colors()) <<
", ";
422 out_array(
"stops", radial_src->
stop_count(), radial_src->
stops()) <<
", "
429 os_ <<
"DlConicalGradientColorSource("
432 <<
", end center: " << conical_src->
end_center()
433 <<
", end radius: " << conical_src->
end_radius() <<
", ";
434 out_array(
"colors", conical_src->
stop_count(), conical_src->
colors()) <<
", ";
435 out_array(
"stops", conical_src->
stop_count(), conical_src->
stops()) <<
", "
442 os_ <<
"DlSweepGradientColorSource("
443 <<
"center: " << sweep_src->
center()
444 <<
", start: " << sweep_src->
start() <<
", "
445 <<
", end: " << sweep_src->
end() <<
", ";
447 out_array(
"stops", sweep_src->
stop_count(), sweep_src->
stops()) <<
", "
452 os_ <<
"?DlUnknownColorSource?()";
455 os_ <<
");" << std::endl;
457void DisplayListStreamDispatcher::out(
const DlColorFilter& filter) {
458 switch (filter.
type()) {
462 os_ <<
"DlBlendColorFilter(" <<
blend->color() <<
", "
463 <<
static_cast<int>(
blend->mode()) <<
")";
470 matrix->get_matrix(values);
471 os_ <<
"DlMatrixColorFilter(matrix[20] = [" << std::endl;
473 for (
int i = 0; i < 20; i += 5) {
474 startl() << values[i] <<
", "
475 << values[i+1] <<
", "
476 << values[i+2] <<
", "
477 << values[i+3] <<
", "
478 << values[i+4] <<
","
486 os_ <<
"DlSrgbToLinearGammaColorFilter()";
490 os_ <<
"DlLinearToSrgbGammaColorFilter()";
494 os_ <<
"?DlUnknownColorFilter?()";
498void DisplayListStreamDispatcher::out(
const DlColorFilter* filter) {
499 if (filter ==
nullptr) {
500 os_ <<
"no ColorFilter";
507 startl() <<
"setColorFilter(";
509 os_ <<
");" << std::endl;
512 startl() <<
"setInvertColors(" <<
invert <<
");" << std::endl;
515 startl() <<
"setBlendMode(" <<
mode <<
");" << std::endl;
518 startl() <<
"setPathEffect(" << effect <<
");" << std::endl;
521 if (filter ==
nullptr) {
522 startl() <<
"setMaskFilter(no MaskFilter);" << std::endl;
525 startl() <<
"setMaskFilter(";
526 switch (filter->
type()) {
530 os_ <<
"DlMaskFilter(" << blur->
style() <<
", " << blur->
sigma() <<
")";
534 os_ <<
"?DlUnknownMaskFilter?()";
537 os_ <<
");" << std::endl;
539void DisplayListStreamDispatcher::out(
const DlImageFilter& filter) {
540 switch (filter.
type()) {
544 os_ <<
"DlBlurImageFilter(" << blur->
sigma_x() <<
", "
552 os_ <<
"DlDilateImageFilter(" << dilate->
radius_x() <<
", " << dilate->
radius_y() <<
")";
556 const DlErodeImageFilter* erode = filter.
asErode();
558 os_ <<
"DlDilateImageFilter(" << erode->radius_x() <<
", " << erode->radius_y() <<
")";
564 os_ <<
"DlMatrixImageFilter(" <<
matrix->matrix() <<
", " <<
matrix->sampling() <<
")";
568 const DlComposeImageFilter* compose = filter.
asCompose();
570 os_ <<
"DlComposeImageFilter(" << std::endl;
572 startl() <<
"outer: ";
574 out(compose->outer().get());
575 os_ <<
"," << std::endl;
577 startl() <<
"inner: ";
579 out(compose->inner().get());
589 os_ <<
"DlColorFilterImageFilter(";
595 const DlLocalMatrixImageFilter* local_matrix = filter.
asLocalMatrix();
597 os_ <<
"DlLocalMatrixImageFilter(" << local_matrix->matrix();
598 os_ <<
"," << std::endl;
600 startl() <<
"filter: ";
601 out(local_matrix->image_filter().get());
609void DisplayListStreamDispatcher::out(
const DlImageFilter* filter) {
610 if (filter ==
nullptr) {
611 os_ <<
"no ImageFilter";
620 startl() <<
"setImageFilter(";
624 os_ <<
");" << std::endl;
627 startl() <<
"save();" << std::endl;
628 startl() <<
"{" << std::endl;
634 startl() <<
"saveLayer(" << bounds <<
", " <<
options;
636 os_ <<
"," << std::endl;
638 startl() <<
"backdrop: ";
642 os_ <<
", no backdrop";
644 os_ <<
");" << std::endl;
645 startl() <<
"{" << std::endl;
650 startl() <<
"}" << std::endl;
651 startl() <<
"restore();" << std::endl;
655 startl() <<
"translate(" << tx <<
", " << ty <<
");" << std::endl;
658 startl() <<
"scale(" << sx <<
", " << sy <<
");" << std::endl;
661 startl() <<
"rotate(" << degrees <<
");" << std::endl;
664 startl() <<
"skew(" << sx <<
", " << sy <<
");" << std::endl;
669 startl() <<
"transform2DAffine(" << std::endl;
673 <<
"[" << mxx <<
", " << mxy <<
", " << mxt <<
"], "
676 <<
"[" << myx <<
", " << myy <<
", " << myt <<
"], "
680 startl() <<
");" << std::endl;
687 startl() <<
"transformFullPerspective(" << std::endl;
691 <<
"[" << mxx <<
", " << mxy <<
", " << mxz <<
", " << mxt <<
"], "
694 <<
"[" << myx <<
", " << myy <<
", " << myz <<
", " << myt <<
"], "
697 <<
"[" << mzx <<
", " << mzy <<
", " << mzz <<
", " << mzt <<
"], "
700 <<
"[" << mwx <<
", " << mwy <<
", " << mwz <<
", " << mwt <<
"]"
704 startl() <<
");" << std::endl;
707 startl() <<
"transformReset();" << std::endl;
712 startl() <<
"clipRect("
716 <<
");" << std::endl;
721 startl() <<
"clipRRect("
725 <<
");" << std::endl;
729 startl() <<
"clipPath("
733 <<
");" << std::endl;
737 startl() <<
"drawColor("
740 <<
");" << std::endl;
743 startl() <<
"drawPaint();" << std::endl;
747 startl() <<
"drawLine(" << p0 <<
", " << p1 <<
");" << std::endl;
750 startl() <<
"drawRect(" << rect <<
");" << std::endl;
753 startl() <<
"drawOval(" << bounds <<
");" << std::endl;
757 startl() <<
"drawCircle(" <<
center <<
", " << radius <<
");" << std::endl;
760 startl() <<
"drawRRect(" << rrect <<
");" << std::endl;
764 startl() <<
"drawDRRect(outer: " << outer <<
", " << std::endl;
765 startl() <<
" inner: " << inner <<
");" << std::endl;
768 startl() <<
"drawPath(" <<
path <<
");" << std::endl;
774 startl() <<
"drawArc("
775 << oval_bounds <<
", "
776 << start_degrees <<
", "
777 << sweep_degrees <<
", "
778 <<
"use_center: " << use_center
779 <<
");" << std::endl;
784 startl() <<
"drawPoints(" <<
mode <<
", ";
786 <<
");" << std::endl;
790 startl() <<
"drawVertices("
792 << vertices->
mode() <<
", ";
797 <<
"), " <<
mode <<
");" << std::endl;
802 bool render_with_attributes) {
803 startl() <<
"drawImage(" <<
image.
get() <<
"," << std::endl;
804 startl() <<
" " << point <<
", "
806 <<
"with attributes: " << render_with_attributes
807 <<
");" << std::endl;
813 bool render_with_attributes,
815 startl() <<
"drawImageRect(" <<
image.
get() <<
"," << std::endl;
816 startl() <<
" src: " << src <<
"," << std::endl;
817 startl() <<
" dst: " << dst <<
"," << std::endl;
818 startl() <<
" " << sampling <<
", "
819 <<
"with attributes: " << render_with_attributes <<
", "
821 <<
");" << std::endl;
827 bool render_with_attributes) {
828 startl() <<
"drawImageNine(" <<
image.
get() <<
"," << std::endl;
829 startl() <<
" center: " <<
center <<
"," << std::endl;
830 startl() <<
" dst: " << dst <<
"," << std::endl;
831 startl() <<
" " << filter <<
", "
832 <<
"with attributes: " << render_with_attributes
833 <<
");" << std::endl;
843 bool render_with_attributes) {
844 startl() <<
"drawAtlas(" << atlas.
get() <<
", ";
845 out_array(
"xforms",
count, xform) <<
", ";
846 out_array(
"tex_coords",
count, tex) <<
", ";
847 out_array(
"colors",
count, colors) <<
", "
848 <<
mode <<
", " << sampling <<
", cull: " << cull_rect <<
", "
849 <<
"with attributes: " << render_with_attributes
850 <<
");" << std::endl;
854 startl() <<
"drawDisplayList("
855 <<
"ID: " << display_list->unique_id() <<
", "
856 <<
"bounds: " << display_list->bounds() <<
", "
857 <<
"opacity: " << opacity
858 <<
");" << std::endl;
863 startl() <<
"drawTextBlob("
864 << blob.
get() <<
", "
865 <<
x <<
", " <<
y <<
");" << std::endl;
869 const std::shared_ptr<impeller::TextFrame>& text_frame,
872 startl() <<
"drawTextFrame("
873 << text_frame.get() <<
", "
874 <<
x <<
", " <<
y <<
");" << std::endl;
880 bool transparent_occluder,
882 startl() <<
"drawShadow("
886 << transparent_occluder <<
", "
888 <<
");" << std::endl;
static const int points[]
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
static SkScalar center(float pos0, float pos1)
sk_sp< SkImage > asImage() const
virtual bool isTextureBacked() const =0
const SkRect & rect() const
SkVector radii(Corner corner) const
@ kUpperLeft_Corner
index of top-left corner radii
@ kLowerRight_Corner
index of bottom-right corner radii
@ kUpperRight_Corner
index of top-right corner radii
@ kLowerLeft_Corner
index of bottom-left corner radii
uint32_t uniqueID() const
const SkRect & bounds() const
void Dispatch(DlOpReceiver &ctx) const
virtual T type() const =0
DlTileMode tile_mode() const
DlBlurStyle style() const
@ kLines
draw each separate pair of points as a line segment
@ kPolygon
draw each pair of overlapping points as a line segment
@ kPoints
draw each point separately
virtual const DlBlendColorFilter * asBlend() const
virtual const DlMatrixColorFilter * asMatrix() const
SkScalar end_radius() const
SkPoint end_center() const
SkPoint start_center() const
SkScalar start_radius() const
SkScalar radius_y() const
SkScalar radius_x() const
DlTileMode tile_mode() const
const DlColor * colors() const
const float * stops() const
DlImageSampling sampling() const
DlTileMode vertical_tile_mode() const
DlTileMode horizontal_tile_mode() const
sk_sp< const DlImage > image() const
virtual const DlLocalMatrixImageFilter * asLocalMatrix() const
virtual const DlColorFilterImageFilter * asColorFilter() const
virtual const DlMatrixImageFilter * asMatrix() const
virtual const DlComposeImageFilter * asCompose() const
virtual const DlBlurImageFilter * asBlur() const
virtual const DlDilateImageFilter * asDilate() const
virtual const DlErodeImageFilter * asErode() const
Represents an image whose allocation is (usually) resident on device memory.
const SkPoint & start_point() const
const SkPoint & end_point() const
virtual const DlBlurMaskFilter * asBlur() const
const SkMatrix * matrix_ptr() const
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
const DlColor * colors() const
DlVertexMode mode() const
const SkPoint * vertices() const
Returns a pointer to the vertex information. Should be non-null.
const uint16_t * indices() const
const SkPoint * texture_coordinates() const
void setInvertColors(bool invert) override
void drawOval(const SkRect &bounds) override
void drawRect(const SkRect &rect) override
void setImageFilter(const DlImageFilter *filter) override
void setStrokeCap(DlStrokeCap cap) override
void drawVertices(const DlVertices *vertices, DlBlendMode mode) override
void drawDRRect(const SkRRect &outer, const SkRRect &inner) override
void setStrokeMiter(SkScalar limit) override
void clipRect(const SkRect &rect, ClipOp clip_op, bool is_aa) override
void drawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void setAntiAlias(bool aa) override
void drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
void drawImageNine(const sk_sp< DlImage > image, const SkIRect ¢er, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) override
void setStrokeWidth(SkScalar width) override
void setMaskFilter(const DlMaskFilter *filter) override
void drawImageRect(const sk_sp< DlImage > image, const SkRect &src, const SkRect &dst, DlImageSampling sampling, bool render_with_attributes, SrcRectConstraint constraint) override
void drawPath(const SkPath &path) override
void translate(SkScalar tx, SkScalar ty) override
void rotate(SkScalar degrees) override
void saveLayer(const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) override
void setStrokeJoin(DlStrokeJoin join) override
void transform2DAffine(SkScalar mxx, SkScalar mxy, SkScalar mxt, SkScalar myx, SkScalar myy, SkScalar myt) override
void setColorFilter(const DlColorFilter *filter) override
void drawArc(const SkRect &oval_bounds, SkScalar start_degrees, SkScalar sweep_degrees, bool use_center) override
void drawCircle(const SkPoint ¢er, SkScalar radius) override
void drawImage(const sk_sp< DlImage > image, const SkPoint point, DlImageSampling sampling, bool render_with_attributes) 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 *cull_rect, bool render_with_attributes) override
void drawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity) override
void clipRRect(const SkRRect &rrect, ClipOp clip_op, bool is_aa) override
void setBlendMode(DlBlendMode mode) override
void drawLine(const SkPoint &p0, const SkPoint &p1) override
void setDrawStyle(DlDrawStyle style) override
void transformReset() override
void drawPaint() override
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
void drawColor(DlColor color, DlBlendMode mode) override
void setColor(DlColor color) override
void skew(SkScalar sx, SkScalar sy) override
void drawRRect(const SkRRect &rrect) override
void setColorSource(const DlColorSource *source) override
void setPathEffect(const DlPathEffect *effect) override
void scale(SkScalar sx, SkScalar sy) 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 drawTextBlob(const sk_sp< SkTextBlob > blob, SkScalar x, SkScalar y) override
void clipPath(const SkPath &path, ClipOp clip_op, bool is_aa) override
Represents a collection of shaped text runs.
#define FML_LOG(severity)
#define FML_DCHECK(condition)
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
unsigned useCenter Optional< SkMatrix > matrix
bool DisplayListsNE_Verbose(const DisplayList *a, const DisplayList *b)
std::ostream & operator<<(std::ostream &os, const DisplayList &display_list)
bool DisplayListsEQ_Verbose(const DisplayList *a, const DisplayList *b)
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
@ kButt
no stroke extension
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
DlVertexMode
Defines the way in which the vertices of a DlVertices object are separated into triangles into which ...
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
@ kStrokeAndFill
both strokes and fills shapes
@ kStroke
strokes boundary of shapes
@ kFill
fills interior of shapes
@ kNormal
fuzzy inside and outside
@ kOuter
nothing inside, fuzzy outside
@ kInner
fuzzy inside, nothing outside
@ kSolid
solid inside, fuzzy outside
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
@ kExclusion
rc = s + d - two(s*d), ra = kSrcOver
@ kSaturation
saturation of source with hue and luminosity of destination
@ kColorBurn
darken destination to reflect source
@ kLighten
rc = s + d - min(s*da, d*sa), ra = kSrcOver
@ kHue
hue of source with saturation and luminosity of destination
@ kMultiply
r = s*(1-da) + d*(1-sa) + s*d
@ kColorDodge
brighten destination to reflect source
@ kSrcOver
r = s + (1-sa)*d
@ kXor
r = s*(1-da) + d*(1-sa)
@ kLuminosity
luminosity of source with hue and saturation of destination
@ kSoftLight
lighten or darken, depending on source
@ kDifference
rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
@ kOverlay
multiply or screen, depending on destination
@ kSrcATop
r = s*da + d*(1-sa)
@ kDstATop
r = d*sa + s*(1-da)
@ kDstOver
r = d + (1-da)*s
@ kColor
hue and saturation of source with luminosity of destination
@ kHardLight
multiply or screen, depending on source
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver