[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - include/LibreOfficeKit libreofficekit/qa libreofficekit/source
Pranav Kant
pranavk at gnome.org
Mon Jun 8 23:39:58 PDT 2015
include/LibreOfficeKit/LibreOfficeKitGtk.h | 6 ------
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 18 ++++++++++--------
libreofficekit/source/gtk/lokdocview.cxx | 10 ----------
3 files changed, 10 insertions(+), 24 deletions(-)
New commits:
commit 28079d5bda1532325690040dea412f62f894aba3
Author: Pranav Kant <pranavk at gnome.org>
Date: Tue Jun 9 02:47:29 2015 +0530
lokdocview: move the pixelToTwip function
Change-Id: I91c83e3d64d68fa6e92fb5ffb44bb881cdfb5562
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 861dbd3..f4bc113 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -80,12 +80,6 @@ void lok_doc_view_post_key (GtkWidget* p
GdkEventKey* pEvent,
gpointer pData);
-float lok_doc_view_pixel_to_twip (LOKDocView* pDocView,
- float fInput);
-
-float lok_doc_view_twip_to_pixel (LOKDocView* pDocView,
- float fInput);
-
G_END_DECLS
#endif // INCLUDED_LIBREOFFICEKIT_LIBREOFFICEKITGTK_H
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 37cd16f..3a308df 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -55,6 +55,11 @@ GtkWidget* pFindbarLabel;
static LibreOfficeKit* pOffice;
+static float pixelToTwip(float fInput, float zoom)
+{
+ return (fInput / 96 / zoom) * 1440.0f;
+}
+
static void lcl_registerToolItem(GtkToolItem* pItem, const std::string& rName)
{
g_aToolItemCommandNames[pItem] = rName;
@@ -153,15 +158,12 @@ static void getVisibleAreaTwips(GdkRectangle* pArea)
{
GtkAdjustment* pHAdjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
GtkAdjustment* pVAdjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(pScrolledWindow));
+ float zoom = lok_doc_view_get_zoom(LOK_DOC_VIEW(pDocView));
- pArea->x = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
- gtk_adjustment_get_value(pHAdjustment));
- pArea->y = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
- gtk_adjustment_get_value(pVAdjustment));
- pArea->width = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
- gtk_adjustment_get_page_size(pHAdjustment));
- pArea->height = lok_doc_view_pixel_to_twip(LOK_DOC_VIEW(pDocView),
- gtk_adjustment_get_page_size(pVAdjustment));
+ pArea->x = pixelToTwip(gtk_adjustment_get_value(pHAdjustment), zoom);
+ pArea->y = pixelToTwip(gtk_adjustment_get_value(pVAdjustment), zoom);
+ pArea->width = pixelToTwip(gtk_adjustment_get_page_size(pHAdjustment), zoom);
+ pArea->height = pixelToTwip(gtk_adjustment_get_page_size(pVAdjustment), zoom);
}
/// Searches for the next or previous text of pFindbarEntry.
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0ea5970..4ba2841 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1319,14 +1319,4 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_post_key(GtkWidget* /*pWidget*/, GdkEvent
pDocView->m_pImpl->signalKey(pEvent);
}
-SAL_DLLPUBLIC_EXPORT float lok_doc_view_pixel_to_twip(LOKDocView* pDocView, float fInput)
-{
- return (fInput / DPI / pDocView->m_pImpl->m_fZoom) * 1440.0f;
-}
-
-SAL_DLLPUBLIC_EXPORT float lok_doc_view_twip_to_pixel(LOKDocView* pDocView, float fInput)
-{
- return fInput / 1440.0f * DPI * pDocView->m_pImpl->m_fZoom;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list