Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
ToolUtils::HilbertGenerator Class Reference

#include <ToolUtils.h>

Public Member Functions

 HilbertGenerator (float desiredSize, float desiredLineWidth, int desiredDepth)
 
void draw (SkCanvas *canvas)
 

Detailed Description

Definition at line 99 of file ToolUtils.h.

Constructor & Destructor Documentation

◆ HilbertGenerator()

ToolUtils::HilbertGenerator::HilbertGenerator ( float  desiredSize,
float  desiredLineWidth,
int  desiredDepth 
)

Definition at line 606 of file ToolUtils.cpp.

607 : fDesiredSize(desiredSize)
608 , fDesiredDepth(desiredDepth)
609 , fSegmentLength(fDesiredSize / ((0x1 << fDesiredDepth) - 1.0f))
610 , fDesiredLineWidth(desiredLineWidth)
611 , fActualBounds(SkRect::MakeEmpty())
612 , fCurPos(SkPoint::Make(0.0f, 0.0f))
613 , fCurDir(0)
614 , fExpectedLen(fSegmentLength * ((0x1 << (2*fDesiredDepth)) - 1.0f))
615 , fCurLen(0.0f) {
616}
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595

Member Function Documentation

◆ draw()

void ToolUtils::HilbertGenerator::draw ( SkCanvas canvas)

Definition at line 618 of file ToolUtils.cpp.

618 {
619 this->recursiveDraw(canvas, /* curDepth= */ 0, /* turnLeft= */ true);
620
621 SkScalarNearlyEqual(fExpectedLen, fCurLen, 0.01f);
622 SkScalarNearlyEqual(fDesiredSize, fActualBounds.width(), 0.01f);
623 SkScalarNearlyEqual(fDesiredSize, fActualBounds.height(), 0.01f);
624}
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:107
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

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