Use spans in CPDF_TextRenderer.
Change vector parameters to spans. Also give them Chromium-style names.
Change-Id: I3edb4722be98a6a49939042305c9a37a54e312e3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68893
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 68bfc97..bc7622d 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -7,6 +7,7 @@
#include "core/fpdfapi/render/cpdf_textrenderer.h"
#include <algorithm>
+#include <vector>
#include "core/fpdfapi/font/cpdf_font.h"
#include "core/fpdfapi/render/charposlist.h"
@@ -27,8 +28,8 @@
// static
bool CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
- const std::vector<uint32_t>& charCodes,
- const std::vector<float>& charPos,
+ pdfium::span<const uint32_t> char_codes,
+ pdfium::span<const float> char_pos,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix& mtText2User,
@@ -39,7 +40,7 @@
CFX_PathData* pClippingPath,
int nFlag) {
std::vector<TextCharPos> pos =
- GetCharPosList(charCodes, charPos, pFont, font_size);
+ GetCharPosList(char_codes, char_pos, pFont, font_size);
if (pos.empty())
return true;
@@ -108,15 +109,15 @@
// static
bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
- const std::vector<uint32_t>& charCodes,
- const std::vector<float>& charPos,
+ pdfium::span<const uint32_t> char_codes,
+ pdfium::span<const float> char_pos,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix& mtText2Device,
FX_ARGB fill_argb,
const CPDF_RenderOptions& options) {
std::vector<TextCharPos> pos =
- GetCharPosList(charCodes, charPos, pFont, font_size);
+ GetCharPosList(char_codes, char_pos, pFont, font_size);
if (pos.empty())
return true;
diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h
index 91ab4cc..3e78431 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/core/fpdfapi/render/cpdf_textrenderer.h
@@ -7,12 +7,11 @@
#ifndef CORE_FPDFAPI_RENDER_CPDF_TEXTRENDERER_H_
#define CORE_FPDFAPI_RENDER_CPDF_TEXTRENDERER_H_
-#include <vector>
-
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxge/fx_dib.h"
+#include "third_party/base/span.h"
class CFX_RenderDevice;
class CFX_GraphStateData;
@@ -33,8 +32,8 @@
const CPDF_RenderOptions& options);
static bool DrawTextPath(CFX_RenderDevice* pDevice,
- const std::vector<uint32_t>& charCodes,
- const std::vector<float>& charPos,
+ pdfium::span<const uint32_t> char_codes,
+ pdfium::span<const float> char_pos,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix& mtText2User,
@@ -46,8 +45,8 @@
int nFlag);
static bool DrawNormalText(CFX_RenderDevice* pDevice,
- const std::vector<uint32_t>& charCodes,
- const std::vector<float>& charPos,
+ pdfium::span<const uint32_t> char_codes,
+ pdfium::span<const float> char_pos,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix& mtText2Device,