summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-06-19 11:36:42 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-19 16:19:54 +0000
commitbc29701214bf96bfacbef04b345bee76fd7bce84 (patch)
treecaa404141f9e13200b380294f9ba5efccc149862 /core/fxcodec/codec/fx_codec_progress.cpp
parentc533f4b7390afc3b372c0184d274053039ac264d (diff)
downloadpdfium-bc29701214bf96bfacbef04b345bee76fd7bce84.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_progress.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp12
1 files changed, 8 insertions, 4 deletions
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 <algorithm>
#include <memory>
+#include <vector>
#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<uint8_t>& row_buf) {
CFX_RetainPtr<CFX_DIBitmap> 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<uint32_t>(src_top)) ||
+ src_bottom < 0 || row_num >= static_cast<uint32_t>(src_bottom)) {
return;
+ }
double scale_y = (double)des_hei / (double)src_hei;
int src_row = row_num - src_top;