Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
canvas.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/lib/ui/painting/canvas.h"
6
7#include <cmath>
8
9#include "flutter/display_list/dl_builder.h"
10#include "flutter/lib/ui/floating_point.h"
11#include "flutter/lib/ui/painting/image.h"
12#include "flutter/lib/ui/painting/image_filter.h"
13#include "flutter/lib/ui/painting/paint.h"
14#include "flutter/lib/ui/ui_dart_state.h"
15#include "flutter/lib/ui/window/platform_configuration.h"
16
17using tonic::ToDart;
18
19namespace flutter {
20
22
24 PictureRecorder* recorder,
25 double left,
26 double top,
27 double right,
28 double bottom) {
30
31 if (!recorder) {
33 ToDart("Canvas constructor called with non-genuine PictureRecorder."));
34 return;
35 }
36
37 fml::RefPtr<Canvas> canvas =
38 fml::MakeRefCounted<Canvas>(recorder->BeginRecording(
40 SafeNarrow(bottom))));
41 recorder->set_canvas(canvas);
42 canvas->AssociateWithDartWrapper(wrapper);
43}
44
45Canvas::Canvas(sk_sp<DisplayListBuilder> builder)
46 : display_list_builder_(std::move(builder)) {}
47
49
51 if (display_list_builder_) {
52 builder()->Save();
53 }
54}
55
57 Dart_Handle paint_data) {
58 Paint paint(paint_objects, paint_data);
59
60 FML_DCHECK(paint.isNotNull());
61 if (display_list_builder_) {
62 DlPaint dl_paint;
63 const DlPaint* save_paint = paint.paint(dl_paint, kSaveLayerWithPaintFlags);
64 FML_DCHECK(save_paint);
65 TRACE_EVENT0("flutter", "ui.Canvas::saveLayer (Recorded)");
66 builder()->SaveLayer(nullptr, save_paint);
67 }
68}
69
71 double top,
72 double right,
73 double bottom,
74 Dart_Handle paint_objects,
75 Dart_Handle paint_data) {
76 Paint paint(paint_objects, paint_data);
77
78 FML_DCHECK(paint.isNotNull());
80 SafeNarrow(right), SafeNarrow(bottom));
81 if (display_list_builder_) {
82 DlPaint dl_paint;
83 const DlPaint* save_paint = paint.paint(dl_paint, kSaveLayerWithPaintFlags);
84 FML_DCHECK(save_paint);
85 TRACE_EVENT0("flutter", "ui.Canvas::saveLayer (Recorded)");
86 builder()->SaveLayer(&bounds, save_paint);
87 }
88}
89
91 if (display_list_builder_) {
92 builder()->Restore();
93 }
94}
95
97 if (display_list_builder_) {
98 return builder()->GetSaveCount();
99 } else {
100 return 0;
101 }
102}
103
105 if (display_list_builder_ && count < getSaveCount()) {
107 }
108}
109
110void Canvas::translate(double dx, double dy) {
111 if (display_list_builder_) {
113 }
114}
115
116void Canvas::scale(double sx, double sy) {
117 if (display_list_builder_) {
118 builder()->Scale(SafeNarrow(sx), SafeNarrow(sy));
119 }
120}
121
122void Canvas::rotate(double radians) {
123 if (display_list_builder_) {
124 builder()->Rotate(SafeNarrow(radians) * 180.0f / static_cast<float>(M_PI));
125 }
126}
127
128void Canvas::skew(double sx, double sy) {
129 if (display_list_builder_) {
130 builder()->Skew(SafeNarrow(sx), SafeNarrow(sy));
131 }
132}
133
134void Canvas::transform(const tonic::Float64List& matrix4) {
135 // The Float array stored by Dart Matrix4 is in column-major order
136 // Both DisplayList and SkM44 constructor take row-major matrix order
137 if (display_list_builder_) {
138 // clang-format off
140 SafeNarrow(matrix4[ 0]), SafeNarrow(matrix4[ 4]), SafeNarrow(matrix4[ 8]), SafeNarrow(matrix4[12]),
141 SafeNarrow(matrix4[ 1]), SafeNarrow(matrix4[ 5]), SafeNarrow(matrix4[ 9]), SafeNarrow(matrix4[13]),
142 SafeNarrow(matrix4[ 2]), SafeNarrow(matrix4[ 6]), SafeNarrow(matrix4[10]), SafeNarrow(matrix4[14]),
143 SafeNarrow(matrix4[ 3]), SafeNarrow(matrix4[ 7]), SafeNarrow(matrix4[11]), SafeNarrow(matrix4[15]));
144 // clang-format on
145 }
146}
147
148void Canvas::getTransform(Dart_Handle matrix4_handle) {
149 if (display_list_builder_) {
151 SkScalar m44_values[16];
152 // The Float array stored by Dart Matrix4 is in column-major order
153 sk_m44.getColMajor(m44_values);
154 auto matrix4 = tonic::Float64List(matrix4_handle);
155 for (int i = 0; i < 16; i++) {
156 matrix4[i] = m44_values[i];
157 }
158 }
159}
160
162 double top,
163 double right,
164 double bottom,
165 DlCanvas::ClipOp clipOp,
166 bool doAntiAlias) {
167 if (display_list_builder_) {
169 SafeNarrow(right), SafeNarrow(bottom)),
170 clipOp, doAntiAlias);
171 }
172}
173
174void Canvas::clipRRect(const RRect& rrect, bool doAntiAlias) {
175 if (display_list_builder_) {
177 doAntiAlias);
178 }
179}
180
181void Canvas::clipPath(const CanvasPath* path, bool doAntiAlias) {
182 if (!path) {
184 ToDart("Canvas.clipPath called with non-genuine Path."));
185 return;
186 }
187 if (display_list_builder_) {
189 doAntiAlias);
190 }
191}
192
194 if (display_list_builder_) {
195 auto rect = tonic::Float64List(rect_handle);
197 rect[0] = bounds.fLeft;
198 rect[1] = bounds.fTop;
199 rect[2] = bounds.fRight;
200 rect[3] = bounds.fBottom;
201 }
202}
203
205 if (display_list_builder_) {
206 auto rect = tonic::Float64List(rect_handle);
207 SkRect bounds = builder()->GetLocalClipBounds();
208 rect[0] = bounds.fLeft;
209 rect[1] = bounds.fTop;
210 rect[2] = bounds.fRight;
211 rect[3] = bounds.fBottom;
212 }
213}
214
216 if (display_list_builder_) {
217 builder()->DrawColor(DlColor(color), blend_mode);
218 }
219}
220
221void Canvas::drawLine(double x1,
222 double y1,
223 double x2,
224 double y2,
225 Dart_Handle paint_objects,
226 Dart_Handle paint_data) {
227 Paint paint(paint_objects, paint_data);
228
229 FML_DCHECK(paint.isNotNull());
230 if (display_list_builder_) {
231 DlPaint dl_paint;
232 paint.paint(dl_paint, kDrawLineFlags);
235 dl_paint);
236 }
237}
238
239void Canvas::drawPaint(Dart_Handle paint_objects, Dart_Handle paint_data) {
240 Paint paint(paint_objects, paint_data);
241
242 FML_DCHECK(paint.isNotNull());
243 if (display_list_builder_) {
244 DlPaint dl_paint;
245 paint.paint(dl_paint, kDrawPaintFlags);
246 std::shared_ptr<const DlImageFilter> filter = dl_paint.getImageFilter();
247 if (filter && !filter->asColorFilter()) {
248 // drawPaint does an implicit saveLayer if an SkImageFilter is
249 // present that cannot be replaced by an SkColorFilter.
250 TRACE_EVENT0("flutter", "ui.Canvas::saveLayer (Recorded)");
251 }
252 builder()->DrawPaint(dl_paint);
253 }
254}
255
257 double top,
258 double right,
259 double bottom,
260 Dart_Handle paint_objects,
261 Dart_Handle paint_data) {
262 Paint paint(paint_objects, paint_data);
263
264 FML_DCHECK(paint.isNotNull());
265 if (display_list_builder_) {
266 DlPaint dl_paint;
267 paint.paint(dl_paint, kDrawRectFlags);
269 SafeNarrow(right), SafeNarrow(bottom)),
270 dl_paint);
271 }
272}
273
274void Canvas::drawRRect(const RRect& rrect,
275 Dart_Handle paint_objects,
276 Dart_Handle paint_data) {
277 Paint paint(paint_objects, paint_data);
278
279 FML_DCHECK(paint.isNotNull());
280 if (display_list_builder_) {
281 DlPaint dl_paint;
282 paint.paint(dl_paint, kDrawRRectFlags);
283 builder()->DrawRRect(rrect.sk_rrect, dl_paint);
284 }
285}
286
287void Canvas::drawDRRect(const RRect& outer,
288 const RRect& inner,
289 Dart_Handle paint_objects,
290 Dart_Handle paint_data) {
291 Paint paint(paint_objects, paint_data);
292
293 FML_DCHECK(paint.isNotNull());
294 if (display_list_builder_) {
295 DlPaint dl_paint;
296 paint.paint(dl_paint, kDrawDRRectFlags);
297 builder()->DrawDRRect(outer.sk_rrect, inner.sk_rrect, dl_paint);
298 }
299}
300
302 double top,
303 double right,
304 double bottom,
305 Dart_Handle paint_objects,
306 Dart_Handle paint_data) {
307 Paint paint(paint_objects, paint_data);
308
309 FML_DCHECK(paint.isNotNull());
310 if (display_list_builder_) {
311 DlPaint dl_paint;
312 paint.paint(dl_paint, kDrawOvalFlags);
314 SafeNarrow(right), SafeNarrow(bottom)),
315 dl_paint);
316 }
317}
318
320 double y,
321 double radius,
322 Dart_Handle paint_objects,
323 Dart_Handle paint_data) {
324 Paint paint(paint_objects, paint_data);
325
326 FML_DCHECK(paint.isNotNull());
327 if (display_list_builder_) {
328 DlPaint dl_paint;
329 paint.paint(dl_paint, kDrawCircleFlags);
331 SafeNarrow(radius), dl_paint);
332 }
333}
334
336 double top,
337 double right,
338 double bottom,
339 double startAngle,
340 double sweepAngle,
341 bool useCenter,
342 Dart_Handle paint_objects,
343 Dart_Handle paint_data) {
344 Paint paint(paint_objects, paint_data);
345
346 FML_DCHECK(paint.isNotNull());
347 if (display_list_builder_) {
348 DlPaint dl_paint;
349 paint.paint(dl_paint, useCenter //
352 builder()->DrawArc(
354 SafeNarrow(bottom)),
355 SafeNarrow(startAngle) * 180.0f / static_cast<float>(M_PI),
356 SafeNarrow(sweepAngle) * 180.0f / static_cast<float>(M_PI), useCenter,
357 dl_paint);
358 }
359}
360
362 Dart_Handle paint_objects,
363 Dart_Handle paint_data) {
364 Paint paint(paint_objects, paint_data);
365
366 FML_DCHECK(paint.isNotNull());
367 if (!path) {
369 ToDart("Canvas.drawPath called with non-genuine Path."));
370 return;
371 }
372 if (display_list_builder_) {
373 DlPaint dl_paint;
374 paint.paint(dl_paint, kDrawPathFlags);
375 builder()->DrawPath(path->path(), dl_paint);
376 }
377}
378
380 double x,
381 double y,
382 Dart_Handle paint_objects,
383 Dart_Handle paint_data,
384 int filterQualityIndex) {
385 Paint paint(paint_objects, paint_data);
386
387 FML_DCHECK(paint.isNotNull());
388 if (!image) {
389 return ToDart("Canvas.drawImage called with non-genuine Image.");
390 }
391
392 auto dl_image = image->image();
393 if (!dl_image) {
394 return Dart_Null();
395 }
396 auto error = dl_image->get_error();
397 if (error) {
398 return ToDart(error.value());
399 }
400
401 auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
402 if (display_list_builder_) {
403 DlPaint dl_paint;
404 const DlPaint* opt_paint = paint.paint(dl_paint, kDrawImageWithPaintFlags);
406 sampling, opt_paint);
407 }
408 return Dart_Null();
409}
410
412 double src_left,
413 double src_top,
414 double src_right,
415 double src_bottom,
416 double dst_left,
417 double dst_top,
418 double dst_right,
419 double dst_bottom,
420 Dart_Handle paint_objects,
421 Dart_Handle paint_data,
422 int filterQualityIndex) {
423 Paint paint(paint_objects, paint_data);
424
425 FML_DCHECK(paint.isNotNull());
426 if (!image) {
427 return ToDart("Canvas.drawImageRect called with non-genuine Image.");
428 }
429
430 auto dl_image = image->image();
431 if (!dl_image) {
432 return Dart_Null();
433 }
434 auto error = dl_image->get_error();
435 if (error) {
436 return ToDart(error.value());
437 }
438
439 SkRect src = SkRect::MakeLTRB(SafeNarrow(src_left), SafeNarrow(src_top),
440 SafeNarrow(src_right), SafeNarrow(src_bottom));
441 SkRect dst = SkRect::MakeLTRB(SafeNarrow(dst_left), SafeNarrow(dst_top),
442 SafeNarrow(dst_right), SafeNarrow(dst_bottom));
443 auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
444 if (display_list_builder_) {
445 DlPaint dl_paint;
446 const DlPaint* opt_paint =
447 paint.paint(dl_paint, kDrawImageRectWithPaintFlags);
448 builder()->DrawImageRect(dl_image, src, dst, sampling, opt_paint,
450 }
451 return Dart_Null();
452}
453
455 double center_left,
456 double center_top,
457 double center_right,
458 double center_bottom,
459 double dst_left,
460 double dst_top,
461 double dst_right,
462 double dst_bottom,
463 Dart_Handle paint_objects,
464 Dart_Handle paint_data,
465 int bitmapSamplingIndex) {
466 Paint paint(paint_objects, paint_data);
467
468 FML_DCHECK(paint.isNotNull());
469 if (!image) {
470 return ToDart("Canvas.drawImageNine called with non-genuine Image.");
471 }
472 auto dl_image = image->image();
473 if (!dl_image) {
474 return Dart_Null();
475 }
476 auto error = dl_image->get_error();
477 if (error) {
478 return ToDart(error.value());
479 }
480
481 SkRect center =
482 SkRect::MakeLTRB(SafeNarrow(center_left), SafeNarrow(center_top),
483 SafeNarrow(center_right), SafeNarrow(center_bottom));
484 SkIRect icenter;
485 center.round(&icenter);
486 SkRect dst = SkRect::MakeLTRB(SafeNarrow(dst_left), SafeNarrow(dst_top),
487 SafeNarrow(dst_right), SafeNarrow(dst_bottom));
488 auto filter = ImageFilter::FilterModeFromIndex(bitmapSamplingIndex);
489 if (display_list_builder_) {
490 DlPaint dl_paint;
491 const DlPaint* opt_paint =
492 paint.paint(dl_paint, kDrawImageNineWithPaintFlags);
493 builder()->DrawImageNine(dl_image, icenter, dst, filter, opt_paint);
494 }
495 return Dart_Null();
496}
497
499 if (!picture) {
501 ToDart("Canvas.drawPicture called with non-genuine Picture."));
502 return;
503 }
504 if (picture->display_list()) {
505 if (display_list_builder_) {
506 builder()->DrawDisplayList(picture->display_list());
507 }
508 } else {
509 FML_DCHECK(false);
510 }
511}
512
514 Dart_Handle paint_data,
515 DlCanvas::PointMode point_mode,
516 const tonic::Float32List& points) {
517 Paint paint(paint_objects, paint_data);
518
519 static_assert(sizeof(SkPoint) == sizeof(float) * 2,
520 "SkPoint doesn't use floats.");
521
522 FML_DCHECK(paint.isNotNull());
523 if (display_list_builder_) {
524 DlPaint dl_paint;
525 switch (point_mode) {
527 paint.paint(dl_paint, kDrawPointsAsPointsFlags);
528 break;
530 paint.paint(dl_paint, kDrawPointsAsLinesFlags);
531 break;
533 paint.paint(dl_paint, kDrawPointsAsPolygonFlags);
534 break;
535 }
536 builder()->DrawPoints(point_mode,
537 points.num_elements() / 2, // SkPoints have 2 floats
538 reinterpret_cast<const SkPoint*>(points.data()),
539 dl_paint);
540 }
541}
542
543void Canvas::drawVertices(const Vertices* vertices,
544 DlBlendMode blend_mode,
545 Dart_Handle paint_objects,
546 Dart_Handle paint_data) {
547 Paint paint(paint_objects, paint_data);
548
549 if (!vertices) {
551 ToDart("Canvas.drawVertices called with non-genuine Vertices."));
552 return;
553 }
554 FML_DCHECK(paint.isNotNull());
555 if (display_list_builder_) {
556 DlPaint dl_paint;
557 paint.paint(dl_paint, kDrawVerticesFlags);
558 builder()->DrawVertices(vertices->vertices(), blend_mode, dl_paint);
559 }
560}
561
563 Dart_Handle paint_data,
564 int filterQualityIndex,
565 CanvasImage* atlas,
566 Dart_Handle transforms_handle,
567 Dart_Handle rects_handle,
568 Dart_Handle colors_handle,
569 DlBlendMode blend_mode,
570 Dart_Handle cull_rect_handle) {
571 Paint paint(paint_objects, paint_data);
572
573 if (!atlas) {
574 return ToDart(
575 "Canvas.drawAtlas or Canvas.drawRawAtlas called with "
576 "non-genuine Image.");
577 }
578
579 auto dl_image = atlas->image();
580 auto error = dl_image->get_error();
581 if (error) {
582 return ToDart(error.value());
583 }
584
585 static_assert(sizeof(SkRSXform) == sizeof(float) * 4,
586 "SkRSXform doesn't use floats.");
587 static_assert(sizeof(SkRect) == sizeof(float) * 4,
588 "SkRect doesn't use floats.");
589
590 auto sampling = ImageFilter::SamplingFromIndex(filterQualityIndex);
591
592 FML_DCHECK(paint.isNotNull());
593 if (display_list_builder_) {
594 tonic::Float32List transforms(transforms_handle);
595 tonic::Float32List rects(rects_handle);
596 tonic::Int32List colors(colors_handle);
597 tonic::Float32List cull_rect(cull_rect_handle);
598
599 DlPaint dl_paint;
600 const DlPaint* opt_paint = paint.paint(dl_paint, kDrawAtlasWithPaintFlags);
602 dl_image, reinterpret_cast<const SkRSXform*>(transforms.data()),
603 reinterpret_cast<const SkRect*>(rects.data()),
604 reinterpret_cast<const DlColor*>(colors.data()),
605 rects.num_elements() / 4, // SkRect have four floats.
606 blend_mode, sampling, reinterpret_cast<const SkRect*>(cull_rect.data()),
607 opt_paint);
608 }
609 return Dart_Null();
610}
611
614 double elevation,
615 bool transparentOccluder) {
616 if (!path) {
618 ToDart("Canvas.drawShader called with non-genuine Path."));
619 return;
620 }
621
622 // Not using SafeNarrow because DPR will always be a relatively small number.
623 const ViewportMetrics* metrics =
625 SkScalar dpr;
626 // TODO(dkwingsmt): We should support rendering shadows on non-implicit views.
627 // However, currently this method has no way to get the target view ID.
628 if (metrics == nullptr) {
629 dpr = 1.0f;
630 } else {
631 dpr = static_cast<float>(metrics->device_pixel_ratio);
632 }
633 if (display_list_builder_) {
634 // The DrawShadow mechanism results in non-public operations to be
635 // performed on the canvas involving an SkDrawShadowRec. Since we
636 // cannot include the header that defines that structure, we cannot
637 // record an operation that it injects into an SkCanvas. To prevent
638 // that situation we bypass the canvas interface and inject the
639 // shadow parameters directly into the underlying DisplayList.
640 // See: https://bugs.chromium.org/p/skia/issues/detail?id=12125
641 builder()->DrawShadow(path->path(), DlColor(color), SafeNarrow(elevation),
642 transparentOccluder, dpr);
643 }
644}
645
647 display_list_builder_ = nullptr;
648 if (dart_wrapper()) {
650 }
651}
652
653} // namespace flutter
#define M_PI
int count
static const int points[]
SkColor4f color
uint32_t SkColor
Definition SkColor.h:37
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static SkScalar center(float pos0, float pos1)
Definition SkM44.h:150
void getColMajor(SkScalar v[]) const
Definition SkM44.h:256
void drawLine(double x1, double y1, double x2, double y2, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:221
void drawArc(double left, double top, double right, double bottom, double startAngle, double sweepAngle, bool useCenter, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:335
void drawShadow(const CanvasPath *path, SkColor color, double elevation, bool transparentOccluder)
Definition canvas.cc:612
void rotate(double radians)
Definition canvas.cc:122
void drawOval(double left, double top, double right, double bottom, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:301
static void Create(Dart_Handle wrapper, PictureRecorder *recorder, double left, double top, double right, double bottom)
Definition canvas.cc:23
void drawRect(double left, double top, double right, double bottom, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:256
void translate(double dx, double dy)
Definition canvas.cc:110
void clipRect(double left, double top, double right, double bottom, DlCanvas::ClipOp clipOp, bool doAntiAlias=true)
Definition canvas.cc:161
void clipRRect(const RRect &rrect, bool doAntiAlias=true)
Definition canvas.cc:174
DisplayListBuilder * builder()
Definition canvas.h:189
void drawColor(SkColor color, DlBlendMode blend_mode)
Definition canvas.cc:215
void transform(const tonic::Float64List &matrix4)
Definition canvas.cc:134
void drawRRect(const RRect &rrect, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:274
void skew(double sx, double sy)
Definition canvas.cc:128
void clipPath(const CanvasPath *path, bool doAntiAlias=true)
Definition canvas.cc:181
Dart_Handle drawImage(const CanvasImage *image, double x, double y, Dart_Handle paint_objects, Dart_Handle paint_data, int filterQualityIndex)
Definition canvas.cc:379
void save()
Definition canvas.cc:50
void restoreToCount(int count)
Definition canvas.cc:104
~Canvas() override
Definition canvas.cc:48
Dart_Handle drawImageRect(const CanvasImage *image, double src_left, double src_top, double src_right, double src_bottom, double dst_left, double dst_top, double dst_right, double dst_bottom, Dart_Handle paint_objects, Dart_Handle paint_data, int filterQualityIndex)
Definition canvas.cc:411
void drawVertices(const Vertices *vertices, DlBlendMode blend_mode, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:543
void restore()
Definition canvas.cc:90
void getTransform(Dart_Handle matrix4_handle)
Definition canvas.cc:148
void Invalidate()
Definition canvas.cc:646
void drawCircle(double x, double y, double radius, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:319
Dart_Handle drawImageNine(const CanvasImage *image, double center_left, double center_top, double center_right, double center_bottom, double dst_left, double dst_top, double dst_right, double dst_bottom, Dart_Handle paint_objects, Dart_Handle paint_data, int bitmapSamplingIndex)
Definition canvas.cc:454
void drawPicture(Picture *picture)
Definition canvas.cc:498
void saveLayerWithoutBounds(Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:56
Dart_Handle drawAtlas(Dart_Handle paint_objects, Dart_Handle paint_data, int filterQualityIndex, CanvasImage *atlas, Dart_Handle transforms_handle, Dart_Handle rects_handle, Dart_Handle colors_handle, DlBlendMode blend_mode, Dart_Handle cull_rect_handle)
Definition canvas.cc:562
void drawDRRect(const RRect &outer, const RRect &inner, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:287
void scale(double sx, double sy)
Definition canvas.cc:116
int getSaveCount()
Definition canvas.cc:96
void getLocalClipBounds(Dart_Handle rect_handle)
Definition canvas.cc:204
void drawPoints(Dart_Handle paint_objects, Dart_Handle paint_data, DlCanvas::PointMode point_mode, const tonic::Float32List &points)
Definition canvas.cc:513
void drawPaint(Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:239
void getDestinationClipBounds(Dart_Handle rect_handle)
Definition canvas.cc:193
void drawPath(const CanvasPath *path, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:361
void saveLayer(double left, double top, double right, double bottom, Dart_Handle paint_objects, Dart_Handle paint_data)
Definition canvas.cc:70
void Skew(SkScalar sx, SkScalar sy) override
void DrawLine(const SkPoint &p0, const SkPoint &p1, const DlPaint &paint) override
void RestoreToCount(int restore_count) override
void DrawDRRect(const SkRRect &outer, const SkRRect &inner, const DlPaint &paint) override
void DrawVertices(const DlVertices *vertices, DlBlendMode mode, const DlPaint &paint) 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
SkRect GetLocalClipBounds() const override
Definition dl_builder.h:139
void DrawRect(const SkRect &rect, const DlPaint &paint) override
void DrawColor(DlColor color, DlBlendMode mode) override
void DrawOval(const SkRect &bounds, const DlPaint &paint) override
void ClipRRect(const SkRRect &rrect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
void Translate(SkScalar tx, SkScalar ty) override
void DrawRRect(const SkRRect &rrect, const DlPaint &paint) override
void Scale(SkScalar sx, SkScalar sy) override
void DrawPath(const SkPath &path, const DlPaint &paint) override
void Rotate(SkScalar degrees) override
void DrawCircle(const SkPoint &center, SkScalar radius, const DlPaint &paint) override
void DrawPoints(PointMode mode, uint32_t count, const SkPoint pts[], const DlPaint &paint) override
void DrawImage(const sk_sp< DlImage > &image, const SkPoint point, DlImageSampling sampling, const DlPaint *paint=nullptr) override
void DrawShadow(const SkPath &path, const DlColor color, const SkScalar elevation, bool transparent_occluder, SkScalar dpr) override
void DrawPaint(const DlPaint &paint) override
void SaveLayer(const SkRect *bounds, const DlPaint *paint=nullptr, const DlImageFilter *backdrop=nullptr) override
SkM44 GetTransformFullPerspective() const override
Definition dl_builder.h:106
void ClipRect(const SkRect &rect, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) 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 DrawDisplayList(const sk_sp< DisplayList > display_list, SkScalar opacity=SK_Scalar1) override
SkRect GetDestinationClipBounds() const override
Definition dl_builder.h:132
void ClipPath(const SkPath &path, ClipOp clip_op=ClipOp::kIntersect, bool is_aa=false) override
void DrawImageNine(const sk_sp< DlImage > &image, const SkIRect &center, const SkRect &dst, DlFilterMode filter, const DlPaint *paint=nullptr) override
int GetSaveCount() const override
Definition dl_builder.h:58
void DrawArc(const SkRect &bounds, SkScalar start, SkScalar sweep, bool useCenter, const DlPaint &paint) 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
static constexpr DisplayListAttributeFlags kDrawVerticesFlags
static constexpr DisplayListAttributeFlags kDrawArcWithCenterFlags
static constexpr DisplayListAttributeFlags kDrawPaintFlags
static constexpr DisplayListAttributeFlags kDrawArcNoCenterFlags
static constexpr DisplayListAttributeFlags kDrawImageRectWithPaintFlags
static constexpr DisplayListAttributeFlags kDrawOvalFlags
static constexpr DisplayListAttributeFlags kDrawPointsAsLinesFlags
static constexpr DisplayListAttributeFlags kDrawPointsAsPolygonFlags
static constexpr DisplayListAttributeFlags kDrawCircleFlags
static constexpr DisplayListAttributeFlags kDrawPathFlags
static constexpr DisplayListAttributeFlags kDrawAtlasWithPaintFlags
static constexpr DisplayListAttributeFlags kDrawLineFlags
static constexpr DisplayListAttributeFlags kSaveLayerWithPaintFlags
static constexpr DisplayListAttributeFlags kDrawPointsAsPointsFlags
static constexpr DisplayListAttributeFlags kDrawImageWithPaintFlags
static constexpr DisplayListAttributeFlags kDrawImageNineWithPaintFlags
static constexpr DisplayListAttributeFlags kDrawRRectFlags
static constexpr DisplayListAttributeFlags kDrawDRRectFlags
static constexpr DisplayListAttributeFlags kDrawRectFlags
@ 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
std::shared_ptr< const DlImageFilter > getImageFilter() const
Definition dl_paint.h:154
static DlImageSampling SamplingFromIndex(int filterQualityIndex)
static DlFilterMode FilterModeFromIndex(int index)
sk_sp< DisplayListBuilder > BeginRecording(SkRect bounds)
void set_canvas(fml::RefPtr< Canvas > canvas)
const ViewportMetrics * GetMetrics(int view_id)
Retrieves the viewport metrics with the given ID managed by the PlatformConfiguration.
SkRRect sk_rrect
Definition rrect.h:16
PlatformConfiguration * platform_configuration() const
static UIDartState * Current()
static void ThrowIfUIOperationsProhibited()
const DlVertices * vertices() const
Definition vertices.h:29
Dart_WeakPersistentHandle dart_wrapper() const
const Paint & paint
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
DART_EXPORT Dart_Handle Dart_Null(void)
#define IMPLEMENT_WRAPPERTYPEINFO(LibraryName, ClassName)
sk_sp< SkImage > image
Definition examples.cpp:29
float SkScalar
Definition extension.cpp:12
const uint8_t uint32_t uint32_t GError ** error
#define FML_DCHECK(condition)
Definition logging.h:103
double y
double x
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
static float SafeNarrow(double value)
Definition ref_ptr.h:256
Dart_Handle ToDart(const T &object)
static constexpr SkPoint Make(float x, float y)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition SkRect.h:646
#define TRACE_EVENT0(category_group, name)