Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
impeller::RectanglePacker Class Referenceabstract

Packs rectangles into a specified area without rotating them. More...

#include <rectangle_packer.h>

Inheritance diagram for impeller::RectanglePacker:
impeller::SkylineRectanglePacker

Public Member Functions

virtual ~RectanglePacker ()
 
virtual bool addRect (int width, int height, IPoint16 *loc)=0
 Attempt to add a rect without moving already placed rectangles.
 
virtual float percentFull () const =0
 Returns how much area has been filled with rectangles.
 
virtual void reset ()=0
 Empty out all previously added rectangles.
 

Static Public Member Functions

static std::unique_ptr< RectanglePackerFactory (int width, int height)
 Return an empty packer with area specified by width and height.
 

Protected Member Functions

 RectanglePacker (int width, int height)
 
int width () const
 
int height () const
 

Detailed Description

Packs rectangles into a specified area without rotating them.

Definition at line 25 of file rectangle_packer.h.

Constructor & Destructor Documentation

◆ ~RectanglePacker()

virtual impeller::RectanglePacker::~RectanglePacker ( )
inlinevirtual

Definition at line 32 of file rectangle_packer.h.

32{}

◆ RectanglePacker()

impeller::RectanglePacker::RectanglePacker ( int  width,
int  height 
)
inlineprotected

Definition at line 59 of file rectangle_packer.h.

59 : width_(width), height_(height) {
60 FML_DCHECK(width >= 0);
61 FML_DCHECK(height >= 0);
62 }
#define FML_DCHECK(condition)
Definition logging.h:103

Member Function Documentation

◆ addRect()

virtual bool impeller::RectanglePacker::addRect ( int  width,
int  height,
IPoint16 loc 
)
pure virtual

Attempt to add a rect without moving already placed rectangles.

Parameters
[in]widthThe width of the rectangle to add.
[in]heightThe height of the rectangle to add.
[out]locIf successful, will be set to the position of the upper-left corner of the rectangle.
Returns
Return true on success; false on failure.

Implemented in impeller::SkylineRectanglePacker.

◆ Factory()

std::unique_ptr< RectanglePacker > impeller::RectanglePacker::Factory ( int  width,
int  height 
)
static

Return an empty packer with area specified by width and height.

Definition at line 169 of file rectangle_packer.cc.

170 {
171 return std::make_unique<SkylineRectanglePacker>(width, height);
172}

◆ height()

int impeller::RectanglePacker::height ( ) const
inlineprotected

Definition at line 65 of file rectangle_packer.h.

65{ return height_; }

◆ percentFull()

virtual float impeller::RectanglePacker::percentFull ( ) const
pure virtual

Returns how much area has been filled with rectangles.

Returns
Percentage as a decimal between 0.0 and 1.0

Implemented in impeller::SkylineRectanglePacker.

◆ reset()

virtual void impeller::RectanglePacker::reset ( )
pure virtual

Empty out all previously added rectangles.

Implemented in impeller::SkylineRectanglePacker.

◆ width()

int impeller::RectanglePacker::width ( ) const
inlineprotected

Definition at line 64 of file rectangle_packer.h.

64{ return width_; }

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