summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2018-06-13 18:54:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-13 18:54:06 +0000
commitae7bcb7c9ec3a617a464697845968401391f74c9 (patch)
tree544a27722eaac7371e5258862897f20cafa71ea2
parent437e5e4f03ea190c195c35a6cfdefef03cb50d10 (diff)
downloadpdfium-ae7bcb7c9ec3a617a464697845968401391f74c9.tar.xz
Remove CFX_FixedBufGrow from fx_codec_icc.cpp
Bug: pdfium:177 Change-Id: Ib4de4f258ebd98a53b309c30b7e4aa28f0c581eb Reviewed-on: https://pdfium-review.googlesource.com/35112 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fxcodec/codec/fx_codec_icc.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp
index 29b37d19ac..bd98a6efab 100644
--- a/core/fxcodec/codec/fx_codec_icc.cpp
+++ b/core/fxcodec/codec/fx_codec_icc.cpp
@@ -4,11 +4,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
#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 {
@@ -123,20 +124,21 @@ void CCodec_IccModule::Translate(CLcmsCmm* pTransform,
uint32_t nSrcComponents = m_nComponents;
uint8_t output[4];
+ // TODO(npm): Currently the CmsDoTransform method is part of LCMS and it will
+ // apply some member of m_hTransform to the input. We need to go over all the
+ // places which set transform to verify that only nSrcComponents are used.
if (pTransform->m_bLab) {
- CFX_FixedBufGrow<double, 16> inputs(nSrcComponents);
- double* input = inputs;
+ std::vector<double> inputs(std::max(nSrcComponents, 16u));
for (uint32_t i = 0; i < nSrcComponents; ++i)
- input[i] = pSrcValues[i];
- cmsDoTransform(pTransform->m_hTransform, input, output, 1);
+ inputs[i] = pSrcValues[i];
+ cmsDoTransform(pTransform->m_hTransform, inputs.data(), output, 1);
} else {
- CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents);
- uint8_t* input = inputs;
+ std::vector<uint8_t> inputs(std::max(nSrcComponents, 16u));
for (uint32_t i = 0; i < nSrcComponents; ++i) {
- input[i] =
+ inputs[i] =
pdfium::clamp(static_cast<int>(pSrcValues[i] * 255.0f), 0, 255);
}
- cmsDoTransform(pTransform->m_hTransform, input, output, 1);
+ cmsDoTransform(pTransform->m_hTransform, inputs.data(), output, 1);
}
pDestValues[0] = output[2] / 255.0f;
pDestValues[1] = output[1] / 255.0f;