summaryrefslogtreecommitdiff
path: root/libreofficekit/source
diff options
context:
space:
mode:
authorPranav Kant <pranavk@gnome.org>2015-06-08 15:24:12 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-09 10:44:24 +0200
commit2afe94dbfc85cbcde1399267379a466d527998a4 (patch)
treea02c8eddaf63d2ae04de674adbb36ee4e39a9861 /libreofficekit/source
parent16222190ec4cf6b83e7771a8d714a7dbb968c42b (diff)
tilebuffer: tileSize as member variable is superfluous
Change-Id: I1eae8c96c12ba4d272341f45fee6c1fd66ab9e28
Diffstat (limited to 'libreofficekit/source')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx4
-rw-r--r--libreofficekit/source/gtk/tilebuffer.cxx12
-rw-r--r--libreofficekit/source/gtk/tilebuffer.hxx7
3 files changed, 9 insertions, 14 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 64955f76c4e7..5f768e74a400 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -274,7 +274,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo
LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
: m_pDocView(pDocView),
m_pDrawingArea(gtk_drawing_area_new()),
- m_aTileBuffer(TileBuffer(0,0,0,0)),
+ m_aTileBuffer(TileBuffer(0,0,0)),
m_fZoom(1),
m_pOffice(0),
m_pDocument(0),
@@ -1236,7 +1236,6 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView,
pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
- nTileSizePixels,
nRows,
nColumns);
gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
@@ -1263,7 +1262,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ
guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
- nTileSizePixels,
nRows,
nColumns);
gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 774806bc414d..1d6a8b66ec80 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -79,7 +79,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid)
{
- GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize);
+ GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
if (!pPixBuf)
{
g_info ("Error allocating memory to pixbuf");
@@ -88,16 +88,16 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
GdkRectangle aTileRectangle;
- aTileRectangle.x = pixelToTwip(m_nTileSize, aZoom) * y;
- aTileRectangle.y = pixelToTwip(m_nTileSize, aZoom) * x;
+ aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y;
+ aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x;
g_info ("Rendering (%d, %d)", x, y);
m_pLOKDocument->pClass->paintTile(m_pLOKDocument,
pBuffer,
- m_nTileSize, m_nTileSize,
+ nTileSizePixels, nTileSizePixels,
aTileRectangle.x, aTileRectangle.y,
- pixelToTwip(m_nTileSize, aZoom),
- pixelToTwip(m_nTileSize, aZoom));
+ pixelToTwip(nTileSizePixels, aZoom),
+ pixelToTwip(nTileSizePixels, aZoom));
//create a mapping for it
m_mTiles[index].setPixbuf(pPixBuf);
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index 59660042f544..ea8e52452c8d 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -83,11 +83,9 @@ class TileBuffer
{
public:
TileBuffer(LibreOfficeKitDocument *document,
- int tileSize,
int rows,
int columns)
: m_pLOKDocument(document)
- , m_nTileSize(tileSize)
, m_nWidth(columns)
, m_nHeight(rows)
{ }
@@ -104,10 +102,11 @@ class TileBuffer
@param x the tile along the x-axis of the buffer
@param y the tile along the y-axis of the buffer
+ @param aZoom This function needs the zoom factor to draw the tile using paintTile()
@return the tile at the mentioned position (x, y)
*/
- Tile& getTile(int x, int y);
+ Tile& getTile(int x, int y, float aZoom);
/// Destroys all the tiles in the tile buffer; also frees the memory allocated
/// for all the Tile objects.
void resetAllTiles();
@@ -123,8 +122,6 @@ class TileBuffer
private:
/// Contains the reference to the LOK Document that this tile buffer is for.
LibreOfficeKitDocument *m_pLOKDocument;
- /// The side of each squared tile in pixels.
- int m_nTileSize;
/// Stores all the tiles cached by this tile buffer.
std::map<int, Tile> m_mTiles;
/// Width of the current tile buffer (number of columns)