| Flutter Impeller |

cover_geometry.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 "impeller/entity/geometry/cover_geometry.h"
6
7 #include "impeller/renderer/render_pass.h"
8
9 namespace impeller {
10
11 CoverGeometry::CoverGeometry() = default;
12
13 GeometryResult CoverGeometry::GetPositionBuffer(const ContentContext& renderer,
14 const Entity& entity,
15 RenderPass& pass) const {
16 auto rect = Rect::MakeSize(pass.GetRenderTargetSize());
17 constexpr uint16_t kRectIndicies[4] = {0, 1, 2, 3};
18 auto& data_host_buffer = renderer.GetTransientsDataBuffer();
19 auto& indexes_host_buffer = renderer.GetTransientsIndexesBuffer();
20 return GeometryResult{
21 .type = PrimitiveType::kTriangleStrip,
22 .vertex_buffer =
23 {
24 .vertex_buffer = data_host_buffer.Emplace(
25 rect.GetTransformedPoints(entity.GetTransform().Invert())
26 .data(),
27 8 * sizeof(float), alignof(float)),
28 .index_buffer = indexes_host_buffer.Emplace(
29 kRectIndicies, 4 * sizeof(uint16_t), alignof(uint16_t)),
30 .vertex_count = 4,
31 .index_type = IndexType::k16bit,
32 },
33 .transform = entity.GetShaderTransform(pass),
34 };
35 }
36
37 std::optional<Rect> CoverGeometry::GetCoverage(const Matrix& transform) const {
38 return Rect::MakeMaximum();
39 }
40
41 bool CoverGeometry::CoversArea(const Matrix& transform,
42 const Rect& rect) const {
43 return true;
44 }
45
46 bool CoverGeometry::CanApplyMaskFilter() const {
47 return false;
48 }
49
50 } // namespace impeller
impeller::CoverGeometry::CanApplyMaskFilter
bool CanApplyMaskFilter() const override
Definition: cover_geometry.cc:46
impeller::CoverGeometry::CoversArea
bool CoversArea(const Matrix &transform, const Rect &rect) const override
Determines if this geometry, transformed by the given transform, will completely cover all surface ar...
Definition: cover_geometry.cc:41
impeller::CoverGeometry::CoverGeometry
CoverGeometry()
cover_geometry.h
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:214
impeller
Definition: allocation.cc:12
impeller::PrimitiveType::kTriangleStrip
@ kTriangleStrip
impeller::IndexType::k16bit
@ k16bit
render_pass.h
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TRect< Scalar >
impeller::TRect< Scalar >::MakeSize
constexpr static TRect MakeSize(const TSize< U > &size)
Definition: rect.h:150
impeller::TRect< Scalar >::MakeMaximum
constexpr static TRect MakeMaximum()
Definition: rect.h:188