Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkAutoConicToQuads Class Reference

#include <SkGeometry.h>

Public Member Functions

 SkAutoConicToQuads ()
 
const SkPointcomputeQuads (const SkConic &conic, SkScalar tol)
 
const SkPointcomputeQuads (const SkPoint pts[3], SkScalar weight, SkScalar tol)
 
int countQuads () const
 

Detailed Description

Help class to allocate storage for approximating a conic with N quads.

Definition at line 508 of file SkGeometry.h.

Constructor & Destructor Documentation

◆ SkAutoConicToQuads()

SkAutoConicToQuads::SkAutoConicToQuads ( )
inline

Definition at line 510 of file SkGeometry.h.

510: fQuadCount(0) {}

Member Function Documentation

◆ computeQuads() [1/2]

const SkPoint * SkAutoConicToQuads::computeQuads ( const SkConic conic,
SkScalar  tol 
)
inline

Given a conic and a tolerance, return the array of points for the approximating quad(s). Call countQuads() to know the number of quads represented in these points.

The quads are allocated to share end-points. e.g. if there are 4 quads, there will be 9 points allocated as follows quad[0] == pts[0..2] quad[1] == pts[2..4] quad[2] == pts[4..6] quad[3] == pts[6..8]

Definition at line 524 of file SkGeometry.h.

524 {
525 int pow2 = conic.computeQuadPOW2(tol);
526 fQuadCount = 1 << pow2;
527 SkPoint* pts = fStorage.reset(1 + 2 * fQuadCount);
528 fQuadCount = conic.chopIntoQuadsPOW2(pts, pow2);
529 return pts;
530 }
T * reset(size_t count)
Definition: SkTemplates.h:356
AI float conic(float tolerance, const SkPoint pts[], float w, const VectorXform &vectorXform=VectorXform())
Definition: WangsFormula.h:287

◆ computeQuads() [2/2]

const SkPoint * SkAutoConicToQuads::computeQuads ( const SkPoint  pts[3],
SkScalar  weight,
SkScalar  tol 
)
inline

Definition at line 532 of file SkGeometry.h.

533 {
535 conic.set(pts, weight);
536 return computeQuads(conic, tol);
537 }
const SkPoint * computeQuads(const SkConic &conic, SkScalar tol)
Definition: SkGeometry.h:524

◆ countQuads()

int SkAutoConicToQuads::countQuads ( ) const
inline

Definition at line 539 of file SkGeometry.h.

539{ return fQuadCount; }

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