19 rendering_mode_ = rendering_mode;
28 sampler_descriptor_ = std::move(
desc);
32Matrix CalculateSubpassTransform(
const Matrix& snapshot_transform,
33 const Matrix& effect_transform,
38 return snapshot_transform *
45 return effect_transform *
47 effect_transform.
Invert() *
53std::optional<Entity> MatrixFilterContents::RenderFilter(
57 const Matrix& effect_transform,
59 const std::optional<Rect>& coverage_hint)
const {
60 auto snapshot =
inputs[0]->GetSnapshot(
"Matrix",
renderer, entity);
61 if (!snapshot.has_value()) {
65 if (rendering_mode_ ==
96 snapshot->transform = CalculateSubpassTransform(
97 snapshot->transform, effect_transform, matrix_, rendering_mode_);
99 snapshot->transform = entity.GetTransform() *
101 entity.GetTransform().
Invert() *
104 snapshot->sampler_descriptor = sampler_descriptor_;
105 if (!snapshot.has_value()) {
111std::optional<Rect> MatrixFilterContents::GetFilterSourceCoverage(
112 const Matrix& effect_transform,
113 const Rect& output_limit)
const {
116 effect_transform.
Invert();
121 return output_limit.TransformBounds(inverse);
127 const Matrix& effect_transform)
const {
137 Matrix input_transform =
inputs[0]->GetTransform(entity);
138 if (rendering_mode_ ==
144 input_transform, effect_transform, matrix_, rendering_mode_);
static Entity FromSnapshot(const Snapshot &snapshot, BlendMode blend_mode=BlendMode::kSourceOver)
Create an entity that can be used to render a given snapshot.
@ kSubpassPrependSnapshotTransform
@ kSubpassAppendSnapshotTransform
virtual bool IsTranslationOnly() const
Returns true if this filter graph doesn't perform any basis transforms to the filtered content....
virtual void SetRenderingMode(Entity::RenderingMode rendering_mode)
Marks this filter chain as applying in a subpass scenario.
std::optional< Rect > GetFilterCoverage(const FilterInput::Vector &inputs, const Entity &entity, const Matrix &effect_transform) const override
Internal utility method for |GetLocalCoverage| that computes the output coverage of this filter acros...
void SetMatrix(Matrix matrix)
~MatrixFilterContents() override
void SetRenderingMode(Entity::RenderingMode rendering_mode) override
Marks this filter chain as applying in a subpass scenario.
bool IsTranslationOnly() const override
Returns true if this filter graph doesn't perform any basis transforms to the filtered content....
void SetSamplerDescriptor(SamplerDescriptor desc)
#define FML_DCHECK(condition)
unsigned useCenter Optional< SkMatrix > matrix
SK_API sk_sp< PrecompileColorFilter > Matrix()
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
A 4x4 matrix using column-major storage.
constexpr bool IsIdentity() const
constexpr Matrix Basis() const
The Matrix without its w components (without translation).
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.