summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-09 07:01:36 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-09 07:01:36 -0800
commit0fa471794a88b262f9114b973d74b1c33e4e592b (patch)
tree0922c56f6e8ba029cd59dc85c8e2c05689cc334a /core/fpdfapi/render
parent5037839bb0b91792b81a3e455dead1314fcc7a6d (diff)
downloadpdfium-0fa471794a88b262f9114b973d74b1c33e4e592b.tar.xz
Remove CFX_ArrayTemplate from fpdfapi
Review-Url: https://codereview.chromium.org/2611413002
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.cpp26
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.h8
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp15
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.h3
4 files changed, 26 insertions, 26 deletions
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index 2efdb81f8a..d74f729858 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -44,12 +44,12 @@ void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
void CPDF_RenderContext::AppendLayer(CPDF_PageObjectHolder* pObjectHolder,
const CFX_Matrix* pObject2Device) {
- Layer* pLayer = m_Layers.AddSpace();
- pLayer->m_pObjectHolder = pObjectHolder;
+ m_Layers.emplace_back();
+ m_Layers.back().m_pObjectHolder = pObjectHolder;
if (pObject2Device)
- pLayer->m_Matrix = *pObject2Device;
+ m_Layers.back().m_Matrix = *pObject2Device;
else
- pLayer->m_Matrix.SetIdentity();
+ m_Layers.back().m_Matrix.SetIdentity();
}
void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
@@ -62,18 +62,16 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
const CPDF_PageObject* pStopObj,
const CPDF_RenderOptions* pOptions,
const CFX_Matrix* pLastMatrix) {
- int count = m_Layers.GetSize();
- for (int j = 0; j < count; j++) {
+ for (auto& layer : m_Layers) {
pDevice->SaveState();
- Layer* pLayer = m_Layers.GetDataPtr(j);
if (pLastMatrix) {
- CFX_Matrix FinalMatrix = pLayer->m_Matrix;
+ CFX_Matrix FinalMatrix = layer.m_Matrix;
FinalMatrix.Concat(*pLastMatrix);
CPDF_RenderStatus status;
status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr,
- pOptions, pLayer->m_pObjectHolder->m_Transparency,
- false, nullptr);
- status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix);
+ pOptions, layer.m_pObjectHolder->m_Transparency, false,
+ nullptr);
+ status.RenderObjectList(layer.m_pObjectHolder, &FinalMatrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE)
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
if (status.m_bStopped) {
@@ -83,9 +81,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
} else {
CPDF_RenderStatus status;
status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr,
- pOptions, pLayer->m_pObjectHolder->m_Transparency,
- false, nullptr);
- status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix);
+ pOptions, layer.m_pObjectHolder->m_Transparency, false,
+ nullptr);
+ status.RenderObjectList(layer.m_pObjectHolder, &layer.m_Matrix);
if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE)
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
if (status.m_bStopped) {
diff --git a/core/fpdfapi/render/cpdf_rendercontext.h b/core/fpdfapi/render/cpdf_rendercontext.h
index 676b89a4f4..a9fd2db78b 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.h
+++ b/core/fpdfapi/render/cpdf_rendercontext.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
#define CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_coordinates.h"
@@ -50,8 +52,8 @@ class CPDF_RenderContext {
const CPDF_RenderOptions* pOptions,
CFX_Matrix* pFinalMatrix);
- uint32_t CountLayers() const { return m_Layers.GetSize(); }
- Layer* GetLayer(uint32_t index) { return m_Layers.GetDataPtr(index); }
+ size_t CountLayers() const { return m_Layers.size(); }
+ Layer* GetLayer(uint32_t index) { return &m_Layers[index]; }
CPDF_Document* GetDocument() const { return m_pDocument; }
CPDF_Dictionary* GetPageResources() const { return m_pPageResources; }
@@ -61,7 +63,7 @@ class CPDF_RenderContext {
CPDF_Document* const m_pDocument;
CPDF_Dictionary* m_pPageResources;
CPDF_PageRenderCache* m_pPageCache;
- CFX_ArrayTemplate<Layer> m_Layers;
+ std::vector<Layer> m_Layers;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_RENDERCONTEXT_H_
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 01026f44a9..35d061616b 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -55,6 +55,7 @@
#include "core/fxge/ifx_renderdevicedriver.h"
#include "third_party/base/numerics/safe_math.h"
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#ifdef _SKIA_SUPPORT_
#include "core/fxge/skia/fx_skia_device.h"
@@ -1782,10 +1783,8 @@ CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) {
bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device) {
CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font();
- for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) {
- if (m_Type3FontCache.GetAt(i) == pType3Font)
- return true;
- }
+ if (pdfium::ContainsValue(m_Type3FontCache, pType3Font))
+ return true;
CFX_Matrix dCTM = m_pDevice->GetCTM();
FX_FLOAT sa = FXSYS_fabs(dCTM.a);
@@ -1851,8 +1850,8 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
pStates, &Options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
pFormResource, false, pType3Char, fill_argb);
- status.m_Type3FontCache.Append(m_Type3FontCache);
- status.m_Type3FontCache.Add(pType3Font);
+ status.m_Type3FontCache = m_Type3FontCache;
+ status.m_Type3FontCache.push_back(pType3Font);
m_pDevice->SaveState();
status.RenderObjectList(pType3Char->m_pForm.get(), &matrix);
m_pDevice->RestoreState(false);
@@ -1872,8 +1871,8 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
pStates, &Options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
pFormResource, false, pType3Char, fill_argb);
- status.m_Type3FontCache.Append(m_Type3FontCache);
- status.m_Type3FontCache.Add(pType3Font);
+ status.m_Type3FontCache = m_Type3FontCache;
+ status.m_Type3FontCache.push_back(pType3Font);
matrix.TranslateI(-rect.left, -rect.top);
matrix.Scale(sa, sd);
status.RenderObjectList(pType3Char->m_pForm.get(), &matrix);
diff --git a/core/fpdfapi/render/cpdf_renderstatus.h b/core/fpdfapi/render/cpdf_renderstatus.h
index abc8458d9e..25ddfb06c3 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.h
+++ b/core/fpdfapi/render/cpdf_renderstatus.h
@@ -8,6 +8,7 @@
#define CORE_FPDFAPI_RENDER_CPDF_RENDERSTATUS_H_
#include <memory>
+#include <vector>
#include "core/fpdfapi/page/cpdf_clippath.h"
#include "core/fpdfapi/page/cpdf_graphicstates.h"
@@ -69,7 +70,7 @@ class CPDF_RenderStatus {
CPDF_RenderOptions m_Options;
CPDF_Dictionary* m_pFormResource;
CPDF_Dictionary* m_pPageResource;
- CFX_ArrayTemplate<CPDF_Type3Font*> m_Type3FontCache;
+ std::vector<CPDF_Type3Font*> m_Type3FontCache;
private:
friend class CPDF_ImageRenderer;