Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: fpdfsdk/fpdfdoc.cpp

Issue 2481743004: Add FPDFDest_GetLocationInPage API (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_dest_unittest.cpp ('k') | fpdfsdk/fpdfdoc_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfdoc.cpp
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index 5d113596bc8dcc741998cdfdf4c23b231b6da388..401b3e478bc23ac7d802527bf6c133be316c0825 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfdoc/cpdf_bookmark.h"
#include "core/fpdfdoc/cpdf_bookmarktree.h"
+#include "core/fpdfdoc/cpdf_dest.h"
#include "fpdfsdk/fsdk_define.h"
#include "third_party/base/stl_util.h"
@@ -211,6 +212,32 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
return dest.GetPageIndex(pDoc);
}
+DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST pDict,
+ FPDF_BOOL* hasXVal,
+ FPDF_BOOL* hasYVal,
+ FPDF_BOOL* hasZoomVal,
+ FS_FLOAT* x,
+ FS_FLOAT* y,
+ FS_FLOAT* zoom) {
+ if (!pDict)
+ return false;
+
+ std::unique_ptr<CPDF_Dest> dest(
+ new CPDF_Dest(static_cast<CPDF_Object*>(pDict)));
+
+ // FPDF_BOOL is an int, GetXYZ expects bools.
+ bool bHasX;
+ bool bHasY;
+ bool bHasZoom;
+ if (!dest->GetXYZ(&bHasX, &bHasY, &bHasZoom, x, y, zoom))
+ return false;
+
+ *hasXVal = bHasX;
+ *hasYVal = bHasY;
+ *hasZoomVal = bHasZoom;
+ return true;
+}
+
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x,
double y) {
« no previous file with comments | « core/fpdfdoc/cpdf_dest_unittest.cpp ('k') | fpdfsdk/fpdfdoc_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698