summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-10-10 15:57:36 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-10-10 15:57:36 -0700
commit6cf012af4954807255ce7cdb5b92a20f74d34e6d (patch)
tree79531b6bf797fa962da372f22130998a58133f62
parentd5e822aba72a059b00d7b1415b46ecdae92e7dc0 (diff)
downloadpdfium-6cf012af4954807255ce7cdb5b92a20f74d34e6d.tar.xz
Fix a bug when image width is odd in sycc422_to_rgb
BUG=418881 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/648823002
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpx_opj.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
index 32adb8e3e4..1180bfc102 100644
--- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -167,19 +167,12 @@ static void sycc422_to_rgb(opj_image_t *img)
d1 = g = FX_Alloc(int, (size_t)max);
d2 = b = FX_Alloc(int, (size_t)max);
for(i = 0; i < maxh; ++i) {
- for(j = 0; j < maxw; j += 2) {
+ for (j = 0; j < maxw; ++j, ++y, ++r, ++g, ++b) {
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y;
- ++r;
- ++g;
- ++b;
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y;
- ++r;
- ++g;
- ++b;
- ++cb;
- ++cr;
+ if (j % 2){
+ ++cb;
+ ++cr;
+ }
}
}
FX_Free(img->comps[0].data);