From bc29701214bf96bfacbef04b345bee76fd7bce84 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Mon, 19 Jun 2017 11:36:42 -0400 Subject: Make out_row_buffer an std::vector The out_row_buffer of BMPDecompressor is made a vector. This forces the class to have constructor/destructor. Some other members were changed to be of size_t instead of int32_t. Change-Id: I3f70b0322dcee2ddf9a00da7962b43f3415ba545 Reviewed-on: https://pdfium-review.googlesource.com/6691 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxcodec/codec/fx_codec_progress.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core/fxcodec/codec/fx_codec_progress.cpp') diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 5ec7d661f5..3c377771ea 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "core/fxcodec/fx_codec.h" #include "core/fxge/dib/cfx_dibitmap.h" @@ -878,18 +879,21 @@ bool CCodec_ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) { return BmpReadMoreData(m_pCodecMgr->GetBmpModule(), error_status); } -void CCodec_ProgressiveDecoder::BmpReadScanline(int32_t row_num, - uint8_t* row_buf) { +void CCodec_ProgressiveDecoder::BmpReadScanline( + uint32_t row_num, + const std::vector& row_buf) { CFX_RetainPtr pDIBitmap = m_pDeviceBitmap; ASSERT(pDIBitmap); - memcpy(m_pDecodeBuf, row_buf, m_ScanlineSize); + std::copy(row_buf.begin(), row_buf.begin() + m_ScanlineSize, m_pDecodeBuf); int src_top = m_clipBox.top; int src_bottom = m_clipBox.bottom; int des_top = m_startY; int src_hei = m_clipBox.Height(); int des_hei = m_sizeY; - if (row_num < src_top || row_num >= src_bottom) + if ((src_top >= 0 && row_num < static_cast(src_top)) || + src_bottom < 0 || row_num >= static_cast(src_bottom)) { return; + } double scale_y = (double)des_hei / (double)src_hei; int src_row = row_num - src_top; -- cgit v1.2.3