Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
display_list_testing.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/testing/display_list_testing.h"
6
7#include <iomanip>
8
9#include "flutter/display_list/display_list.h"
10
11namespace flutter {
12namespace testing {
13
14// clang-format off
16 if (a->Equals(b)) {
17 return true;
18 }
19 FML_LOG(ERROR) << std::endl
20 << std::endl
21 << *a << std::endl
22 << "not identical to ..." << std::endl
23 << std::endl
24 << *b;
25 return false;
26}
27
29 if (a->Equals(b)) {
30 FML_LOG(ERROR) << std::endl
31 << "DisplayLists are both the same:" << std::endl
32 << *a;
33 return false;
34 }
35 return true;
36}
37
38std::ostream& operator<<(std::ostream& os,
39 const DisplayList& display_list) {
40 DisplayListStreamDispatcher dispatcher(os);
41 os << std::boolalpha;
42 os << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
43 os << "DisplayList {" << std::endl;
44 display_list.Dispatch(dispatcher);
45 os << "}" << std::endl;
46 return os;
47}
48
49std::ostream& operator<<(std::ostream& os, const DlPaint& paint) {
50 os << "DlPaint("
51 << "isaa: " << paint.isAntiAlias() << ", "
52 << paint.getColor() << ", "
53 << paint.getBlendMode() << ", "
54 << paint.getDrawStyle();
55 if (paint.getDrawStyle() != DlDrawStyle::kFill) {
56 os << ", width: " << paint.getStrokeWidth()
57 << ", miter: " << paint.getStrokeMiter()
58 << ", " << paint.getStrokeCap()
59 << ", " << paint.getStrokeJoin();
60 }
61 if (paint.getColorSource()) {
62 os << ", " << paint.getColorSource();
63 }
64 if (paint.getColorFilter()) {
65 os << ", " << paint.getColorFilter();
66 }
67 if (paint.getImageFilter()) {
68 os << ", " << paint.getImageFilter();
69 }
70 if (paint.getMaskFilter()) {
71 os << ", " << paint.getMaskFilter();
72 }
73 if (paint.isInvertColors()) {
74 os << ", invertColors: " << paint.isInvertColors();
75 }
76 return os << ")";
77}
78
79std::ostream& operator<<(std::ostream& os, const DlBlendMode& mode) {
80 switch (mode) {
81 case DlBlendMode::kClear: return os << "BlendMode::kClear";
82 case DlBlendMode::kSrc: return os << "BlendMode::kSrc";
83 case DlBlendMode::kDst: return os << "BlendMode::kDst";
84 case DlBlendMode::kSrcOver: return os << "BlendMode::kSrcOver";
85 case DlBlendMode::kDstOver: return os << "BlendMode::kDstOver";
86 case DlBlendMode::kSrcIn: return os << "BlendMode::kSrcIn";
87 case DlBlendMode::kDstIn: return os << "BlendMode::kDstIn";
88 case DlBlendMode::kSrcOut: return os << "BlendMode::kSrcOut";
89 case DlBlendMode::kDstOut: return os << "BlendMode::kDstOut";
90 case DlBlendMode::kSrcATop: return os << "BlendMode::kSrcATop";
91 case DlBlendMode::kDstATop: return os << "BlendMode::kDstATop";
92 case DlBlendMode::kXor: return os << "BlendMode::kXor";
93 case DlBlendMode::kPlus: return os << "BlendMode::kPlus";
94 case DlBlendMode::kModulate: return os << "BlendMode::kModulate";
95 case DlBlendMode::kScreen: return os << "BlendMode::kScreen";
96
97 case DlBlendMode::kOverlay: return os << "BlendMode::kOverlay";
98 case DlBlendMode::kDarken: return os << "BlendMode::kDarken";
99 case DlBlendMode::kLighten: return os << "BlendMode::kLighten";
100 case DlBlendMode::kColorDodge: return os << "BlendMode::kColorDodge";
101 case DlBlendMode::kColorBurn: return os << "BlendMode::kColorBurn";
102 case DlBlendMode::kHardLight: return os << "BlendMode::kHardLight";
103 case DlBlendMode::kSoftLight: return os << "BlendMode::kSoftLight";
104 case DlBlendMode::kDifference: return os << "BlendMode::kDifference";
105 case DlBlendMode::kExclusion: return os << "BlendMode::kExclusion";
106 case DlBlendMode::kMultiply: return os << "BlendMode::kMultiply";
107
108 case DlBlendMode::kHue: return os << "BlendMode::kHue";
109 case DlBlendMode::kSaturation: return os << "BlendMode::kSaturation";
110 case DlBlendMode::kColor: return os << "BlendMode::kColor";
111 case DlBlendMode::kLuminosity: return os << "BlendMode::kLuminosity";
112
113 default: return os << "BlendMode::????";
114 }
115}
116
117std::ostream& operator<<(std::ostream& os, const SaveLayerOptions& options) {
118 return os << "SaveLayerOptions("
119 << "can_distribute_opacity: " << options.can_distribute_opacity()
120 << ", "
121 << "renders_with_attributes: " << options.renders_with_attributes()
122 << ")";
123}
124
125static std::ostream& operator<<(std::ostream& os, const SkPoint& point) {
126 return os << "SkPoint(" << point.fX << ", " << point.fY << ")";
127}
128
129static std::ostream& operator<<(std::ostream& os, const SkIRect& rect) {
130 return os << "SkIRect("
131 << "left: " << rect.fLeft << ", "
132 << "top: " << rect.fTop << ", "
133 << "right: " << rect.fRight << ", "
134 << "bottom: " << rect.fBottom
135 << ")";
136}
137
138static std::ostream& operator<<(std::ostream& os, const SkRect& rect) {
139 return os << "SkRect("
140 << "left: " << rect.fLeft << ", "
141 << "top: " << rect.fTop << ", "
142 << "right: " << rect.fRight << ", "
143 << "bottom: " << rect.fBottom
144 << ")";
145}
146
147static std::ostream& operator<<(std::ostream& os, const SkRect* rect) {
148 return rect ? (os << "&" << *rect) : os << "no rect";
149}
150
151static std::ostream& operator<<(std::ostream& os, const SkRRect& rrect) {
152 return os << "SkRRect("
153 << rrect.rect() << ", "
154 << "ul: (" << rrect.radii(SkRRect::kUpperLeft_Corner).fX << ", "
155 << rrect.radii(SkRRect::kUpperLeft_Corner).fY << "), "
156 << "ur: (" << rrect.radii(SkRRect::kUpperRight_Corner).fX << ", "
157 << rrect.radii(SkRRect::kUpperRight_Corner).fY << "), "
158 << "lr: (" << rrect.radii(SkRRect::kLowerRight_Corner).fX << ", "
159 << rrect.radii(SkRRect::kLowerRight_Corner).fY << "), "
160 << "ll: (" << rrect.radii(SkRRect::kLowerLeft_Corner).fX << ", "
161 << rrect.radii(SkRRect::kLowerLeft_Corner).fY << ")"
162 << ")";
163}
164
165static std::ostream& operator<<(std::ostream& os, const SkPath& path) {
166 return os << "SkPath("
167 << "bounds: " << path.getBounds()
168 // should iterate over verbs and coordinates...
169 << ")";
170}
171
172static std::ostream& operator<<(std::ostream& os, const SkMatrix& matrix) {
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] << "]"
177 << ")";
178}
179
180static std::ostream& operator<<(std::ostream& os, const SkMatrix* matrix) {
181 if (matrix) return os << "&" << *matrix;
182 return os << "no matrix";
183}
184
185static std::ostream& operator<<(std::ostream& os, const SkRSXform& xform) {
186 return os << "SkRSXform("
187 << "scos: " << xform.fSCos << ", "
188 << "ssin: " << xform.fSSin << ", "
189 << "tx: " << xform.fTx << ", "
190 << "ty: " << xform.fTy << ")";
191}
192
193std::ostream& operator<<(std::ostream& os, const DlCanvas::ClipOp& op) {
194 switch (op) {
195 case DlCanvas::ClipOp::kDifference: return os << "ClipOp::kDifference";
196 case DlCanvas::ClipOp::kIntersect: return os << "ClipOp::kIntersect";
197 }
198}
199
200std::ostream& operator<<(std::ostream& os, const DlCanvas::SrcRectConstraint& constraint) {
201 switch (constraint) {
203 return os << "SrcRectConstraint::kFast";
205 return os << "SrcRectConstraint::kStrict";
206 }
207}
208
209std::ostream& operator<<(std::ostream& os, const DlStrokeCap& cap) {
210 switch (cap) {
211 case DlStrokeCap::kButt: return os << "Cap::kButt";
212 case DlStrokeCap::kRound: return os << "Cap::kRound";
213 case DlStrokeCap::kSquare: return os << "Cap::kSquare";
214 }
215}
216
217std::ostream& operator<<(std::ostream& os, const DlStrokeJoin& join) {
218 switch (join) {
219 case DlStrokeJoin::kMiter: return os << "Join::kMiter";
220 case DlStrokeJoin::kRound: return os << "Join::kRound";
221 case DlStrokeJoin::kBevel: return os << "Join::kBevel";
222 }
223}
224
225std::ostream& operator<<(std::ostream& os, const DlDrawStyle& style) {
226 switch (style) {
227 case DlDrawStyle::kFill: return os << "Style::kFill";
228 case DlDrawStyle::kStroke: return os << "Style::kStroke";
229 case DlDrawStyle::kStrokeAndFill: return os << "Style::kStrokeAnFill";
230 }
231}
232
233std::ostream& operator<<(std::ostream& os, const DlBlurStyle& style) {
234 switch (style) {
235 case DlBlurStyle::kNormal: return os << "BlurStyle::kNormal";
236 case DlBlurStyle::kSolid: return os << "BlurStyle::kSolid";
237 case DlBlurStyle::kOuter: return os << "BlurStyle::kOuter";
238 case DlBlurStyle::kInner: return os << "BlurStyle::kInner";
239 }
240}
241
242std::ostream& operator<<(std::ostream& os, const DlCanvas::PointMode& mode) {
243 switch (mode) {
244 case DlCanvas::PointMode::kPoints: return os << "PointMode::kPoints";
245 case DlCanvas::PointMode::kLines: return os << "PointMode::kLines";
246 case DlCanvas::PointMode::kPolygon: return os << "PointMode::kPolygon";
247 }
248}
249
250std::ostream& operator<<(std::ostream& os, const DlFilterMode& mode) {
251 switch (mode) {
252 case DlFilterMode::kNearest: return os << "FilterMode::kNearest";
253 case DlFilterMode::kLinear: return os << "FilterMode::kLinear";
254
255 default: return os << "FilterMode::????";
256 }
257}
258
259std::ostream& operator<<(std::ostream& os, const DlColor& color) {
260 return os << "DlColor(" << std::hex << color.argb() << std::dec << ")";
261}
262
263std::ostream& operator<<(std::ostream& os, DlImageSampling sampling) {
264 switch (sampling) {
266 return os << "NearestSampling";
267 }
269 return os << "LinearSampling";
270 }
272 return os << "MipmapSampling";
273 }
275 return os << "CubicSampling";
276 }
277 }
278}
279
280static std::ostream& operator<<(std::ostream& os, const SkTextBlob* blob) {
281 if (blob == nullptr) {
282 return os << "no text";
283 }
284 return os << "&SkTextBlob(ID: " << blob->uniqueID() << ", " << blob->bounds() << ")";
285}
286
287static std::ostream& operator<<(std::ostream& os,
288 const impeller::TextFrame* frame) {
289 if (frame == nullptr) {
290 return os << "no text";
291 }
292 auto bounds = frame->GetBounds();
293 return os << "&TextFrame("
294 << bounds.GetLeft() << ", " << bounds.GetTop() << " => "
295 << bounds.GetRight() << ", " << bounds.GetBottom() << ")";
296}
297
298std::ostream& operator<<(std::ostream& os, const DlVertexMode& mode) {
299 switch (mode) {
300 case DlVertexMode::kTriangles: return os << "VertexMode::kTriangles";
301 case DlVertexMode::kTriangleStrip: return os << "VertexMode::kTriangleStrip";
302 case DlVertexMode::kTriangleFan: return os << "VertexMode::kTriangleFan";
303
304 default: return os << "VertexMode::????";
305 }
306}
307
308std::ostream& operator<<(std::ostream& os, const DlTileMode& mode) {
309 switch (mode) {
310 case DlTileMode::kClamp: return os << "TileMode::kClamp";
311 case DlTileMode::kRepeat: return os << "TileMode::kRepeat";
312 case DlTileMode::kMirror: return os << "TileMode::kMirror";
313 case DlTileMode::kDecal: return os << "TileMode::kDecal";
314
315 default: return os << "TileMode::????";
316 }
317}
318
319std::ostream& operator<<(std::ostream& os, const DlImage* image) {
320 if (image == nullptr) {
321 return os << "null image";
322 }
323 os << "&DlImage(" << image->width() << " x " << image->height() << ", ";
324 if (image->skia_image()) {
325 os << "skia(" << image->skia_image().get() << "), ";
326 }
327 if (image->impeller_texture()) {
328 os << "impeller(" << image->impeller_texture().get() << "), ";
329 }
330 return os << "isTextureBacked: " << image->isTextureBacked() << ")";
331}
332
333std::ostream& DisplayListStreamDispatcher::startl() {
334 for (int i = 0; i < cur_indent_; i++) {
335 os_ << " ";
336 }
337 return os_;
338}
339
340template <class T>
341std::ostream& DisplayListStreamDispatcher::out_array(std::string name, // NOLINT(performance-unnecessary-value-param)
342 int count,
343 const T array[]) {
344 if (array == nullptr || count < 0) {
345 return os_ << "no " << name;
346 }
347 os_ << name << "[" << count << "] = [" << std::endl;
348 indent();
349 indent();
350 for (int i = 0; i < count; i++) {
351 startl() << array[i] << "," << std::endl;
352 }
353 outdent();
354 startl() << "]";
355 outdent();
356 return os_;
357}
358
360 startl() << "setAntiAlias(" << aa << ");" << std::endl;
361}
363 startl() << "setStyle(" << style << ");" << std::endl;
364}
366 startl() << "setColor(" << color << ");" << std::endl;
367}
369 startl() << "setStrokeWidth(" << width << ");" << std::endl;
370}
372 startl() << "setStrokeMiter(" << limit << ");" << std::endl;
373}
375 startl() << "setStrokeCap(" << cap << ");" << std::endl;
376}
378 startl() << "setStrokeJoin(" << join << ");" << std::endl;
379}
381 if (source == nullptr) {
382 startl() << "setColorSource(no ColorSource);" << std::endl;
383 return;
384 }
385 startl() << "setColorSource(";
386 switch (source->type()) {
388 const DlColorColorSource* color_src = source->asColor();
389 FML_DCHECK(color_src);
390 os_ << "DlColorColorSource(" << color_src->color() << ")";
391 break;
392 }
394 const DlImageColorSource* image_src = source->asImage();
395 FML_DCHECK(image_src);
396 os_ << "DlImageColorSource(image: " << image_src->image()
397 << ", hMode: " << image_src->horizontal_tile_mode()
398 << ", vMode: " << image_src->vertical_tile_mode()
399 << ", " << image_src->sampling()
400 << ", " << image_src->matrix_ptr()
401 << ")";
402 break;
403 }
405 const DlLinearGradientColorSource* linear_src = source->asLinearGradient();
406 FML_DCHECK(linear_src);
407 os_ << "DlLinearGradientSource("
408 << "start: " << linear_src->start_point()
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()) << ", "
412 << linear_src->tile_mode() << ", " << linear_src->matrix_ptr() << ")";
413 break;
414 }
416 const DlRadialGradientColorSource* radial_src = source->asRadialGradient();
417 FML_DCHECK(radial_src);
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()) << ", "
423 << radial_src->tile_mode() << ", " << radial_src->matrix_ptr() << ")";
424 break;
425 }
427 const DlConicalGradientColorSource* conical_src = source->asConicalGradient();
428 FML_DCHECK(conical_src);
429 os_ << "DlConicalGradientColorSource("
430 << "start center: " << conical_src->start_center()
431 << ", start radius: " << conical_src->start_radius()
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()) << ", "
436 << conical_src->tile_mode() << ", " << conical_src->matrix_ptr() << ")";
437 break;
438 }
440 const DlSweepGradientColorSource* sweep_src = source->asSweepGradient();
441 FML_DCHECK(sweep_src);
442 os_ << "DlSweepGradientColorSource("
443 << "center: " << sweep_src->center()
444 << ", start: " << sweep_src->start() << ", "
445 << ", end: " << sweep_src->end() << ", ";
446 out_array("colors", sweep_src->stop_count(), sweep_src->colors()) << ", ";
447 out_array("stops", sweep_src->stop_count(), sweep_src->stops()) << ", "
448 << sweep_src->tile_mode() << ", " << sweep_src->matrix_ptr() << ")";
449 break;
450 }
451 default:
452 os_ << "?DlUnknownColorSource?()";
453 break;
454 }
455 os_ << ");" << std::endl;
456}
457void DisplayListStreamDispatcher::out(const DlColorFilter& filter) {
458 switch (filter.type()) {
460 const DlBlendColorFilter* blend = filter.asBlend();
462 os_ << "DlBlendColorFilter(" << blend->color() << ", "
463 << static_cast<int>(blend->mode()) << ")";
464 break;
465 }
467 const DlMatrixColorFilter* matrix = filter.asMatrix();
468 FML_DCHECK(matrix);
469 float values[20];
470 matrix->get_matrix(values);
471 os_ << "DlMatrixColorFilter(matrix[20] = [" << std::endl;
472 indent();
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] << ","
479 << std::endl;
480 }
481 outdent();
482 startl() << "]";
483 break;
484 }
486 os_ << "DlSrgbToLinearGammaColorFilter()";
487 break;
488 }
490 os_ << "DlLinearToSrgbGammaColorFilter()";
491 break;
492 }
493 default:
494 os_ << "?DlUnknownColorFilter?()";
495 break;
496 }
497}
498void DisplayListStreamDispatcher::out(const DlColorFilter* filter) {
499 if (filter == nullptr) {
500 os_ << "no ColorFilter";
501 } else {
502 os_ << "&";
503 out(*filter);
504 }
505}
507 startl() << "setColorFilter(";
508 out(filter);
509 os_ << ");" << std::endl;
510}
512 startl() << "setInvertColors(" << invert << ");" << std::endl;
513}
515 startl() << "setBlendMode(" << mode << ");" << std::endl;
516}
518 startl() << "setPathEffect(" << effect << ");" << std::endl;
519}
521 if (filter == nullptr) {
522 startl() << "setMaskFilter(no MaskFilter);" << std::endl;
523 return;
524 }
525 startl() << "setMaskFilter(";
526 switch (filter->type()) {
528 const DlBlurMaskFilter* blur = filter->asBlur();
529 FML_DCHECK(blur);
530 os_ << "DlMaskFilter(" << blur->style() << ", " << blur->sigma() << ")";
531 break;
532 }
533 default:
534 os_ << "?DlUnknownMaskFilter?()";
535 break;
536 }
537 os_ << ");" << std::endl;
538}
539void DisplayListStreamDispatcher::out(const DlImageFilter& filter) {
540 switch (filter.type()) {
542 const DlBlurImageFilter* blur = filter.asBlur();
543 FML_DCHECK(blur);
544 os_ << "DlBlurImageFilter(" << blur->sigma_x() << ", "
545 << blur->sigma_y() << ", "
546 << blur->tile_mode() << ")";
547 break;
548 }
550 const DlDilateImageFilter* dilate = filter.asDilate();
551 FML_DCHECK(dilate);
552 os_ << "DlDilateImageFilter(" << dilate->radius_x() << ", " << dilate->radius_y() << ")";
553 break;
554 }
556 const DlErodeImageFilter* erode = filter.asErode();
557 FML_DCHECK(erode);
558 os_ << "DlDilateImageFilter(" << erode->radius_x() << ", " << erode->radius_y() << ")";
559 break;
560 }
562 const DlMatrixImageFilter* matrix = filter.asMatrix();
563 FML_DCHECK(matrix);
564 os_ << "DlMatrixImageFilter(" << matrix->matrix() << ", " << matrix->sampling() << ")";
565 break;
566 }
568 const DlComposeImageFilter* compose = filter.asCompose();
569 FML_DCHECK(compose);
570 os_ << "DlComposeImageFilter(" << std::endl;
571 indent();
572 startl() << "outer: ";
573 indent(7);
574 out(compose->outer().get());
575 os_ << "," << std::endl;
576 outdent(7);
577 startl() << "inner: ";
578 indent(7);
579 out(compose->inner().get());
580 os_ << std::endl;
581 outdent(7);
582 outdent();
583 startl() << ")";
584 break;
585 }
587 const DlColorFilterImageFilter* color_filter = filter.asColorFilter();
589 os_ << "DlColorFilterImageFilter(";
590 out(*color_filter->color_filter());
591 os_ << ")";
592 break;
593 }
595 const DlLocalMatrixImageFilter* local_matrix = filter.asLocalMatrix();
596 FML_DCHECK(local_matrix);
597 os_ << "DlLocalMatrixImageFilter(" << local_matrix->matrix();
598 os_ << "," << std::endl;
599 indent(25);
600 startl() << "filter: ";
601 out(local_matrix->image_filter().get());
602 os_ << std::endl;
603 outdent(25);
604 startl() << ")";
605 break;
606 }
607 }
608}
609void DisplayListStreamDispatcher::out(const DlImageFilter* filter) {
610 if (filter == nullptr) {
611 os_ << "no ImageFilter";
612 } else {
613 os_ << "&";
614 indent(1);
615 out(*filter);
616 outdent(1);
617 }
618}
620 startl() << "setImageFilter(";
621 indent(15);
622 out(filter);
623 outdent(15);
624 os_ << ");" << std::endl;
625}
627 startl() << "save();" << std::endl;
628 startl() << "{" << std::endl;
629 indent();
630}
633 const DlImageFilter* backdrop) {
634 startl() << "saveLayer(" << bounds << ", " << options;
635 if (backdrop) {
636 os_ << "," << std::endl;
637 indent(10);
638 startl() << "backdrop: ";
639 out(backdrop);
640 outdent(10);
641 } else {
642 os_ << ", no backdrop";
643 }
644 os_ << ");" << std::endl;
645 startl() << "{" << std::endl;
646 indent();
647}
649 outdent();
650 startl() << "}" << std::endl;
651 startl() << "restore();" << std::endl;
652}
653
655 startl() << "translate(" << tx << ", " << ty << ");" << std::endl;
656}
658 startl() << "scale(" << sx << ", " << sy << ");" << std::endl;
659}
661 startl() << "rotate(" << degrees << ");" << std::endl;
662}
664 startl() << "skew(" << sx << ", " << sy << ");" << std::endl;
665}
667 SkScalar mxx, SkScalar mxy, SkScalar mxt,
668 SkScalar myx, SkScalar myy, SkScalar myt) {
669 startl() << "transform2DAffine(" << std::endl;
670 indent();
671 {
672 startl()
673 << "[" << mxx << ", " << mxy << ", " << mxt << "], "
674 << std::endl;
675 startl()
676 << "[" << myx << ", " << myy << ", " << myt << "], "
677 << std::endl;
678 }
679 outdent();
680 startl() << ");" << std::endl;
681}
683 SkScalar mxx, SkScalar mxy, SkScalar mxz, SkScalar mxt,
684 SkScalar myx, SkScalar myy, SkScalar myz, SkScalar myt,
685 SkScalar mzx, SkScalar mzy, SkScalar mzz, SkScalar mzt,
686 SkScalar mwx, SkScalar mwy, SkScalar mwz, SkScalar mwt) {
687 startl() << "transformFullPerspective(" << std::endl;
688 indent();
689 {
690 startl()
691 << "[" << mxx << ", " << mxy << ", " << mxz << ", " << mxt << "], "
692 << std::endl;
693 startl()
694 << "[" << myx << ", " << myy << ", " << myz << ", " << myt << "], "
695 << std::endl;
696 startl()
697 << "[" << mzx << ", " << mzy << ", " << mzz << ", " << mzt << "], "
698 << std::endl;
699 startl()
700 << "[" << mwx << ", " << mwy << ", " << mwz << ", " << mwt << "]"
701 << std::endl;
702 }
703 outdent();
704 startl() << ");" << std::endl;
705}
707 startl() << "transformReset();" << std::endl;
708}
709
711 bool is_aa) {
712 startl() << "clipRect("
713 << rect << ", "
714 << clip_op << ", "
715 << "isaa: " << is_aa
716 << ");" << std::endl;
717}
719 ClipOp clip_op,
720 bool is_aa) {
721 startl() << "clipRRect("
722 << rrect << ", "
723 << clip_op << ", "
724 << "isaa: " << is_aa
725 << ");" << std::endl;
726}
728 bool is_aa) {
729 startl() << "clipPath("
730 << path << ", "
731 << clip_op << ", "
732 << "isaa: " << is_aa
733 << ");" << std::endl;
734}
735
737 startl() << "drawColor("
738 << color << ", "
739 << mode
740 << ");" << std::endl;
741}
743 startl() << "drawPaint();" << std::endl;
744}
746 const SkPoint& p1) {
747 startl() << "drawLine(" << p0 << ", " << p1 << ");" << std::endl;
748}
750 startl() << "drawRect(" << rect << ");" << std::endl;
751}
753 startl() << "drawOval(" << bounds << ");" << std::endl;
754}
756 SkScalar radius) {
757 startl() << "drawCircle(" << center << ", " << radius << ");" << std::endl;
758}
760 startl() << "drawRRect(" << rrect << ");" << std::endl;
761}
763 const SkRRect& inner) {
764 startl() << "drawDRRect(outer: " << outer << ", " << std::endl;
765 startl() << " inner: " << inner << ");" << std::endl;
766}
768 startl() << "drawPath(" << path << ");" << std::endl;
769}
771 SkScalar start_degrees,
772 SkScalar sweep_degrees,
773 bool use_center) {
774 startl() << "drawArc("
775 << oval_bounds << ", "
776 << start_degrees << ", "
777 << sweep_degrees << ", "
778 << "use_center: " << use_center
779 << ");" << std::endl;
780}
782 uint32_t count,
783 const SkPoint points[]) {
784 startl() << "drawPoints(" << mode << ", ";
785 out_array("points", count, points)
786 << ");" << std::endl;
787}
790 startl() << "drawVertices("
791 << "DlVertices("
792 << vertices->mode() << ", ";
793 out_array("vertices", vertices->vertex_count(), vertices->vertices()) << ", ";
794 out_array("texture_coords", vertices->vertex_count(), vertices->texture_coordinates()) << ", ";
795 out_array("colors", vertices->vertex_count(), vertices->colors()) << ", ";
796 out_array("indices", vertices->index_count(), vertices->indices())
797 << "), " << mode << ");" << std::endl;
798}
800 const SkPoint point,
801 DlImageSampling sampling,
802 bool render_with_attributes) {
803 startl() << "drawImage(" << image.get() << "," << std::endl;
804 startl() << " " << point << ", "
805 << sampling << ", "
806 << "with attributes: " << render_with_attributes
807 << ");" << std::endl;
808}
810 const SkRect& src,
811 const SkRect& dst,
812 DlImageSampling sampling,
813 bool render_with_attributes,
814 SrcRectConstraint constraint) {
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 << ", "
820 << constraint
821 << ");" << std::endl;
822}
824 const SkIRect& center,
825 const SkRect& dst,
826 DlFilterMode filter,
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;
834}
836 const SkRSXform xform[],
837 const SkRect tex[],
838 const DlColor colors[],
839 int count,
841 DlImageSampling sampling,
842 const SkRect* cull_rect,
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;
851}
853 const sk_sp<DisplayList> display_list, SkScalar opacity) {
854 startl() << "drawDisplayList("
855 << "ID: " << display_list->unique_id() << ", "
856 << "bounds: " << display_list->bounds() << ", "
857 << "opacity: " << opacity
858 << ");" << std::endl;
859}
861 SkScalar x,
862 SkScalar y) {
863 startl() << "drawTextBlob("
864 << blob.get() << ", "
865 << x << ", " << y << ");" << std::endl;
866}
867
869 const std::shared_ptr<impeller::TextFrame>& text_frame,
870 SkScalar x,
871 SkScalar y) {
872 startl() << "drawTextFrame("
873 << text_frame.get() << ", "
874 << x << ", " << y << ");" << std::endl;
875}
876
878 const DlColor color,
879 const SkScalar elevation,
880 bool transparent_occluder,
881 SkScalar dpr) {
882 startl() << "drawShadow("
883 << path << ", "
884 << color << ", "
885 << elevation << ", "
886 << transparent_occluder << ", "
887 << dpr
888 << ");" << std::endl;
889}
890// clang-format on
891
892} // namespace testing
893} // namespace flutter
const char * options
int count
static const int points[]
SkColor4f color
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
static SkScalar center(float pos0, float pos1)
sk_sp< SkImage > asImage() const
Definition SkBitmap.cpp:645
int width() const
Definition SkImage.h:285
virtual bool isTextureBacked() const =0
int height() const
Definition SkImage.h:291
const SkRect & rect() const
Definition SkRRect.h:264
SkVector radii(Corner corner) const
Definition SkRRect.h:271
@ kUpperLeft_Corner
index of top-left corner radii
Definition SkRRect.h:252
@ kLowerRight_Corner
index of bottom-right corner radii
Definition SkRRect.h:254
@ kUpperRight_Corner
index of top-right corner radii
Definition SkRRect.h:253
@ kLowerLeft_Corner
index of bottom-left corner radii
Definition SkRRect.h:255
uint32_t uniqueID() const
Definition SkTextBlob.h:59
const SkRect & bounds() const
Definition SkTextBlob.h:53
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
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.
Definition dl_image.h:30
virtual const DlBlurMaskFilter * asBlur() const
const SkMatrix * matrix_ptr() const
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
Definition dl_vertices.h:71
const DlColor * colors() const
int vertex_count() const
DlVertexMode mode() const
int index_count() 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 drawOval(const SkRect &bounds) override
void setImageFilter(const DlImageFilter *filter) override
void drawVertices(const DlVertices *vertices, DlBlendMode mode) override
void drawDRRect(const SkRRect &outer, const SkRRect &inner) 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 drawTextFrame(const std::shared_ptr< impeller::TextFrame > &text_frame, SkScalar x, SkScalar y) override
void drawImageNine(const sk_sp< DlImage > image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, bool render_with_attributes) 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 translate(SkScalar tx, SkScalar ty) override
void saveLayer(const SkRect &bounds, const SaveLayerOptions options, const DlImageFilter *backdrop) 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 &center, 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 drawLine(const SkPoint &p0, const SkPoint &p1) override
void drawPoints(PointMode mode, uint32_t count, const SkPoint points[]) override
void drawColor(DlColor color, DlBlendMode mode) 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.
Definition text_frame.h:20
T * get() const
Definition SkRefCnt.h:303
const Paint & paint
sk_sp< SkImage > image
Definition examples.cpp:29
SkBitmap source
Definition examples.cpp:28
double frame
Definition examples.cpp:31
float SkScalar
Definition extension.cpp:12
static bool b
struct MyStruct a[10]
gboolean invert
#define FML_LOG(severity)
Definition logging.h:82
#define FML_DCHECK(condition)
Definition logging.h:103
static SkColor blend(SkColor dst, SkColor src, void(*mode)(float, float, float, float *, float *, float *))
Definition hsl.cpp:142
double y
double x
unsigned useCenter Optional< SkMatrix > matrix
Definition SkRecords.h:258
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)
DlStrokeJoin
Definition dl_paint.h:38
@ kMiter
extends to miter limit
@ kBevel
connects outside edges
DlStrokeCap
Definition dl_paint.h:29
@ kRound
adds circle
@ kButt
no stroke extension
@ kSquare
adds square
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
Definition switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
DlVertexMode
Defines the way in which the vertices of a DlVertices object are separated into triangles into which ...
Definition dl_vertices.h:20
@ kTriangles
The vertices are taken 3 at a time to form a triangle.
DlDrawStyle
Definition dl_paint.h:20
@ 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
Definition switches.h:228
@ kSrcOut
r = s * (1-da)
@ 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
@ kPlus
r = min(s + d, 1)
@ 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
@ kScreen
r = s + d - s*d
@ 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
@ kDstOut
r = d * (1-sa)
@ kDarken
rc = s + d - max(s*da, d*sa), ra = kSrcOver
#define T
int32_t width
float fX
x-axis value
float fY
y-axis value
SkScalar fTy
Definition SkRSXform.h:45
SkScalar fSCos
Definition SkRSXform.h:42
SkScalar fTx
Definition SkRSXform.h:44
SkScalar fSSin
Definition SkRSXform.h:43
#define ERROR(message)