Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
SkAnalyticCubicEdge Struct Reference

#include <SkAnalyticEdge.h>

Inheritance diagram for SkAnalyticCubicEdge:
SkAnalyticEdge

Public Member Functions

bool setCubic (const SkPoint pts[4], bool sortY=true)
 
bool updateCubic (bool sortY=true)
 
void keepContinuous ()
 
- Public Member Functions inherited from SkAnalyticEdge
void goY (SkFixed y)
 
void goY (SkFixed y, int yShift)
 
bool setLine (const SkPoint &p0, const SkPoint &p1)
 
bool updateLine (SkFixed ax, SkFixed ay, SkFixed bx, SkFixed by, SkFixed slope)
 
bool update (SkFixed last_y, bool sortY=true)
 

Public Attributes

SkCubicEdge fCEdge
 
SkFixed fSnappedY
 
- Public Attributes inherited from SkAnalyticEdge
SkAnalyticEdgefNext
 
SkAnalyticEdgefPrev
 
SkFixed fX
 
SkFixed fDX
 
SkFixed fUpperX
 
SkFixed fY
 
SkFixed fUpperY
 
SkFixed fLowerY
 
SkFixed fDY
 
Type fEdgeType
 
int8_t fCurveCount
 
uint8_t fCurveShift
 
uint8_t fCubicDShift
 
int8_t fWinding
 

Additional Inherited Members

- Public Types inherited from SkAnalyticEdge
enum  Type { kLine_Type , kQuad_Type , kCubic_Type }
 
- Static Public Member Functions inherited from SkAnalyticEdge
static SkFixed SnapY (SkFixed y)
 
- Static Public Attributes inherited from SkAnalyticEdge
static const int kDefaultAccuracy = 2
 

Detailed Description

Definition at line 118 of file SkAnalyticEdge.h.

Member Function Documentation

◆ keepContinuous()

void SkAnalyticCubicEdge::keepContinuous ( )
inline

Definition at line 125 of file SkAnalyticEdge.h.

125 {
127 fCEdge.fCx = fX;
128 fSnappedY = fY;
129 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SK_Fixed1
Definition: SkFixed.h:26
static SkFixed SkFixedMul(SkFixed a, SkFixed b)
Definition: SkFixed.h:96
static int32_t SkAbs32(int32_t value)
Definition: SkSafe32.h:41
static SkFixed SnapY(SkFixed y)
SkFixed fCx
Definition: SkEdge.h:83
SkFixed fCy
Definition: SkEdge.h:83

◆ setCubic()

bool SkAnalyticCubicEdge::setCubic ( const SkPoint  pts[4],
bool  sortY = true 
)

Definition at line 352 of file SkAnalyticEdge.cpp.

352 {
354 return false;
355 }
356
369
375
377
378 return this->updateCubic(sortY);
379}
bool updateCubic(bool sortY=true)
static const int kDefaultAccuracy
uint8_t fCurveShift
uint8_t fCubicDShift
SkFixed fCDDy
Definition: SkEdge.h:85
bool setCubicWithoutUpdate(const SkPoint pts[4], int shiftUp, bool sortY=true)
Definition: SkEdge.cpp:373
SkFixed fCLastY
Definition: SkEdge.h:87
SkFixed fCLastX
Definition: SkEdge.h:87
SkFixed fCDDDy
Definition: SkEdge.h:86
SkFixed fCDDDx
Definition: SkEdge.h:86
SkFixed fCDx
Definition: SkEdge.h:84
SkFixed fCDy
Definition: SkEdge.h:84
SkFixed fCDDx
Definition: SkEdge.h:85
int8_t fWinding
Definition: SkEdge.h:45
uint8_t fCurveShift
Definition: SkEdge.h:43
int8_t fCurveCount
Definition: SkEdge.h:42
uint8_t fCubicDShift
Definition: SkEdge.h:44

◆ updateCubic()

bool SkAnalyticCubicEdge::updateCubic ( bool  sortY = true)

Definition at line 381 of file SkAnalyticEdge.cpp.

381 {
382 int success;
383 int count = fCurveCount;
384 SkFixed oldx = fCEdge.fCx;
385 SkFixed oldy = fCEdge.fCy;
386 SkFixed newx, newy;
387 const int ddshift = fCurveShift;
388 const int dshift = fCubicDShift;
389
390 SkASSERT(count < 0);
391
392 do {
393 if (++count < 0) {
394 newx = oldx + (fCEdge.fCDx >> dshift);
395 fCEdge.fCDx += fCEdge.fCDDx >> ddshift;
397
398 newy = oldy + (fCEdge.fCDy >> dshift);
399 fCEdge.fCDy += fCEdge.fCDDy >> ddshift;
401 }
402 else { // last segment
403 newx = fCEdge.fCLastX;
404 newy = fCEdge.fCLastY;
405 }
406
407 // we want to say SkASSERT(oldy <= newy), but our finite fixedpoint
408 // doesn't always achieve that, so we have to explicitly pin it here.
409 if (sortY && newy < oldy) {
410 newy = oldy;
411 }
412
413 SkFixed newSnappedY = SnapY(newy);
414 // we want to SkASSERT(snappedNewY <= fCEdge.fCLastY), but our finite fixedpoint
415 // doesn't always achieve that, so we have to explicitly pin it here.
416 if (sortY && fCEdge.fCLastY < newSnappedY) {
417 newSnappedY = fCEdge.fCLastY;
418 count = 0;
419 }
420
421 SkFixed slope = SkFixedToFDot6(newSnappedY - fSnappedY) == 0
422 ? SK_MaxS32
423 : SkFDot6Div(SkFixedToFDot6(newx - oldx),
424 SkFixedToFDot6(newSnappedY - fSnappedY));
425
426 success = this->updateLine(oldx, fSnappedY, newx, newSnappedY, slope);
427
428 oldx = newx;
429 oldy = newy;
430 fSnappedY = newSnappedY;
431 } while (count < 0 && !success);
432
433 fCEdge.fCx = newx;
434 fCEdge.fCy = newy;
436 return success;
437}
int count
Definition: FontMgrTest.cpp:50
#define SkFixedToFDot6(x)
Definition: SkFDot6.h:56
SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b)
Definition: SkFDot6.h:68
int32_t SkFixed
Definition: SkFixed.h:25
static constexpr int32_t SK_MaxS32
Definition: SkMath.h:21
constexpr int8_t SkToS8(S x)
Definition: SkTo.h:21
bool updateLine(SkFixed ax, SkFixed ay, SkFixed bx, SkFixed by, SkFixed slope)

Member Data Documentation

◆ fCEdge

SkCubicEdge SkAnalyticCubicEdge::fCEdge

Definition at line 119 of file SkAnalyticEdge.h.

◆ fSnappedY

SkFixed SkAnalyticCubicEdge::fSnappedY

Definition at line 121 of file SkAnalyticEdge.h.


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