Kaydet (Commit) a5d3efa4 authored tarafından Pranav Kant's avatar Pranav Kant Kaydeden (comit) Miklos Vajna

lokdocview: move commonly used functions and variables to common header

twipToPixel and pixelToTwip are also being used by the new TileBuffer
clsas. Lets move these utility functions to a common header,
tilebuffer.hxx

The variables for DPI and tileSize are also moved to tilebuffer.hxx

Change-Id: I9d0bec7f2aefe412df232040a7a9abc6db3e4ccb
üst 82a208a0
......@@ -9,14 +9,12 @@
#include "tilebuffer.hxx"
static const int DPI = 96;
static float pixelToTwip(float fInput, float zoom)
float pixelToTwip(float fInput, float zoom)
{
return (fInput / DPI / zoom) * 1440.0f;
}
static float twipToPixel(float fInput, float zoom)
float twipToPixel(float fInput, float zoom)
{
return fInput / 1440.0f * DPI * zoom;
}
......
......@@ -19,6 +19,15 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
// We know that VirtualDevices use a DPI of 96.
const int DPI = 96;
// Lets use a square of side 256 pixels for each tile.
const int nTileSizePixels = 256;
float pixelToTwip(float fInput, float zoom);
float twipToPixel(float fInput, float zoom);
/*
This class represents a single tile in the tile buffer.
TODO: Extend it to support features like double buffering
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment