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 595 of file tessellator.cc.

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

◆ 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  FML_DCHECK(!use_center_);
574  count *= 2;
575  if (cap_ == Cap::kSquare) {
576  count += 4;
577  } else if (cap_ == Cap::kRound) {
578  FML_DCHECK(round_cap_trigs_);
579  // 4 vertices for each Trig in round_cap_trigs_: 2 vertices for each in
580  // the start cap and 2 for each in the end cap. Subtract 4 because the cap
581  // vertices elide the beginning and end vertices of the arc.
582  count += round_cap_trigs_->size() * 4 - 4;
583  }
584  } else if (supports_triangle_fans_) {
585  if (use_center_) {
586  count++;
587  }
588  } else {
589  // corrugated triangle fan
590  count += (count + 1) / 2;
591  }
592  return count;
593 }
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: