Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ManyRectsSlide Class Reference
Inheritance diagram for ManyRectsSlide:
Slide SkRefCnt SkRefCntBase

Public Member Functions

 ManyRectsSlide ()
 
void draw (SkCanvas *canvas) override
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
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

Animated sample used to develop a predecessor of GrDrawOp combining.

Definition at line 16 of file ManyRectsSlide.cpp.

Constructor & Destructor Documentation

◆ ManyRectsSlide()

ManyRectsSlide::ManyRectsSlide ( )
inline

Definition at line 23 of file ManyRectsSlide.cpp.

23{ fName = "ManyRects"; }
SkString fName
Definition Slide.h:54

Member Function Documentation

◆ draw()

void ManyRectsSlide::draw ( SkCanvas canvas)
inlineoverridevirtual

Implements Slide.

Definition at line 25 of file ManyRectsSlide.cpp.

25 {
26 SkISize dsize = canvas->getBaseLayerSize();
27 canvas->clear(0xFFF0E0F0);
28
29 for (int i = 0; i < N; ++i) {
31 SkIntToScalar(fRandom.nextRangeU(10, 100)));
32 int x = fRandom.nextRangeU(0, dsize.fWidth);
33 int y = fRandom.nextRangeU(0, dsize.fHeight);
34 canvas->save();
35
37 // Uncomment to test rotated rect draw combining.
38 if ((false)) {
40 rotate.setRotate(fRandom.nextUScalar1() * 360,
42 SkIntToScalar(y) + SkScalarHalf(rect.fBottom));
43 canvas->concat(rotate);
44 }
46 // This clip will always contain the entire rect. It's here to give the GPU op combining
47 // code a little more challenge.
48 clipRect.outset(10, 10);
49 canvas->clipRect(clipRect);
51 paint.setColor(fRandom.nextU());
52 canvas->drawRect(rect, paint);
53 canvas->restore();
54 }
55 }
static bool rotate(const SkDCubic &cubic, int zero, int index, SkDCubic &rotPath)
#define SkScalarHalf(a)
Definition SkScalar.h:75
#define SkIntToScalar(x)
Definition SkScalar.h:57
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
void restore()
Definition SkCanvas.cpp:465
void translate(SkScalar dx, SkScalar dy)
virtual SkISize getBaseLayerSize() const
Definition SkCanvas.cpp:373
void clear(SkColor color)
Definition SkCanvas.h:1199
int save()
Definition SkCanvas.cpp:451
void concat(const SkMatrix &matrix)
SkMatrix & setRotate(SkScalar degrees, SkScalar px, SkScalar py)
Definition SkMatrix.cpp:452
uint32_t nextU()
Definition SkRandom.h:42
SkScalar nextUScalar1()
Definition SkRandom.h:101
uint32_t nextRangeU(uint32_t min, uint32_t max)
Definition SkRandom.h:80
const Paint & paint
double y
double x
clipRect(r.rect, r.opAA.op(), r.opAA.aa())) template<> void Draw
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
int32_t fHeight
Definition SkSize.h:18
int32_t fWidth
Definition SkSize.h:17
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

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