Flutter Engine
The Flutter Engine
rect_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
7namespace impeller {
8
10
12 const Entity& entity,
13 RenderPass& pass) const {
14 auto& host_buffer = renderer.GetTransientsBuffer();
15 return GeometryResult{
17 .vertex_buffer =
18 {
19 .vertex_buffer = host_buffer.Emplace(
20 rect_.GetPoints().data(), 8 * sizeof(float), alignof(float)),
21 .vertex_count = 4,
22 .index_type = IndexType::kNone,
23 },
24 .transform = entity.GetShaderTransform(pass),
25 };
26}
27
28std::optional<Rect> RectGeometry::GetCoverage(const Matrix& transform) const {
29 return rect_.TransformBounds(transform);
30}
31
33 if (!transform.IsTranslationScaleOnly()) {
34 return false;
35 }
37 return coverage.Contains(rect);
38}
39
41 return true;
42}
43
44} // namespace impeller
Matrix GetShaderTransform(const RenderPass &pass) const
Get the vertex shader transform used for drawing this Entity.
Definition: entity.cc:50
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...
std::optional< Rect > GetCoverage(const Matrix &transform) const override
GeometryResult GetPositionBuffer(const ContentContext &renderer, const Entity &entity, RenderPass &pass) const override
bool IsAxisAlignedRect() const override
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
@ kNone
Does not use the index buffer.
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
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition: rect.h:463
constexpr std::array< TPoint< T >, 4 > GetPoints() const
Get the points that represent the 4 corners of this rectangle in a Z order that is compatible with tr...
Definition: rect.h:405