| 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,
21 renderer.GetTessellator()->FilledEllipse(entity.GetTransform(), bounds_),
22 entity, pass);
23 }
24
25 // |Geometry|
26 GeometryResult EllipseGeometry::GetPositionUVBuffer(
27 Rect texture_coverage,
28 Matrix effect_transform,
29 const ContentContext& renderer,
30 const Entity& entity,
31 RenderPass& pass) const {
32 return ComputePositionUVGeometry(
33 renderer,
34 renderer.GetTessellator()->FilledEllipse(entity.GetTransform(), bounds_),
35 texture_coverage.GetNormalizingTransform() * effect_transform, entity,
36 pass);
37 }
38
39 GeometryVertexType EllipseGeometry::GetVertexType() const {
40 return GeometryVertexType::kPosition;
41 }
42
43 std::optional<Rect> EllipseGeometry::GetCoverage(
44 const Matrix& transform) const {
45 return bounds_.TransformBounds(transform);
46 }
47
48 bool EllipseGeometry::CoversArea(const Matrix& transform,
49 const Rect& rect) const {
50 return false;
51 }
52
53 bool EllipseGeometry::IsAxisAlignedRect() const {
54 return false;
55 }
56
57 } // 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:405
impeller::GeometryVertexType
GeometryVertexType
Definition: geometry.h:49
impeller::Geometry::ComputePositionGeometry
static GeometryResult ComputePositionGeometry(const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Entity &entity, RenderPass &pass)
Definition: geometry.cc:25
impeller::Entity
Definition: entity.h:21
impeller::Geometry::ComputePositionUVGeometry
static GeometryResult ComputePositionUVGeometry(const ContentContext &renderer, const Tessellator::VertexGenerator &generator, const Matrix &uv_transform, const Entity &entity, RenderPass &pass)
Definition: geometry.cc:57
impeller::GeometryResult
Definition: geometry.h:20
ellipse_geometry.h
impeller::Rect
TRect< Scalar > Rect
Definition: rect.h:661
impeller::ContentContext::GetTessellator
std::shared_ptr< Tessellator > GetTessellator() const
Definition: content_context.cc:560
impeller::RenderPass
Render passes encode render commands directed as one specific render target into an underlying comman...
Definition: render_pass.h:33
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:48
impeller::EllipseGeometry::IsAxisAlignedRect
bool IsAxisAlignedRect() const override
Definition: ellipse_geometry.cc:53
impeller
Definition: aiks_blur_unittests.cc:20
impeller::kPosition
@ kPosition
Definition: geometry.h:50
impeller::ContentContext
Definition: content_context.h:392
impeller::TRect< Scalar >
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37