Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
DegenerateTwoPtRadialsSlide Class Reference
Inheritance diagram for DegenerateTwoPtRadialsSlide:
Slide SkRefCnt SkRefCntBase

Public Member Functions

 DegenerateTwoPtRadialsSlide ()
 
void draw (SkCanvas *canvas) override
 
bool animate (double nanos) override
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 38 of file DegenerateTwoPtRadialsSlide.cpp.

Constructor & Destructor Documentation

◆ DegenerateTwoPtRadialsSlide()

DegenerateTwoPtRadialsSlide::DegenerateTwoPtRadialsSlide ( )
inline

Definition at line 40 of file DegenerateTwoPtRadialsSlide.cpp.

40{ fName = "DegenerateTwoPtRadials"; }
SkString fName
Definition: Slide.h:54

Member Function Documentation

◆ animate()

bool DegenerateTwoPtRadialsSlide::animate ( double  nanos)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 68 of file DegenerateTwoPtRadialsSlide.cpp.

68 {
69 fTime = SkDoubleToScalar(1e-9 * nanos / 15);
70 return true;
71 }
#define SkDoubleToScalar(x)
Definition: SkScalar.h:64

◆ draw()

void DegenerateTwoPtRadialsSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 42 of file DegenerateTwoPtRadialsSlide.cpp.

42 {
43 canvas->clear(0xFFDDDDDD);
44 SkScalar delta = fTime / 15.f;
45 int intPart = SkScalarFloorToInt(delta);
46 delta = delta - SK_Scalar1 * intPart;
47 if (intPart % 2) {
49 }
51 static const int DELTA_SCALE = 500;
52 delta /= DELTA_SCALE;
53
54 SkScalar w = SK_Scalar1 * 500;
55 SkScalar h = SK_Scalar1 * 500;
56 SkScalar l = SK_Scalar1 * 100;
57 SkScalar t = SK_Scalar1 * 100;
58 draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta);
60 txt.appendf("gap at \"tangent\" pt = %f", delta);
61 canvas->drawString(txt,
62 l + w / 2 + w * DELTA_SCALE * delta,
63 t + h + SK_Scalar1 * 10,
65 SkPaint());
66 }
static void draw_gradient2(SkCanvas *canvas, const SkRect &rect, SkScalar delta)
#define SK_Scalar1
Definition: SkScalar.h:18
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkScalarFloorToInt(x)
Definition: SkScalar.h:35
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition: SkCanvas.h:1803
float SkScalar
Definition: extension.cpp:12
SkFont DefaultFont()
SkScalar w
SkScalar h
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659

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