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

#include <ToolUtils.h>

Public Member Functions

 PixelIter ()
 
 PixelIter (SkSurface *surf)
 
void reset (const SkPixmap &pm)
 
void * next (SkIPoint *loc=nullptr)
 
void setDone ()
 

Detailed Description

Definition at line 270 of file ToolUtils.h.

Constructor & Destructor Documentation

◆ PixelIter() [1/2]

ToolUtils::PixelIter::PixelIter ( )

◆ PixelIter() [2/2]

ToolUtils::PixelIter::PixelIter ( SkSurface surf)
inline

Definition at line 273 of file ToolUtils.h.

273 {
274 SkPixmap pm;
275 if (!surf->peekPixels(&pm)) {
276 pm.reset();
277 }
278 this->reset(pm);
279 }
void reset()
Definition: SkPixmap.cpp:32
bool peekPixels(SkPixmap *pixmap)
Definition: SkSurface.cpp:121
void reset(const SkPixmap &pm)
Definition: ToolUtils.h:281

Member Function Documentation

◆ next()

void * ToolUtils::PixelIter::next ( SkIPoint loc = nullptr)
inline

Definition at line 286 of file ToolUtils.h.

286 {
287 if (!fPM.addr()) {
288 return nullptr;
289 }
290 fLoc.fX += 1;
291 if (fLoc.fX >= fPM.width()) {
292 fLoc.fX = 0;
293 if (++fLoc.fY >= fPM.height()) {
294 this->setDone();
295 return nullptr;
296 }
297 }
298 if (loc) {
299 *loc = fLoc;
300 }
301 return fPM.writable_addr(fLoc.fX, fLoc.fY);
302 }
int width() const
Definition: SkPixmap.h:160
void * writable_addr() const
Definition: SkPixmap.h:483
const void * addr() const
Definition: SkPixmap.h:153
int height() const
Definition: SkPixmap.h:166
int32_t fX
x-axis value
Definition: SkPoint_impl.h:29
int32_t fY
y-axis value
Definition: SkPoint_impl.h:30

◆ reset()

void ToolUtils::PixelIter::reset ( const SkPixmap pm)
inline

Definition at line 281 of file ToolUtils.h.

281 {
282 fPM = pm;
283 fLoc = {-1, 0};
284 }

◆ setDone()

void ToolUtils::PixelIter::setDone ( )
inline

Definition at line 304 of file ToolUtils.h.

304{ fPM.reset(); }

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