Flutter Impeller
impeller::Tessellator::ArcVertexGenerator Class Reference

The |VertexGenerator| implementation common to all shapes that are based on a polygonal representation of an ellipse. More...

#include <tessellator.h>

Inheritance diagram for impeller::Tessellator::ArcVertexGenerator:
impeller::Tessellator::VertexGenerator

Public Member Functions

PrimitiveType GetTriangleType () const override
 |VertexGenerator| More...
 
size_t GetVertexCount () const override
 |VertexGenerator| More...
 
void GenerateVertices (const TessellatedVertexProc &proc) const override
 |VertexGenerator| More...
 

Static Public Member Functions

static ArcVertexGenerator MakeFilled (const Arc::Iteration &iteration, Trigs &&trigs, const Rect &oval_bounds, bool use_center, bool supports_triangle_fans)
 
static ArcVertexGenerator MakeStroked (const Arc::Iteration &iteration, Trigs &&trigs, const Rect &oval_bounds, Scalar half_width, Cap cap, std::unique_ptr< Trigs > round_cap_trigs)
 

Friends

class Tessellator
 

Detailed Description

The |VertexGenerator| implementation common to all shapes that are based on a polygonal representation of an ellipse.

Definition at line 191 of file tessellator.h.

Member Function Documentation

◆ GenerateVertices()

void impeller::ArcVertexGenerator::GenerateVertices ( const TessellatedVertexProc proc) const
overridevirtual

|VertexGenerator|

Implements impeller::Tessellator::VertexGenerator.

Definition at line 597 of file tessellator.cc.

598  {
599  if (half_width_ > 0) {
600  FML_DCHECK(!use_center_);
601  Tessellator::GenerateStrokedArc(trigs_, iteration_, oval_bounds_,
602  half_width_, cap_, round_cap_trigs_, proc);
603  } else if (supports_triangle_fans_) {
604  Tessellator::GenerateFilledArcFan(trigs_, iteration_, oval_bounds_,
605  use_center_, proc);
606  } else {
607  Tessellator::GenerateFilledArcStrip(trigs_, iteration_, oval_bounds_,
608  use_center_, proc);
609  }
610 }

◆ GetTriangleType()

PrimitiveType impeller::ArcVertexGenerator::GetTriangleType ( ) const
overridevirtual

|VertexGenerator|

Implements impeller::Tessellator::VertexGenerator.

Definition at line 564 of file tessellator.cc.

564  {
565  return (half_width_ < 0 && supports_triangle_fans_)
568 }

References impeller::kTriangleFan, and impeller::kTriangleStrip.

◆ GetVertexCount()

size_t impeller::ArcVertexGenerator::GetVertexCount ( ) const
overridevirtual

|VertexGenerator|

Implements impeller::Tessellator::VertexGenerator.

Definition at line 570 of file tessellator.cc.

570  {
571  size_t count = iteration_.GetPointCount();
572  if (half_width_ > 0) {
573  // Stroked arc
574  FML_DCHECK(!use_center_);
575  count *= 2;
576  if (cap_ == Cap::kSquare) {
577  count += 4;
578  } else if (cap_ == Cap::kRound) {
579  FML_DCHECK(round_cap_trigs_);
580  // 4 vertices for each Trig in round_cap_trigs_: 2 vertices for each in
581  // the start cap and 2 for each in the end cap. Subtract 4 because the cap
582  // vertices elide the beginning and end vertices of the arc.
583  count += round_cap_trigs_->size() * 4 - 4;
584  }
585  } else if (supports_triangle_fans_) {
586  // Filled arc using a triangle fan
587  if (use_center_) {
588  count++;
589  }
590  } else {
591  // Filled arc using a triangle strip
592  count = (2 * count) - 1;
593  }
594  return count;
595 }
size_t GetPointCount() const
Definition: arc.cc:36

References impeller::Arc::Iteration::GetPointCount(), impeller::kRound, and impeller::kSquare.

◆ MakeFilled()

ArcVertexGenerator impeller::ArcVertexGenerator::MakeFilled ( const Arc::Iteration iteration,
Trigs &&  trigs,
const Rect oval_bounds,
bool  use_center,
bool  supports_triangle_fans 
)
static

Definition at line 525 of file tessellator.cc.

530  {
531  return ArcVertexGenerator(iteration, std::move(trigs), oval_bounds,
532  use_center, supports_triangle_fans, -1.0f,
533  Cap::kSquare, nullptr);
534 }
bool use_center

References use_center.

Referenced by impeller::Tessellator::FilledArc().

◆ MakeStroked()

ArcVertexGenerator impeller::ArcVertexGenerator::MakeStroked ( const Arc::Iteration iteration,
Trigs &&  trigs,
const Rect oval_bounds,
Scalar  half_width,
Cap  cap,
std::unique_ptr< Trigs round_cap_trigs 
)
static

Definition at line 536 of file tessellator.cc.

542  {
543  return ArcVertexGenerator(iteration, std::move(trigs), oval_bounds, false,
544  false, half_width, cap, std::move(round_cap_trigs));
545 }

Referenced by impeller::Tessellator::StrokedArc().

Friends And Related Function Documentation

◆ Tessellator

friend class Tessellator
friend

Definition at line 217 of file tessellator.h.


The documentation for this class was generated from the following files: