5 #include "flutter/testing/testing.h"
6 #include "gmock/gmock.h"
36 if (render_target.ok()) {
37 return render_target.value().GetRenderTargetTexture();
49 std::optional<Rect> coverage =
51 ASSERT_FALSE(coverage.has_value());
59 std::optional<Rect> coverage =
71 std::optional<Rect> coverage =
89 void expectRenderCoverageEqual(
const std::optional<Entity>& result,
90 const std::optional<Rect> contents_coverage,
91 const Rect& expected) {
92 EXPECT_TRUE(result.has_value());
93 if (result.has_value()) {
95 std::optional<Rect> result_coverage = result.value().GetCoverage();
96 EXPECT_TRUE(result_coverage.has_value());
97 EXPECT_TRUE(contents_coverage.has_value());
98 if (result_coverage.has_value() && contents_coverage.has_value()) {
99 EXPECT_TRUE(
RectNear(contents_coverage.value(), expected));
100 EXPECT_TRUE(
RectNear(result_coverage.value(), expected));
107 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
115 std::optional<Entity> result =
116 contents.
GetEntity(renderer, entity, {});
117 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
122 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
132 std::optional<Entity> result =
133 contents.
GetEntity(renderer, entity, {});
134 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
139 RenderCoverageMatchesGetCoverageClippedSubpassTranslate) {
140 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
152 std::optional<Entity> result =
153 contents.
GetEntity(renderer, entity, {});
154 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
159 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
169 std::optional<Entity> result =
170 contents.
GetEntity(renderer, entity, {});
171 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
176 RenderCoverageMatchesGetCoverageClippedSubpassScale) {
177 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
189 std::optional<Entity> result =
190 contents.
GetEntity(renderer, entity, {});
191 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
196 std::shared_ptr<Texture> texture = MakeTexture(
ISize(100, 100));
208 std::optional<Entity> result =
209 contents.
GetEntity(renderer, entity, {});
210 expectRenderCoverageEqual(result, contents.
GetCoverage(entity),
fml::StatusOr< RenderTarget > MakeSubpass(std::string_view label, ISize texture_size, const std::shared_ptr< CommandBuffer > &command_buffer, const SubpassCallback &subpass_callback, bool msaa_enabled=true, bool depth_stencil_enabled=false, int32_t mip_count=1) const
Creates a new texture of size texture_size and calls subpass_callback with a RenderPass for drawing t...
std::shared_ptr< Context > GetContext() const
void SetTransform(const Matrix &transform)
Set the global transform matrix for this Entity.
@ kSubpassPrependSnapshotTransform
@ kSubpassAppendSnapshotTransform
std::optional< Entity > GetEntity(const ContentContext &renderer, const Entity &entity, const std::optional< Rect > &coverage_hint) const
Create an Entity that renders this filter's output.
std::optional< Rect > GetCoverage(const Entity &entity) const override
Get the area of the render pass that will be affected when this contents is rendered.
void SetInputs(FilterInput::Vector inputs)
The input texture sources for this filter. Each input's emitted texture is expected to have premultip...
void SetEffectTransform(const Matrix &effect_transform)
Sets the transform which gets appended to the effect of this filter. Note that this is in addition to...
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)
void SetRenderingMode(Entity::RenderingMode rendering_mode) override
Marks this filter chain as applying in a subpass scenario.
ContentContext & GetContentContext() const
std::shared_ptr< Context > GetContext() const
Render passes encode render commands directed as one specific render target into an underlying comman...
std::shared_ptr< Texture > MakeTexture(ISize size)
Create a texture that has been cleared to transparent black.
inline ::testing::AssertionResult RectNear(impeller::Rect a, impeller::Rect b)
TEST(AllocationSizeTest, CanCreateTypedAllocations)
TEST_P(AiksTest, DrawAtlasNoColor)
INSTANTIATE_PLAYGROUND_SUITE(AiksTest)
std::shared_ptr< CommandBuffer > command_buffer
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)
static constexpr Matrix MakeScale(const Vector3 &s)
constexpr static TRect MakeXYWH(Type x, Type y, Type width, Type height)
constexpr static TRect MakeLTRB(Type left, Type top, Type right, Type bottom)