Flutter Engine
The Flutter Engine
dl_color_source.h
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#ifndef FLUTTER_DISPLAY_LIST_EFFECTS_DL_COLOR_SOURCE_H_
6#define FLUTTER_DISPLAY_LIST_EFFECTS_DL_COLOR_SOURCE_H_
7
8#include <memory>
9#include <utility>
10#include <vector>
11
12#include "flutter/display_list/display_list.h"
13#include "flutter/display_list/dl_attributes.h"
14#include "flutter/display_list/dl_color.h"
15#include "flutter/display_list/dl_sampling_options.h"
16#include "flutter/display_list/dl_tile_mode.h"
17#include "flutter/display_list/effects/dl_runtime_effect.h"
18#include "flutter/display_list/image/dl_image.h"
19#include "flutter/fml/logging.h"
20
22
23#ifdef IMPELLER_ENABLE_3D
24#include "impeller/geometry/matrix.h" // nogncheck
25#include "impeller/scene/node.h" // nogncheck
26namespace flutter {
27class DlSceneColorSource;
28}
29#endif // IMPELLER_ENABLE_3D
30
31namespace flutter {
32
33class DlColorColorSource;
34class DlImageColorSource;
35class DlLinearGradientColorSource;
36class DlRadialGradientColorSource;
37class DlConicalGradientColorSource;
38class DlSweepGradientColorSource;
39class DlRuntimeEffectColorSource;
40
41// The DisplayList ColorSource class. This class implements all of the
42// facilities and adheres to the design goals of the |DlAttribute| base
43// class.
44//
45// The role of the DlColorSource is to provide color information for
46// the pixels of a rendering operation. The object is essentially the
47// origin of all color being rendered, though its output may be
48// modified or transformed by geometric coverage data, the filter
49// attributes, and the final blend with the pixels in the destination.
50
52 kColor,
53 kImage,
59#ifdef IMPELLER_ENABLE_3D
60 kScene,
61#endif // IMPELLER_ENABLE_3D
62};
63
64class DlColorSource : public DlAttribute<DlColorSource, DlColorSourceType> {
65 public:
66 static std::shared_ptr<DlLinearGradientColorSource> MakeLinear(
67 const SkPoint start_point,
68 const SkPoint end_point,
69 uint32_t stop_count,
70 const DlColor* colors,
71 const float* stops,
72 DlTileMode tile_mode,
73 const SkMatrix* matrix = nullptr);
74
75 static std::shared_ptr<DlRadialGradientColorSource> MakeRadial(
76 SkPoint center,
77 SkScalar radius,
78 uint32_t stop_count,
79 const DlColor* colors,
80 const float* stops,
81 DlTileMode tile_mode,
82 const SkMatrix* matrix = nullptr);
83
84 static std::shared_ptr<DlConicalGradientColorSource> MakeConical(
85 SkPoint start_center,
86 SkScalar start_radius,
87 SkPoint end_center,
88 SkScalar end_radius,
89 uint32_t stop_count,
90 const DlColor* colors,
91 const float* stops,
92 DlTileMode tile_mode,
93 const SkMatrix* matrix = nullptr);
94
95 static std::shared_ptr<DlSweepGradientColorSource> MakeSweep(
96 SkPoint center,
99 uint32_t stop_count,
100 const DlColor* colors,
101 const float* stops,
102 DlTileMode tile_mode,
103 const SkMatrix* matrix = nullptr);
104
105 static std::shared_ptr<DlRuntimeEffectColorSource> MakeRuntimeEffect(
106 sk_sp<DlRuntimeEffect> runtime_effect,
107 std::vector<std::shared_ptr<DlColorSource>> samplers,
108 std::shared_ptr<std::vector<uint8_t>> uniform_data);
109
110 virtual bool is_opaque() const = 0;
111
112 //----------------------------------------------------------------------------
113 /// @brief If the underlying platform data held by this object is
114 /// held in a way that it can be stored and potentially
115 /// released from the UI thread, this method returns true.
116 ///
117 /// @return True if the class has no GPU related resources or if any
118 /// that it holds are held in a thread-safe manner.
119 ///
120 virtual bool isUIThreadSafe() const = 0;
121
122 //----------------------------------------------------------------------------
123 /// @brief If the underlying platform data represents a gradient.
124 ///
125 /// TODO(matanl): Remove this flag when the Skia backend is
126 /// removed, https://github.com/flutter/flutter/issues/112498.
127 ///
128 /// @return True if the class represents the output of a gradient.
129 ///
130 virtual bool isGradient() const { return false; }
131
132 // Return a DlColorColorSource pointer to this object iff it is an Color
133 // type of ColorSource, otherwise return nullptr.
134 virtual const DlColorColorSource* asColor() const { return nullptr; }
135
136 // Return a DlImageColorSource pointer to this object iff it is an Image
137 // type of ColorSource, otherwise return nullptr.
138 virtual const DlImageColorSource* asImage() const { return nullptr; }
139
140 // Return a DlLinearGradientColorSource pointer to this object iff it is a
141 // Linear Gradient type of ColorSource, otherwise return nullptr.
143 return nullptr;
144 }
145
146 // Return a DlRadialGradientColorSource pointer to this object iff it is a
147 // Radial Gradient type of ColorSource, otherwise return nullptr.
149 return nullptr;
150 }
151
152 // Return a DlConicalGradientColorSource pointer to this object iff it is a
153 // Conical Gradient type of ColorSource, otherwise return nullptr.
155 return nullptr;
156 }
157
158 // Return a DlSweepGradientColorSource pointer to this object iff it is a
159 // Sweep Gradient type of ColorSource, otherwise return nullptr.
161 return nullptr;
162 }
163
165 return nullptr;
166 }
167
168#ifdef IMPELLER_ENABLE_3D
169 virtual const DlSceneColorSource* asScene() const { return nullptr; }
170#endif // IMPELLER_ENABLE_3D
171
172 protected:
173 DlColorSource() = default;
174
175 private:
176 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlColorSource);
177};
178
179class DlColorColorSource final : public DlColorSource {
180 public:
181 explicit DlColorColorSource(DlColor color) : color_(color) {}
182
183 bool isUIThreadSafe() const override { return true; }
184
185 std::shared_ptr<DlColorSource> shared() const override {
186 return std::make_shared<DlColorColorSource>(color_);
187 }
188
189 const DlColorColorSource* asColor() const override { return this; }
190
192 size_t size() const override { return sizeof(*this); }
193
194 bool is_opaque() const override { return color_.getAlpha() == 255; }
195
196 DlColor color() const { return color_; }
197
198 protected:
199 bool equals_(DlColorSource const& other) const override {
201 auto that = static_cast<DlColorColorSource const*>(&other);
202 return color_ == that->color_;
203 }
204
205 private:
206 DlColor color_;
207
208 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlColorColorSource);
209};
210
212 public:
213 const SkMatrix& matrix() const { return matrix_; }
214 const SkMatrix* matrix_ptr() const {
215 return matrix_.isIdentity() ? nullptr : &matrix_;
216 }
217
218 protected:
220 : matrix_(matrix ? *matrix : SkMatrix::I()) {}
221
222 private:
223 const SkMatrix matrix_;
224};
225
226class DlImageColorSource final : public SkRefCnt,
228 public:
233 const SkMatrix* matrix = nullptr)
235 image_(std::move(image)),
236 horizontal_tile_mode_(horizontal_tile_mode),
237 vertical_tile_mode_(vertical_tile_mode),
238 sampling_(sampling) {}
239
240 bool isUIThreadSafe() const override {
241 return image_ ? image_->isUIThreadSafe() : true;
242 }
243
244 const DlImageColorSource* asImage() const override { return this; }
245
246 std::shared_ptr<DlColorSource> shared() const override {
247 return with_sampling(sampling_);
248 }
249
250 std::shared_ptr<DlColorSource> with_sampling(DlImageSampling sampling) const {
251 return std::make_shared<DlImageColorSource>(image_, horizontal_tile_mode_,
252 vertical_tile_mode_, sampling,
253 matrix_ptr());
254 }
255
257 size_t size() const override { return sizeof(*this); }
258
259 bool is_opaque() const override { return image_->isOpaque(); }
260
261 sk_sp<const DlImage> image() const { return image_; }
262 DlTileMode horizontal_tile_mode() const { return horizontal_tile_mode_; }
263 DlTileMode vertical_tile_mode() const { return vertical_tile_mode_; }
264 DlImageSampling sampling() const { return sampling_; }
265
266 protected:
267 bool equals_(DlColorSource const& other) const override {
269 auto that = static_cast<DlImageColorSource const*>(&other);
270 return (image_->Equals(that->image_) && matrix() == that->matrix() &&
271 horizontal_tile_mode_ == that->horizontal_tile_mode_ &&
272 vertical_tile_mode_ == that->vertical_tile_mode_ &&
273 sampling_ == that->sampling_);
274 }
275
276 private:
278 DlTileMode horizontal_tile_mode_;
279 DlTileMode vertical_tile_mode_;
280 DlImageSampling sampling_;
281
282 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlImageColorSource);
283};
284
286 public:
287 bool is_opaque() const override {
288 if (mode_ == DlTileMode::kDecal) {
289 return false;
290 }
291 const DlColor* my_colors = colors();
292 for (uint32_t i = 0; i < stop_count_; i++) {
293 if (my_colors[i].getAlpha() < 255) {
294 return false;
295 }
296 }
297 return true;
298 }
299
300 bool isGradient() const override { return true; }
301
302 DlTileMode tile_mode() const { return mode_; }
303 int stop_count() const { return stop_count_; }
304 const DlColor* colors() const {
305 return reinterpret_cast<const DlColor*>(pod());
306 }
307 const float* stops() const {
308 return reinterpret_cast<const float*>(colors() + stop_count());
309 }
310
311 protected:
314 const SkMatrix* matrix = nullptr)
316 mode_(tile_mode),
317 stop_count_(stop_count) {}
318
319 size_t vector_sizes() const {
320 return stop_count_ * (sizeof(DlColor) + sizeof(float));
321 }
322
323 virtual const void* pod() const = 0;
324
325 bool base_equals_(DlGradientColorSourceBase const* other_base) const {
326 if (mode_ != other_base->mode_ || matrix() != other_base->matrix() ||
327 stop_count_ != other_base->stop_count_) {
328 return false;
329 }
330 static_assert(sizeof(colors()[0]) == 4);
331 static_assert(sizeof(stops()[0]) == 4);
332 int num_bytes = stop_count_ * 4;
333 return (memcmp(colors(), other_base->colors(), num_bytes) == 0 &&
334 memcmp(stops(), other_base->stops(), num_bytes) == 0);
335 }
336
338 const DlColor* color_data,
339 const float* stop_data) {
340 DlColor* color_storage = reinterpret_cast<DlColor*>(pod);
341 memcpy(color_storage, color_data, stop_count_ * sizeof(*color_data));
342 float* stop_storage = reinterpret_cast<float*>(color_storage + stop_count_);
343 if (stop_data) {
344 memcpy(stop_storage, stop_data, stop_count_ * sizeof(*stop_data));
345 } else {
346 float div = stop_count_ - 1;
347 if (div <= 0) {
348 div = 1;
349 }
350 for (uint32_t i = 0; i < stop_count_; i++) {
351 stop_storage[i] = i / div;
352 }
353 }
354 }
355
356 private:
357 DlTileMode mode_;
358 uint32_t stop_count_;
359
360 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlGradientColorSourceBase);
361};
362
364 public:
366 return this;
367 }
368
369 bool isUIThreadSafe() const override { return true; }
370
371 DlColorSourceType type() const override {
373 }
374 size_t size() const override { return sizeof(*this) + vector_sizes(); }
375
376 std::shared_ptr<DlColorSource> shared() const override {
377 return MakeLinear(start_point_, end_point_, stop_count(), colors(), stops(),
378 tile_mode(), matrix_ptr());
379 }
380
381 const SkPoint& start_point() const { return start_point_; }
382 const SkPoint& end_point() const { return end_point_; }
383
384 protected:
385 virtual const void* pod() const override { return this + 1; }
386
387 bool equals_(DlColorSource const& other) const override {
389 auto that = static_cast<DlLinearGradientColorSource const*>(&other);
390 return (start_point_ == that->start_point_ &&
391 end_point_ == that->end_point_ && base_equals_(that));
392 }
393
394 private:
396 const SkPoint end_point,
397 uint32_t stop_count,
398 const DlColor* colors,
399 const float* stops,
401 const SkMatrix* matrix = nullptr)
403 start_point_(start_point),
404 end_point_(end_point) {
405 store_color_stops(this + 1, colors, stops);
406 }
407
408 explicit DlLinearGradientColorSource(
409 const DlLinearGradientColorSource* source)
411 source->tile_mode(),
412 source->matrix_ptr()),
413 start_point_(source->start_point()),
414 end_point_(source->end_point()) {
415 store_color_stops(this + 1, source->colors(), source->stops());
416 }
417
418 SkPoint start_point_;
419 SkPoint end_point_;
420
421 friend class DlColorSource;
422 friend class DisplayListBuilder;
423
425};
426
428 public:
430 return this;
431 }
432
433 bool isUIThreadSafe() const override { return true; }
434
435 std::shared_ptr<DlColorSource> shared() const override {
436 return MakeRadial(center_, radius_, stop_count(), colors(), stops(),
437 tile_mode(), matrix_ptr());
438 }
439
440 DlColorSourceType type() const override {
442 }
443 size_t size() const override { return sizeof(*this) + vector_sizes(); }
444
445 SkPoint center() const { return center_; }
446 SkScalar radius() const { return radius_; }
447
448 protected:
449 virtual const void* pod() const override { return this + 1; }
450
451 bool equals_(DlColorSource const& other) const override {
453 auto that = static_cast<DlRadialGradientColorSource const*>(&other);
454 return (center_ == that->center_ && radius_ == that->radius_ &&
455 base_equals_(that));
456 }
457
458 private:
461 uint32_t stop_count,
462 const DlColor* colors,
463 const float* stops,
465 const SkMatrix* matrix = nullptr)
467 center_(center),
468 radius_(radius) {
469 store_color_stops(this + 1, colors, stops);
470 }
471
472 explicit DlRadialGradientColorSource(
473 const DlRadialGradientColorSource* source)
475 source->tile_mode(),
476 source->matrix_ptr()),
477 center_(source->center()),
478 radius_(source->radius()) {
479 store_color_stops(this + 1, source->colors(), source->stops());
480 }
481
482 SkPoint center_;
483 SkScalar radius_;
484
485 friend class DlColorSource;
486 friend class DisplayListBuilder;
487
489};
490
492 public:
494 return this;
495 }
496
497 bool isUIThreadSafe() const override { return true; }
498
499 std::shared_ptr<DlColorSource> shared() const override {
500 return MakeConical(start_center_, start_radius_, end_center_, end_radius_,
501 stop_count(), colors(), stops(), tile_mode(),
502 matrix_ptr());
503 }
504
505 DlColorSourceType type() const override {
507 }
508 size_t size() const override { return sizeof(*this) + vector_sizes(); }
509
510 SkPoint start_center() const { return start_center_; }
511 SkScalar start_radius() const { return start_radius_; }
512 SkPoint end_center() const { return end_center_; }
513 SkScalar end_radius() const { return end_radius_; }
514
515 protected:
516 virtual const void* pod() const override { return this + 1; }
517
518 bool equals_(DlColorSource const& other) const override {
520 auto that = static_cast<DlConicalGradientColorSource const*>(&other);
521 return (start_center_ == that->start_center_ &&
522 start_radius_ == that->start_radius_ &&
523 end_center_ == that->end_center_ &&
524 end_radius_ == that->end_radius_ && base_equals_(that));
525 }
526
527 private:
532 uint32_t stop_count,
533 const DlColor* colors,
534 const float* stops,
536 const SkMatrix* matrix = nullptr)
538 start_center_(start_center),
539 start_radius_(start_radius),
540 end_center_(end_center),
541 end_radius_(end_radius) {
542 store_color_stops(this + 1, colors, stops);
543 }
544
545 explicit DlConicalGradientColorSource(
546 const DlConicalGradientColorSource* source)
548 source->tile_mode(),
549 source->matrix_ptr()),
550 start_center_(source->start_center()),
551 start_radius_(source->start_radius()),
552 end_center_(source->end_center()),
553 end_radius_(source->end_radius()) {
554 store_color_stops(this + 1, source->colors(), source->stops());
555 }
556
557 SkPoint start_center_;
558 SkScalar start_radius_;
559 SkPoint end_center_;
560 SkScalar end_radius_;
561
562 friend class DlColorSource;
563 friend class DisplayListBuilder;
564
566};
567
569 public:
571 return this;
572 }
573
574 bool isUIThreadSafe() const override { return true; }
575
576 std::shared_ptr<DlColorSource> shared() const override {
577 return MakeSweep(center_, start_, end_, stop_count(), colors(), stops(),
578 tile_mode(), matrix_ptr());
579 }
580
581 DlColorSourceType type() const override {
583 }
584 size_t size() const override { return sizeof(*this) + vector_sizes(); }
585
586 SkPoint center() const { return center_; }
587 SkScalar start() const { return start_; }
588 SkScalar end() const { return end_; }
589
590 protected:
591 virtual const void* pod() const override { return this + 1; }
592
593 bool equals_(DlColorSource const& other) const override {
595 auto that = static_cast<DlSweepGradientColorSource const*>(&other);
596 return (center_ == that->center_ && start_ == that->start_ &&
597 end_ == that->end_ && base_equals_(that));
598 }
599
600 private:
604 uint32_t stop_count,
605 const DlColor* colors,
606 const float* stops,
608 const SkMatrix* matrix = nullptr)
610 center_(center),
611 start_(start),
612 end_(end) {
613 store_color_stops(this + 1, colors, stops);
614 }
615
616 explicit DlSweepGradientColorSource(const DlSweepGradientColorSource* source)
618 source->tile_mode(),
619 source->matrix_ptr()),
620 center_(source->center()),
621 start_(source->start()),
622 end_(source->end()) {
623 store_color_stops(this + 1, source->colors(), source->stops());
624 }
625
626 SkPoint center_;
627 SkScalar start_;
628 SkScalar end_;
629
630 friend class DlColorSource;
631 friend class DisplayListBuilder;
632
634};
635
637 public:
640 std::vector<std::shared_ptr<DlColorSource>> samplers,
641 std::shared_ptr<std::vector<uint8_t>> uniform_data)
642 : runtime_effect_(std::move(runtime_effect)),
643 samplers_(std::move(samplers)),
644 uniform_data_(std::move(uniform_data)) {}
645
646 bool isUIThreadSafe() const override {
647 for (const auto& sampler : samplers_) {
648 if (!sampler->isUIThreadSafe()) {
649 return false;
650 }
651 }
652 return true;
653 }
654
656 return this;
657 }
658
659 std::shared_ptr<DlColorSource> shared() const override {
660 return std::make_shared<DlRuntimeEffectColorSource>(
661 runtime_effect_, samplers_, uniform_data_);
662 }
663
664 DlColorSourceType type() const override {
666 }
667 size_t size() const override { return sizeof(*this); }
668
669 bool is_opaque() const override { return false; }
670
672 return runtime_effect_;
673 }
674 const std::vector<std::shared_ptr<DlColorSource>> samplers() const {
675 return samplers_;
676 }
677 const std::shared_ptr<std::vector<uint8_t>> uniform_data() const {
678 return uniform_data_;
679 }
680
681 protected:
682 bool equals_(DlColorSource const& other) const override {
684 auto that = static_cast<DlRuntimeEffectColorSource const*>(&other);
685 if (runtime_effect_ != that->runtime_effect_) {
686 return false;
687 }
688 if (uniform_data_ != that->uniform_data_) {
689 return false;
690 }
691 if (samplers_.size() != that->samplers_.size()) {
692 return false;
693 }
694 for (size_t i = 0; i < samplers_.size(); i++) {
695 if (samplers_[i] != that->samplers_[i]) {
696 return false;
697 }
698 }
699 return true;
700 }
701
702 private:
703 sk_sp<DlRuntimeEffect> runtime_effect_;
704 std::vector<std::shared_ptr<DlColorSource>> samplers_;
705 std::shared_ptr<std::vector<uint8_t>> uniform_data_;
706
707 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlRuntimeEffectColorSource);
708};
709
710#ifdef IMPELLER_ENABLE_3D
711class DlSceneColorSource final : public DlColorSource {
712 public:
713 DlSceneColorSource(std::shared_ptr<impeller::scene::Node> node,
714 impeller::Matrix camera_matrix)
715 : node_(std::move(node)), camera_matrix_(camera_matrix) {}
716
717 bool isUIThreadSafe() const override { return true; }
718
719 const DlSceneColorSource* asScene() const override { return this; }
720
721 std::shared_ptr<DlColorSource> shared() const override {
722 return std::make_shared<DlSceneColorSource>(node_, camera_matrix_);
723 }
724
725 DlColorSourceType type() const override { return DlColorSourceType::kScene; }
726 size_t size() const override { return sizeof(*this); }
727
728 bool is_opaque() const override { return false; }
729
730 std::shared_ptr<impeller::scene::Node> scene_node() const { return node_; }
731
732 impeller::Matrix camera_matrix() const { return camera_matrix_; }
733
734 protected:
735 bool equals_(DlColorSource const& other) const override {
736 FML_DCHECK(other.type() == DlColorSourceType::kScene);
737 auto that = static_cast<DlSceneColorSource const*>(&other);
738 if (node_ != that->node_) {
739 return false;
740 }
741 return true;
742 }
743
744 private:
745 std::shared_ptr<impeller::scene::Node> node_;
746 impeller::Matrix camera_matrix_; // the view-projection matrix of the scene.
747
748 FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlSceneColorSource);
749};
750#endif // IMPELLER_ENABLE_3D
751
752} // namespace flutter
753
754#endif // FLUTTER_DISPLAY_LIST_EFFECTS_DL_COLOR_SOURCE_H_
@ kColor
hue and saturation of source with luminosity of destination
@ kLinearGradient
@ kRadialGradient
GLenum type
bool isIdentity() const
Definition: SkMatrix.h:223
virtual T type() const =0
bool equals_(DlColorSource const &other) const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
DlColorSourceType type() const override
const DlColorColorSource * asColor() const override
std::shared_ptr< DlColorSource > shared() const override
size_t size() const override
bool is_opaque() const override
virtual const DlRuntimeEffectColorSource * asRuntimeEffect() const
static std::shared_ptr< DlConicalGradientColorSource > MakeConical(SkPoint start_center, SkScalar start_radius, SkPoint end_center, SkScalar end_radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
virtual bool isUIThreadSafe() const =0
If the underlying platform data held by this object is held in a way that it can be stored and potent...
static std::shared_ptr< DlRuntimeEffectColorSource > MakeRuntimeEffect(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
virtual const DlRadialGradientColorSource * asRadialGradient() const
static std::shared_ptr< DlLinearGradientColorSource > MakeLinear(const SkPoint start_point, const SkPoint end_point, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
static std::shared_ptr< DlSweepGradientColorSource > MakeSweep(SkPoint center, SkScalar start, SkScalar end, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
virtual const DlLinearGradientColorSource * asLinearGradient() const
virtual const DlImageColorSource * asImage() const
virtual bool is_opaque() const =0
virtual const DlColorColorSource * asColor() const
virtual const DlSweepGradientColorSource * asSweepGradient() const
virtual bool isGradient() const
If the underlying platform data represents a gradient.
virtual const DlConicalGradientColorSource * asConicalGradient() const
static std::shared_ptr< DlRadialGradientColorSource > MakeRadial(SkPoint center, SkScalar radius, uint32_t stop_count, const DlColor *colors, const float *stops, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
std::shared_ptr< DlColorSource > shared() const override
bool equals_(DlColorSource const &other) const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
const DlConicalGradientColorSource * asConicalGradient() const override
virtual const void * pod() const override
DlColorSourceType type() const override
void store_color_stops(void *pod, const DlColor *color_data, const float *stop_data)
DlGradientColorSourceBase(uint32_t stop_count, DlTileMode tile_mode, const SkMatrix *matrix=nullptr)
const DlColor * colors() const
bool isGradient() const override
If the underlying platform data represents a gradient.
bool base_equals_(DlGradientColorSourceBase const *other_base) const
virtual const void * pod() const =0
DlImageColorSource(sk_sp< const DlImage > image, DlTileMode horizontal_tile_mode, DlTileMode vertical_tile_mode, DlImageSampling sampling=DlImageSampling::kLinear, const SkMatrix *matrix=nullptr)
bool equals_(DlColorSource const &other) const override
std::shared_ptr< DlColorSource > shared() const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
DlImageSampling sampling() const
size_t size() const override
std::shared_ptr< DlColorSource > with_sampling(DlImageSampling sampling) const
DlColorSourceType type() const override
bool is_opaque() const override
DlTileMode vertical_tile_mode() const
const DlImageColorSource * asImage() const override
DlTileMode horizontal_tile_mode() const
sk_sp< const DlImage > image() const
const SkPoint & start_point() const
virtual const void * pod() const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
const DlLinearGradientColorSource * asLinearGradient() const override
DlColorSourceType type() const override
std::shared_ptr< DlColorSource > shared() const override
bool equals_(DlColorSource const &other) const override
const SkMatrix * matrix_ptr() const
const SkMatrix & matrix() const
DlMatrixColorSourceBase(const SkMatrix *matrix)
DlColorSourceType type() const override
std::shared_ptr< DlColorSource > shared() const override
bool equals_(DlColorSource const &other) const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
virtual const void * pod() const override
const DlRadialGradientColorSource * asRadialGradient() const override
std::shared_ptr< DlColorSource > shared() const override
DlRuntimeEffectColorSource(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
const std::shared_ptr< std::vector< uint8_t > > uniform_data() const
const DlRuntimeEffectColorSource * asRuntimeEffect() const override
DlColorSourceType type() const override
bool equals_(DlColorSource const &other) const override
const sk_sp< DlRuntimeEffect > runtime_effect() const
const std::vector< std::shared_ptr< DlColorSource > > samplers() const
virtual const void * pod() const override
DlColorSourceType type() const override
bool equals_(DlColorSource const &other) const override
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
std::shared_ptr< DlColorSource > shared() const override
const DlSweepGradientColorSource * asSweepGradient() const override
SkBitmap source
Definition: examples.cpp:28
float SkScalar
Definition: extension.cpp:12
glong glong end
#define FML_DCHECK(condition)
Definition: logging.h:103
#define FML_DISALLOW_COPY_ASSIGN_AND_MOVE(TypeName)
Definition: macros.h:31
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
PODArray< SkColor > colors
Definition: SkRecords.h:276
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
Definition: switches.h:259
Definition: ref_ptr.h:256
flutter::DlColor DlColor
Definition: SkMD5.cpp:134
constexpr int getAlpha() const
Definition: dl_color.h:42
A 4x4 matrix using column-major storage.
Definition: matrix.h:37