Flutter Engine
The Flutter Engine
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. More...
 
virtual Scalar PercentFull () const =0
 Returns how much area has been filled with rectangles. More...
 
virtual void Reset ()=0
 Empty out all previously added rectangles. More...
 

Static Public Member Functions

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

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 26 of file rectangle_packer.h.

Constructor & Destructor Documentation

◆ ~RectanglePacker()

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

Definition at line 33 of file rectangle_packer.h.

33{}

◆ RectanglePacker()

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

Definition at line 60 of file rectangle_packer.h.

60 : width_(width), height_(height) {
61 FML_DCHECK(width >= 0);
62 FML_DCHECK(height >= 0);
63 }
#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::shared_ptr< RectanglePacker > impeller::RectanglePacker::Factory ( int  width,
int  height 
)
static

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

Definition at line 174 of file rectangle_packer.cc.

175 {
176 return std::make_shared<SkylineRectanglePacker>(width, height);
177}

◆ height()

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

Definition at line 66 of file rectangle_packer.h.

66{ return height_; }

◆ PercentFull()

virtual Scalar 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 65 of file rectangle_packer.h.

65{ return width_; }

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