LibreOffice Module libreofficekit (master) 1
Public Member Functions | Private Attributes | List of all members
TileBuffer Class Reference

This class represents the tile buffer which is responsible for managing, reusing and caching all the already rendered tiles. More...

#include <tilebuffer.hxx>

Collaboration diagram for TileBuffer:
[legend]

Public Member Functions

 TileBuffer (int columns=0, int scale=1)
 
TilegetTile (int x, int y, GTask *task, GThreadPool *pool)
 Gets the underlying Tile object for given position. More...
 
void setTile (int x, int y, cairo_surface_t *surface)
 
bool hasValidTile (int x, int y)
 Returns true if a valid tile exists at this location. More...
 
void resetAllTiles ()
 Destroys all the tiles in the tile buffer; also frees the memory allocated for all the Tile objects. More...
 
void setInvalid (int x, int y, float zoom, GTask *task, GThreadPool *)
 Marks the tile as invalid. More...
 

Private Attributes

std::map< int, Tilem_mTiles
 Stores all the tiles cached by this tile buffer. More...
 
int m_nWidth
 Width of the current tile buffer (number of columns) More...
 
Tile m_DummyTile
 Dummy tile. More...
 

Detailed Description

This class represents the tile buffer which is responsible for managing, reusing and caching all the already rendered tiles.

If the given tile is not present in the buffer, call to LOK Document's (m_pLOKDocument) paintTile method is made which fetches the rendered tile from LO core and store it in buffer for future reuse.

Definition at line 90 of file tilebuffer.hxx.

Constructor & Destructor Documentation

◆ TileBuffer()

TileBuffer::TileBuffer ( int  columns = 0,
int  scale = 1 
)
inline

Definition at line 93 of file tilebuffer.hxx.

References m_DummyTile, nTileSizePixels, scale, and Tile::setSurface().

Member Function Documentation

◆ getTile()

Tile & TileBuffer::getTile ( int  x,
int  y,
GTask *  task,
GThreadPool *  pool 
)

Gets the underlying Tile object for given position.

The position (0, 0) points to the left top most tile of the buffer.

If the tile is not cached by the tile buffer, it makes a paintTile call to LO core asking to render the given tile. It then stores the tile for future reuse.

Parameters
xthe tile along the x-axis of the buffer
ythe tile along the y-axis of the buffer
taskGTask object containing the necessary data
poolGThreadPool managed by the widget instance used for all the LOK calls made by widget. It is needed here because getTile invokes one of the LOK call : paintTile.
Returns
the tile at the mentioned position (x, y)

Definition at line 85 of file tilebuffer.cxx.

References index, m_DummyTile, m_mTiles, m_nWidth, x, and y.

◆ hasValidTile()

bool TileBuffer::hasValidTile ( int  x,
int  y 
)

Returns true if a valid tile exists at this location.

Definition at line 123 of file tilebuffer.cxx.

References index, m_mTiles, m_nWidth, x, and y.

◆ resetAllTiles()

void TileBuffer::resetAllTiles ( )

Destroys all the tiles in the tile buffer; also frees the memory allocated for all the Tile objects.

Definition at line 54 of file tilebuffer.cxx.

References m_mTiles.

◆ setInvalid()

void TileBuffer::setInvalid ( int  x,
int  y,
float  zoom,
GTask *  task,
GThreadPool *  lokThreadPool 
)

Marks the tile as invalid.

The tile (0, 0) is the left topmost tile in the tile buffer.

Parameters
xthe position of tile along x-axis
ythe position of tile along y-axis
zoomzoom factor of the document
taskGTask object containing the necessary data
poolGThreadPool managed by the widget instance used for all the LOK calls made by widget. It is needed here because setInvalid() invokes one of the LOK call : paintTile.

Definition at line 62 of file tilebuffer.cxx.

References LOEvent::destroy(), index, LOK_PAINT_TILE, LOEvent::m_fPaintTileZoom, m_mTiles, LOEvent::m_nPaintTileX, LOEvent::m_nPaintTileY, m_nWidth, x, and y.

◆ setTile()

void TileBuffer::setTile ( int  x,
int  y,
cairo_surface_t surface 
)

Definition at line 115 of file tilebuffer.cxx.

References index, m_mTiles, m_nWidth, x, and y.

Member Data Documentation

◆ m_DummyTile

Tile TileBuffer::m_DummyTile
private

Dummy tile.

Definition at line 152 of file tilebuffer.hxx.

Referenced by getTile(), and TileBuffer().

◆ m_mTiles

std::map<int, Tile> TileBuffer::m_mTiles
private

Stores all the tiles cached by this tile buffer.

Definition at line 148 of file tilebuffer.hxx.

Referenced by getTile(), hasValidTile(), resetAllTiles(), setInvalid(), and setTile().

◆ m_nWidth

int TileBuffer::m_nWidth
private

Width of the current tile buffer (number of columns)

Definition at line 150 of file tilebuffer.hxx.

Referenced by getTile(), hasValidTile(), setInvalid(), and setTile().


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