summaryrefslogtreecommitdiff
path: root/core/fxcodec
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2018-05-08 19:13:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-08 19:13:28 +0000
commit5de481e71bcde25d31452b23a017bb783163a204 (patch)
tree69a83cba07d67550f65ba27633ab1ad40e5035ae /core/fxcodec
parent12d61f16381da571c7f435c9c4f9bd51daa57222 (diff)
downloadpdfium-5de481e71bcde25d31452b23a017bb783163a204.tar.xz
Remove almost all usages of CFX_FixedBufGrow with std::vector
Tested by running safetynet_compare.py on this patch vs master. The results were 0 regressions and 0 improvements. The two remaining usages cannot be replaced because they would cause a regression. Bug: pdfium:177 Change-Id: I43eddf4ffaac2eb063f2004d6606bc3cd6e627ac Reviewed-on: https://pdfium-review.googlesource.com/32159 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'core/fxcodec')
-rw-r--r--core/fxcodec/codec/fx_codec_icc.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp
index 29b37d19ac..458816e77e 100644
--- a/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/fxcodec/codec/fx_codec_icc.cpp
@@ -5,10 +5,10 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <memory>
+#include <vector>
#include "core/fxcodec/codec/ccodec_iccmodule.h"
#include "core/fxcodec/codec/codec_int.h"
-#include "core/fxcrt/cfx_fixedbufgrow.h"
namespace {
@@ -124,19 +124,16 @@ void CCodec_IccModule::Translate(CLcmsCmm* pTransform,
uint32_t nSrcComponents = m_nComponents;
uint8_t output[4];
if (pTransform->m_bLab) {
- CFX_FixedBufGrow<double, 16> inputs(nSrcComponents);
- double* input = inputs;
- for (uint32_t i = 0; i < nSrcComponents; ++i)
- input[i] = pSrcValues[i];
- cmsDoTransform(pTransform->m_hTransform, input, output, 1);
+ std::vector<double> input(pSrcValues, pSrcValues + nSrcComponents);
+ cmsDoTransform(pTransform->m_hTransform, input.data(), output, 1);
} else {
- CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents);
- uint8_t* input = inputs;
+ std::vector<uint8_t> input;
+ input.reserve(nSrcComponents);
for (uint32_t i = 0; i < nSrcComponents; ++i) {
- input[i] =
- pdfium::clamp(static_cast<int>(pSrcValues[i] * 255.0f), 0, 255);
+ input.push_back(
+ pdfium::clamp(static_cast<int>(pSrcValues[i] * 255.0f), 0, 255));
}
- cmsDoTransform(pTransform->m_hTransform, input, output, 1);
+ cmsDoTransform(pTransform->m_hTransform, input.data(), output, 1);
}
pDestValues[0] = output[2] / 255.0f;
pDestValues[1] = output[1] / 255.0f;