summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
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;