summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_dibsource.cpp
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/fpdfapi/render/cpdf_dibsource.cpp
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/fpdfapi/render/cpdf_dibsource.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 153491aa06..b8b91d2fe6 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -764,8 +764,7 @@ void CPDF_DIBSource::LoadPalette() {
}
int palette_count = 1 << (m_bpc * m_nComponents);
- CFX_FixedBufGrow<float, 16> color_values(m_nComponents);
- float* color_value = color_values;
+ std::vector<float> color_value(m_nComponents);
for (int i = 0; i < palette_count; i++) {
int color_data = i;
for (uint32_t j = 0; j < m_nComponents; j++) {
@@ -782,11 +781,11 @@ void CPDF_DIBSource::LoadPalette() {
int nComponents = m_pColorSpace->CountComponents();
std::vector<float> temp_buf(nComponents);
for (int k = 0; k < nComponents; k++) {
- temp_buf[k] = *color_value;
+ temp_buf[k] = color_value[0];
}
m_pColorSpace->GetRGB(temp_buf.data(), &R, &G, &B);
} else {
- m_pColorSpace->GetRGB(color_value, &R, &G, &B);
+ m_pColorSpace->GetRGB(color_value.data(), &R, &G, &B);
}
SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -834,8 +833,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
if (TranslateScanline24bppDefaultDecode(dest_scan, src_scan))
return;
- CFX_FixedBufGrow<float, 16> color_values1(m_nComponents);
- float* color_values = color_values1;
+ std::vector<float> color_values(m_nComponents);
float R = 0.0f;
float G = 0.0f;
float B = 0.0f;
@@ -863,7 +861,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
G = (1.0f - color_values[1]) * k;
B = (1.0f - color_values[2]) * k;
} else if (m_Family != PDFCS_PATTERN) {
- m_pColorSpace->GetRGB(color_values, &R, &G, &B);
+ m_pColorSpace->GetRGB(color_values.data(), &R, &G, &B);
}
R = pdfium::clamp(R, 0.0f, 1.0f);
G = pdfium::clamp(G, 0.0f, 1.0f);