45 if (buffer !=
nullptr)
46 cairo_surface_reference(buffer);
58 tile.second.valid =
false;
63 GThreadPool* lokThreadPool)
66 GError* error =
nullptr;
77 g_thread_pool_push(lokThreadPool, g_object_ref(task), &error);
80 g_warning(
"Unable to call LOK_PAINT_TILE: %s", error->message);
81 g_clear_error(&error);
86 GThreadPool* lokThreadPool)
89 GError* error =
nullptr;
93 g_thread_pool_push(lokThreadPool, g_object_ref(task), &error);
96 g_warning(
"Unable to call LOK_PAINT_TILE: %s", error->message);
97 g_clear_error(&error);
103 g_thread_pool_push(lokThreadPool, g_object_ref(task), &error);
104 if (error !=
nullptr)
106 g_warning(
"Unable to call LOK_PAINT_TILE: %s", error->message);
107 g_clear_error(&error);
127 return (it !=
m_mTiles.end()) && it->second.valid;
139 return g_quark_from_static_string(
"lok-tilebuffer-error");
struct _cairo_surface cairo_surface_t
void setInvalid(int x, int y, float zoom, GTask *task, GThreadPool *)
Marks the tile as invalid.
void setTile(int x, int y, cairo_surface_t *surface)
void resetAllTiles()
Destroys all the tiles in the tile buffer; also frees the memory allocated for all the Tile objects.
bool hasValidTile(int x, int y)
Returns true if a valid tile exists at this location.
int m_nWidth
Width of the current tile buffer (number of columns)
Tile m_DummyTile
Dummy tile.
Tile & getTile(int x, int y, GTask *task, GThreadPool *pool)
Gets the underlying Tile object for given position.
std::map< int, Tile > m_mTiles
Stores all the tiles cached by this tile buffer.
This class represents a single tile in the tile buffer.
cairo_surface_t * getBuffer()
Function to get the pointer to enclosing cairo_surface_t.
cairo_surface_t * m_pBuffer
Pixel buffer data for this tile.
void setSurface(cairo_surface_t *)
Used to set the pixel buffer of this object.
constexpr auto toTwips(N number, Length from)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
A struct that we use to store the data about the LOK call.
static void destroy(void *pMemory)
Wrapper around delete to help GLib.
float pixelToTwip(float fInput, float zoom)
Converts the pixel value to zoom independent twip value.
float twipToPixel(float fInput, float zoom)
Converts the zoom independent twip value pixel value.
GQuark LOKTileBufferErrorQuark()
Gets GQuark identifying this tile buffer errors.