| Flutter Impeller |

ellipse_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 <algorithm>
6
7 #include "flutter/impeller/entity/geometry/ellipse_geometry.h"
8
9 #include "flutter/impeller/entity/geometry/line_geometry.h"
10
11 namespace impeller {
12
13 EllipseGeometry::EllipseGeometry(Rect bounds) : bounds_(bounds) {}
14
15 GeometryResult EllipseGeometry::GetPositionBuffer(
16 const ContentContext& renderer,
17 const Entity& entity,
18 RenderPass& pass) const {
19 return ComputePositionGeometry(
20 renderer.GetTessellator()->FilledEllipse(entity.GetTransform(), bounds_),
21 entity, pass);
22 }
23
24 // |Geometry|
25 GeometryResult EllipseGeometry::GetPositionUVBuffer(
26 Rect texture_coverage,
27 Matrix effect_transform,
28 const ContentContext& renderer,
29 const Entity& entity,
30 RenderPass& pass) const {
31 return ComputePositionUVGeometry(
32 renderer.GetTessellator()->FilledEllipse(entity.GetTransform(), bounds_),
33 texture_coverage.GetNormalizingTransform() * effect_transform, entity,
34 pass);
35 }
36
37 GeometryVertexType EllipseGeometry::GetVertexType() const {
38 return GeometryVertexType::kPosition;
39 }
40
41 std::optional<Rect> EllipseGeometry::GetCoverage(
42 const Matrix& transform) const {
43 return bounds_.TransformBounds(transform);
44 }
45
46 bool EllipseGeometry::CoversArea(const Matrix& transform,
47 const Rect& rect) const {
48 return false;
49 }
50
51 bool EllipseGeometry::IsAxisAlignedRect() const {
52 return false;
53 }
54
55 } // namespace impeller
impeller::EllipseGeometry::EllipseGeometry
EllipseGeometry(Rect bounds)
Definition: ellipse_geometry.cc:13
impeller::Entity::GetTransform
const Matrix & GetTransform() const
Get the global transform matrix for this Entity.
Definition: entity.cc:49
impeller::TRect::TransformBounds
constexpr TRect TransformBounds(const Matrix &transform) const
Creates a new bounding box that contains this transformed rectangle.
Definition: rect.h:264
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:34
impeller::Entity
Definition: entity.h:21
impeller::GeometryResult
Definition: geometry.h:20
ellipse_geometry.h
impeller::Geometry::ComputePositionGeometry
static GeometryResult ComputePositionGeometry(const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
Definition: geometry.cc:23
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:488
impeller::ContentContext::GetTessellator
std::shared_ptr< Tessellator > GetTessellator() const
Definition: content_context.cc:475
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:29
line_geometry.h
impeller::EllipseGeometry::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: ellipse_geometry.cc:46
impeller::EllipseGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: ellipse_geometry.cc:51
impeller
Definition: aiks_context.cc:10
impeller::Geometry::ComputePositionUVGeometry
static GeometryResult ComputePositionUVGeometry(const Tessellator::VertexGenerator &generator, const Matrix &uv_transform, const Entity &entity, RenderPass &pass)
Definition: geometry.cc:55
impeller::kPosition
@ kPosition
Definition: geometry.h:35
impeller::ContentContext
Definition: content_context.h:332
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37