Flutter Engine
The Flutter Engine
paint_pass_delegate.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
6
12
13namespace impeller {
14
15/// PaintPassDelegate
16/// ----------------------------------------------
17
19
20// |EntityPassDelgate|
22
23// |EntityPassDelgate|
25 return paint_.blend_mode == BlendMode::kDestination;
26}
27
28// |EntityPassDelgate|
30 return false;
31}
32
33// |EntityPassDelgate|
35 std::shared_ptr<Texture> target,
36 const Matrix& effect_transform) {
37 auto contents = TextureContents::MakeRect(Rect::MakeSize(target->GetSize()));
38 contents->SetTexture(target);
39 contents->SetLabel("Subpass");
40 contents->SetSourceRect(Rect::MakeSize(target->GetSize()));
41 contents->SetOpacity(paint_.color.alpha);
42 contents->SetDeferApplyingOpacity(true);
43
44 return paint_.WithFiltersForSubpassTarget(std::move(contents),
45 effect_transform);
46}
47
48// |EntityPassDelgate|
49std::shared_ptr<FilterContents> PaintPassDelegate::WithImageFilter(
50 const FilterInput::Variant& input,
51 const Matrix& effect_transform) const {
52 return paint_.WithImageFilter(
53 input, effect_transform,
55}
56
57} // namespace impeller
std::variant< std::shared_ptr< FilterContents >, std::shared_ptr< Contents >, std::shared_ptr< Texture >, Rect > Variant
Definition: filter_input.h:37
bool CanCollapseIntoParentPass(EntityPass *entity_pass) override
Whether or not this entity pass can be collapsed into the parent. If true, this method may modify the...
std::shared_ptr< FilterContents > WithImageFilter(const FilterInput::Variant &input, const Matrix &effect_transform) const override
std::shared_ptr< Contents > CreateContentsForSubpassTarget(std::shared_ptr< Texture > target, const Matrix &effect_transform) override
static std::shared_ptr< TextureContents > MakeRect(Rect destination)
A common case factory that marks the texture contents as having a destination rectangle....
const Paint & paint
Definition: color_source.cc:38
uint32_t * target
Definition: ref_ptr.h:256
Scalar alpha
Definition: color.h:143
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
Color color
Definition: paint.h:68
BlendMode blend_mode
Definition: paint.h:76
std::shared_ptr< Contents > WithFiltersForSubpassTarget(std::shared_ptr< Contents > input, const Matrix &effect_transform=Matrix()) const
Wrap this paint's configured filters to the given contents of subpass target.
Definition: paint.cc:67
std::shared_ptr< FilterContents > WithImageFilter(const FilterInput::Variant &input, const Matrix &effect_transform, Entity::RenderingMode rendering_mode) const
Definition: paint.cc:90
static constexpr TRect MakeSize(const TSize< U > &size)
Definition: rect.h:146