Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
6
8
9namespace impeller {
10
12
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& host_buffer = renderer.GetTransientsBuffer();
19 return GeometryResult{
21 .vertex_buffer =
22 {
23 .vertex_buffer = host_buffer.Emplace(
24 rect.GetTransformedPoints(entity.GetTransform().Invert())
25 .data(),
26 8 * sizeof(float), alignof(float)),
27 .index_buffer = host_buffer.Emplace(
28 kRectIndicies, 4 * sizeof(uint16_t), alignof(uint16_t)),
29 .vertex_count = 4,
30 .index_type = IndexType::k16bit,
31 },
32 .transform = entity.GetShaderTransform(pass),
33 };
34}
35
36std::optional<Rect> CoverGeometry::GetCoverage(const Matrix& transform) const {
37 return Rect::MakeMaximum();
38}
39
41 const Rect& rect) const {
42 return true;
43}
44
46 return false;
47}
48
49} // namespace impeller
bool CanApplyMaskFilter() const override
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
std::optional< Rect > GetCoverage(const Matrix &transform) const override
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...
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
Definition entity.cc:50
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Definition entity.cc:46
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition render_pass.h:33
ISize GetRenderTargetSize() const
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition p3.cpp:47
PrimitiveType type
Definition geometry.h:35
A 4x4 matrix using column-major storage.
Definition matrix.h:37
Matrix Invert() const
Definition matrix.cc:97
static constexpr TRect MakeSize(const TSize< U > &size)
Definition rect.h:146
static constexpr TRect MakeMaximum()
Definition rect.h:174