summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-27 21:30:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 21:30:57 +0000
commit74c8b8e6e561b4ff1059441d70f7f1476494dfbb (patch)
tree95ef6ba2458a8c21a71e63841a91a178274495cf /core/fxcodec/codec/fx_codec_progress.cpp
parent82f4f7f01bcac4acae86e179a57ae78cc5691a50 (diff)
downloadpdfium-74c8b8e6e561b4ff1059441d70f7f1476494dfbb.tar.xz
Replace void* with CFX_GifPalette* in fxcodec
The type is known where we need it, and we avoid some dubious casts in the process. Also avoid clumsy indexing and use the members directly in computations. Bug: pdfium:243 Change-Id: I1e061465fd0f9045cf5b82067204f26ac7df53f0 Reviewed-on: https://pdfium-review.googlesource.com/31651 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_progress.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index f2799dcb45..9d25d3f140 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -609,7 +609,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
uint32_t rcd_pos,
const FX_RECT& img_rc,
int32_t pal_num,
- void* pal_ptr,
+ CFX_GifPalette* pal_ptr,
int32_t delay_time,
bool user_input,
int32_t trans_index,
@@ -620,9 +620,9 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
if (!GifReadMoreData(m_pCodecMgr->GetGifModule(), error_status)) {
return false;
}
- uint8_t* pPalette = nullptr;
+ CFX_GifPalette* pPalette = nullptr;
if (pal_num != 0 && pal_ptr) {
- pPalette = (uint8_t*)pal_ptr;
+ pPalette = pal_ptr;
} else {
if (!m_pGifPalette)
return false;
@@ -638,9 +638,8 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
m_SrcPaletteNumber = pal_num;
for (int i = 0; i < pal_num; i++) {
- uint32_t j = i * 3;
m_pSrcPalette[i] =
- ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]);
+ ArgbEncode(0xff, pPalette[i].r, pPalette[i].g, pPalette[i].b);
}
m_GifTransIndex = trans_index;
m_GifFrameRect = img_rc;
@@ -1250,7 +1249,7 @@ bool CCodec_ProgressiveDecoder::GifDetectImageType(CFX_DIBAttribute* pAttribute,
m_SrcComponents = 1;
CFX_GifDecodeStatus readResult = pGifModule->ReadHeader(
m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
- (void**)&m_pGifPalette, &m_GifBgIndex, nullptr);
+ &m_pGifPalette, &m_GifBgIndex, nullptr);
while (readResult == CFX_GifDecodeStatus::Unfinished) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if (!GifReadMoreData(pGifModule, error_status)) {
@@ -1258,9 +1257,9 @@ bool CCodec_ProgressiveDecoder::GifDetectImageType(CFX_DIBAttribute* pAttribute,
m_status = error_status;
return false;
}
- readResult = pGifModule->ReadHeader(
- m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
- (void**)&m_pGifPalette, &m_GifBgIndex, nullptr);
+ readResult = pGifModule->ReadHeader(m_pGifContext.get(), &m_SrcWidth,
+ &m_SrcHeight, &m_GifPltNumber,
+ &m_pGifPalette, &m_GifBgIndex, nullptr);
}
if (readResult == CFX_GifDecodeStatus::Success) {
m_SrcBPC = 8;