Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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)
 
void saveXY (SkFixed x, SkFixed y, SkFixed dY)
 
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
 
SkAnalyticEdgefRiteE
 
SkFixed fX
 
SkFixed fDX
 
SkFixed fUpperX
 
SkFixed fY
 
SkFixed fUpperY
 
SkFixed fLowerY
 
SkFixed fDY
 
SkFixed fSavedX
 
SkFixed fSavedY
 
SkFixed fSavedDY
 
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 132 of file SkAnalyticEdge.h.

Member Function Documentation

◆ keepContinuous()

void SkAnalyticCubicEdge::keepContinuous ( )
inline

Definition at line 139 of file SkAnalyticEdge.h.

139 {
141 fCEdge.fCx = fX;
142 fSnappedY = fY;
143 }
#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:82
SkFixed fCy
Definition SkEdge.h:82

◆ setCubic()

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

Definition at line 356 of file SkAnalyticEdge.cpp.

356 {
357 fRiteE = nullptr;
358
360 return false;
361 }
362
375
381
383
384 return this->updateCubic(sortY);
385}
bool updateCubic(bool sortY=true)
static const int kDefaultAccuracy
SkAnalyticEdge * fRiteE
SkFixed fCDDy
Definition SkEdge.h:84
bool setCubicWithoutUpdate(const SkPoint pts[4], int shiftUp, bool sortY=true)
Definition SkEdge.cpp:373
SkFixed fCLastY
Definition SkEdge.h:86
SkFixed fCLastX
Definition SkEdge.h:86
SkFixed fCDDDy
Definition SkEdge.h:85
SkFixed fCDDDx
Definition SkEdge.h:85
SkFixed fCDx
Definition SkEdge.h:83
SkFixed fCDy
Definition SkEdge.h:83
SkFixed fCDDx
Definition SkEdge.h:84
int8_t fWinding
Definition SkEdge.h:44
uint8_t fCurveShift
Definition SkEdge.h:42
int8_t fCurveCount
Definition SkEdge.h:41
uint8_t fCubicDShift
Definition SkEdge.h:43

◆ updateCubic()

bool SkAnalyticCubicEdge::updateCubic ( bool  sortY = true)

Definition at line 387 of file SkAnalyticEdge.cpp.

387 {
388 int success;
389 int count = fCurveCount;
390 SkFixed oldx = fCEdge.fCx;
391 SkFixed oldy = fCEdge.fCy;
392 SkFixed newx, newy;
393 const int ddshift = fCurveShift;
394 const int dshift = fCubicDShift;
395
396 SkASSERT(count < 0);
397
398 do {
399 if (++count < 0) {
400 newx = oldx + (fCEdge.fCDx >> dshift);
401 fCEdge.fCDx += fCEdge.fCDDx >> ddshift;
403
404 newy = oldy + (fCEdge.fCDy >> dshift);
405 fCEdge.fCDy += fCEdge.fCDDy >> ddshift;
407 }
408 else { // last segment
409 newx = fCEdge.fCLastX;
410 newy = fCEdge.fCLastY;
411 }
412
413 // we want to say SkASSERT(oldy <= newy), but our finite fixedpoint
414 // doesn't always achieve that, so we have to explicitly pin it here.
415 if (sortY && newy < oldy) {
416 newy = oldy;
417 }
418
419 SkFixed newSnappedY = SnapY(newy);
420 // we want to SkASSERT(snappedNewY <= fCEdge.fCLastY), but our finite fixedpoint
421 // doesn't always achieve that, so we have to explicitly pin it here.
422 if (sortY && fCEdge.fCLastY < newSnappedY) {
423 newSnappedY = fCEdge.fCLastY;
424 count = 0;
425 }
426
427 SkFixed slope = SkFixedToFDot6(newSnappedY - fSnappedY) == 0
428 ? SK_MaxS32
429 : SkFDot6Div(SkFixedToFDot6(newx - oldx),
430 SkFixedToFDot6(newSnappedY - fSnappedY));
431
432 success = this->updateLine(oldx, fSnappedY, newx, newSnappedY, slope);
433
434 oldx = newx;
435 oldy = newy;
436 fSnappedY = newSnappedY;
437 } while (count < 0 && !success);
438
439 fCEdge.fCx = newx;
440 fCEdge.fCy = newy;
442 return success;
443}
int count
#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 133 of file SkAnalyticEdge.h.

◆ fSnappedY

SkFixed SkAnalyticCubicEdge::fSnappedY

Definition at line 135 of file SkAnalyticEdge.h.


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