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

Unified Diff: fpdfsdk/fpdfdoc.cpp

Issue 1960193003: pdfium_test: print out some annotations Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 2016-05-13 (Friday) 16:05:57 EDT Created 4 years, 7 months 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 | « no previous file | public/fpdf_doc.h » ('j') | public/fpdf_doc.h » ('J')
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 7473cb06711dce26a731c5e17bf492862e1ad4e2..aae2efe1156de552a52c3e4698968d930e060f84 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -11,6 +11,8 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "third_party/base/stl_util.h"
@@ -218,6 +220,34 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
return dest.GetPageIndex(pDoc);
}
+DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST pDict,
+ FS_FLOAT* x,
+ FS_FLOAT* y) {
+ if (!pDict || !x || !y)
+ return FALSE;
dsinclair 2016/05/16 13:56:44 nit: blank line after non-{}'d statement.
hal.canary 2016/05/21 00:40:25 Done.
+ CPDF_Array* dest = static_cast<CPDF_Array*>(pDict);
+ if (dest->GetCount() < 4) {
+ return FALSE;
+ }
dsinclair 2016/05/16 13:56:44 nit: no {}'s on single line bodies (and below)
hal.canary 2016/05/21 00:40:25 Done.
+ const CPDF_Object* xyz = dest->GetDirectObjectAt(1);
+ if (!xyz->IsName() || xyz->AsName()->GetString() != "XYZ") {
+ return FALSE;
+ }
+ const CPDF_Object* objX = dest->GetDirectObjectAt(2);
+ const CPDF_Object* objY = dest->GetDirectObjectAt(3);
+ if (!objX || !objX->IsNumber() || !objY || !objY->IsNumber()) {
+ return FALSE;
+ }
dsinclair 2016/05/16 13:56:44 const CPDF_Number* objX = ToNumber(dest->GetDirect
hal.canary 2016/05/21 00:40:25 Done.
+ const CPDF_Number* numX = objX->AsNumber();
+ const CPDF_Number* numY = objY->AsNumber();
+ if (!numX || !numY) {
+ return FALSE;
+ }
+ *x = numX->GetNumber();
+ *y = numY->GetNumber();
+ return TRUE;
+}
+
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x,
double y) {
« no previous file with comments | « no previous file | public/fpdf_doc.h » ('j') | public/fpdf_doc.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698