summaryrefslogtreecommitdiff
path: root/core/fxcodec
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-11 16:12:14 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-11 20:30:16 +0000
commit4588792ebfcfdd628b76f005fa0e1d7935739139 (patch)
tree68dabe2985ab44e0f3e5e1c1f6054e452eb9662a /core/fxcodec
parente420d9c1d2ef35c862bf149ae37e6e59287c30b5 (diff)
downloadpdfium-4588792ebfcfdd628b76f005fa0e1d7935739139.tar.xz
Address nits missed from original reviewchromium/3213
BUG=chromium:761005 Change-Id: I538e49f1eeb32891b33677d8587d2bed110b1fc1 Reviewed-on: https://pdfium-review.googlesource.com/13692 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec')
-rw-r--r--core/fxcodec/codec/fx_codec_jpx_opj.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
index b421e8fb2d..21d971bc8c 100644
--- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -510,8 +510,9 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf,
return false;
if (pitch<static_cast<int>(m_Image->comps[0].w * 8 * m_Image->numcomps + 31)>>
- 5 << 2)
+ 5 << 2) {
return false;
+ }
if (!m_Parameters.nb_tile_to_decode) {
if (!opj_set_decode_area(m_Codec, m_Image, m_Parameters.DA_x0,
@@ -527,11 +528,9 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf,
m_Image = nullptr;
return false;
}
- } else {
- if (!opj_get_decoded_tile(m_Codec, m_Stream, m_Image,
- m_Parameters.tile_index)) {
- return false;
- }
+ } else if (!opj_get_decoded_tile(m_Codec, m_Stream, m_Image,
+ m_Parameters.tile_index)) {
+ return false;
}
opj_stream_destroy(m_Stream);
@@ -609,11 +608,7 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf,
} else {
int tmpPixel = (src >> adjust_comps[channel]) +
((src >> (adjust_comps[channel] - 1)) % 2);
- if (tmpPixel > 255) {
- tmpPixel = 255;
- } else if (tmpPixel < 0) {
- tmpPixel = 0;
- }
+ tmpPixel = pdfium::clamp(tmpPixel, 0, 255);
*pPixel = static_cast<uint8_t>(tmpPixel);
}
}