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

Unified Diff: fpdfsdk/fpdftext.cpp

Issue 1906903002: Replace CFX_RectArray with std::vector<CFX_FloatRect> (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove unused method Created 4 years, 8 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 | « core/fxcrt/include/fx_coordinates.h ('k') | fpdfsdk/fsdk_mgr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdftext.cpp
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp
index 2a841314224ea704aacc2580ebdd0a8550597c1a..4d521da8ed02397ccd9c73fafb98e1c65a6becea 100644
--- a/fpdfsdk/fpdftext.cpp
+++ b/fpdfsdk/fpdftext.cpp
@@ -13,6 +13,7 @@
#include "core/fpdftext/include/cpdf_textpagefind.h"
#include "fpdfsdk/include/fsdk_define.h"
#include "third_party/base/numerics/safe_conversions.h"
+#include "third_party/base/stl_util.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
@@ -315,10 +316,8 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
if (!link_page || link_index < 0)
return 0;
- CFX_RectArray rects;
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
- pageLink->GetRects(link_index, &rects);
- return rects.GetSize();
+ return pdfium::CollectionSize<int>(pageLink->GetRects(link_index));
}
DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
@@ -331,17 +330,15 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
if (!link_page || link_index < 0 || rect_index < 0)
return;
- CFX_RectArray rectArray;
CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page);
- pageLink->GetRects(link_index, &rectArray);
- if (rect_index >= rectArray.GetSize())
+ std::vector<CFX_FloatRect> rectArray = pageLink->GetRects(link_index);
+ if (rect_index >= pdfium::CollectionSize<int>(rectArray))
return;
- CFX_FloatRect rect = rectArray.GetAt(rect_index);
- *left = rect.left;
- *right = rect.right;
- *top = rect.top;
- *bottom = rect.bottom;
+ *left = rectArray[rect_index].left;
+ *right = rectArray[rect_index].right;
+ *top = rectArray[rect_index].top;
+ *bottom = rectArray[rect_index].bottom;
}
DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) {
« no previous file with comments | « core/fxcrt/include/fx_coordinates.h ('k') | fpdfsdk/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698