Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: core/src/fxcodec/codec/fx_codec_progress.cpp

Issue 1411683005: XFA: Remove null CFX_DIBAttribute default argument (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Sort classes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_dib.h" 7 #include "../../../include/fxge/fx_dib.h"
8 #include "../../../include/fxcodec/fx_codec.h" 8 #include "../../../include/fxcodec/fx_codec.h"
9 #include "fx_codec_progress.h" 9 #include "fx_codec_progress.h"
10 void CFXCODEC_WeightTable::Calc(int dest_len, 10 void CFXCODEC_WeightTable::Calc(int dest_len,
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 if (pCodec->m_pSrcPalette == NULL) { 634 if (pCodec->m_pSrcPalette == NULL) {
635 pCodec->m_pSrcPalette = FX_Alloc(FX_ARGB, pal_num); 635 pCodec->m_pSrcPalette = FX_Alloc(FX_ARGB, pal_num);
636 } else if (pal_num > pCodec->m_SrcPaletteNumber) { 636 } else if (pal_num > pCodec->m_SrcPaletteNumber) {
637 pCodec->m_pSrcPalette = FX_Realloc(FX_ARGB, pCodec->m_pSrcPalette, pal_num); 637 pCodec->m_pSrcPalette = FX_Realloc(FX_ARGB, pCodec->m_pSrcPalette, pal_num);
638 } 638 }
639 if (pCodec->m_pSrcPalette == NULL) { 639 if (pCodec->m_pSrcPalette == NULL) {
640 return FALSE; 640 return FALSE;
641 } 641 }
642 pCodec->m_SrcPaletteNumber = pal_num; 642 pCodec->m_SrcPaletteNumber = pal_num;
643 for (int i = 0; i < pal_num; i++) { 643 for (int i = 0; i < pal_num; i++) {
644 register FX_DWORD j = i * 3; 644 FX_DWORD j = i * 3;
645 pCodec->m_pSrcPalette[i] = 645 pCodec->m_pSrcPalette[i] =
646 ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]); 646 ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]);
647 } 647 }
648 pCodec->m_GifTransIndex = trans_index; 648 pCodec->m_GifTransIndex = trans_index;
649 pCodec->m_GifFrameRect = img_rc; 649 pCodec->m_GifFrameRect = img_rc;
650 pCodec->m_SrcPassNumber = interlace ? 4 : 1; 650 pCodec->m_SrcPassNumber = interlace ? 4 : 1;
651 int32_t pal_index = pCodec->m_GifBgIndex; 651 int32_t pal_index = pCodec->m_GifBgIndex;
652 CFX_DIBitmap* pDevice = pCodec->m_pDeviceBitmap; 652 CFX_DIBitmap* pDevice = pCodec->m_pDeviceBitmap;
653 if (trans_index >= pal_num) { 653 if (trans_index >= pal_num) {
654 trans_index = -1; 654 trans_index = -1;
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size); 1208 FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, 0, size);
1209 if (!bResult) { 1209 if (!bResult) {
1210 m_status = FXCODEC_STATUS_ERR_READ; 1210 m_status = FXCODEC_STATUS_ERR_READ;
1211 return FALSE; 1211 return FALSE;
1212 } 1212 }
1213 m_offSet += size; 1213 m_offSet += size;
1214 pGifModule->Input(m_pGifContext, m_pSrcBuf, size); 1214 pGifModule->Input(m_pGifContext, m_pSrcBuf, size);
1215 m_SrcComponents = 1; 1215 m_SrcComponents = 1;
1216 int32_t readResult = pGifModule->ReadHeader( 1216 int32_t readResult = pGifModule->ReadHeader(
1217 m_pGifContext, &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber, 1217 m_pGifContext, &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
1218 (void**)&m_pGifPalette, &m_GifBgIndex); 1218 (void**)&m_pGifPalette, &m_GifBgIndex, nullptr);
1219 while (readResult == 2) { 1219 while (readResult == 2) {
1220 FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT; 1220 FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
1221 if (!GifReadMoreData(pGifModule, error_status)) { 1221 if (!GifReadMoreData(pGifModule, error_status)) {
1222 m_status = error_status; 1222 m_status = error_status;
1223 return FALSE; 1223 return FALSE;
1224 } 1224 }
1225 readResult = pGifModule->ReadHeader( 1225 readResult = pGifModule->ReadHeader(
1226 m_pGifContext, &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber, 1226 m_pGifContext, &m_SrcWidth, &m_SrcHeight, &m_GifPltNumber,
1227 (void**)&m_pGifPalette, &m_GifBgIndex); 1227 (void**)&m_pGifPalette, &m_GifBgIndex, nullptr);
1228 } 1228 }
1229 if (readResult == 1) { 1229 if (readResult == 1) {
1230 m_SrcBPC = 8; 1230 m_SrcBPC = 8;
1231 m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight); 1231 m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight);
1232 return TRUE; 1232 return TRUE;
1233 } 1233 }
1234 if (m_pGifContext != NULL) { 1234 if (m_pGifContext != NULL) {
1235 pGifModule->Finish(m_pGifContext); 1235 pGifModule->Finish(m_pGifContext);
1236 m_pGifContext = NULL; 1236 m_pGifContext = NULL;
1237 } 1237 }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 FXSYS_memset(m_pSrcBuf, 0, input_size); 2136 FXSYS_memset(m_pSrcBuf, 0, input_size);
2137 m_SrcSize = input_size; 2137 m_SrcSize = input_size;
2138 } 2138 }
2139 FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size); 2139 FX_BOOL bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size);
2140 if (!bResult) { 2140 if (!bResult) {
2141 m_pDeviceBitmap = NULL; 2141 m_pDeviceBitmap = NULL;
2142 m_pFile = NULL; 2142 m_pFile = NULL;
2143 return m_status = FXCODEC_STATUS_ERR_READ; 2143 return m_status = FXCODEC_STATUS_ERR_READ;
2144 } 2144 }
2145 m_offSet += input_size; 2145 m_offSet += input_size;
2146 bResult = pPngModule->Input(m_pPngContext, m_pSrcBuf, input_size); 2146 bResult =
2147 pPngModule->Input(m_pPngContext, m_pSrcBuf, input_size, nullptr);
2147 if (!bResult) { 2148 if (!bResult) {
2148 m_pDeviceBitmap = NULL; 2149 m_pDeviceBitmap = NULL;
2149 m_pFile = NULL; 2150 m_pFile = NULL;
2150 return m_status = FXCODEC_STATUS_ERROR; 2151 return m_status = FXCODEC_STATUS_ERROR;
2151 } 2152 }
2152 if (pPause && pPause->NeedToPauseNow()) { 2153 if (pPause && pPause->NeedToPauseNow()) {
2153 return m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE; 2154 return m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
2154 } 2155 }
2155 } 2156 }
2156 } break; 2157 } break;
2157 case FXCODEC_IMAGE_GIF: { 2158 case FXCODEC_IMAGE_GIF: {
2158 ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule(); 2159 ICodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
2159 while (TRUE) { 2160 while (TRUE) {
2160 int32_t readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur); 2161 int32_t readRes =
2162 pGifModule->LoadFrame(m_pGifContext, m_FrameCur, nullptr);
2161 while (readRes == 2) { 2163 while (readRes == 2) {
2162 FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH; 2164 FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
2163 if (!GifReadMoreData(pGifModule, error_status)) { 2165 if (!GifReadMoreData(pGifModule, error_status)) {
2164 m_pDeviceBitmap = NULL; 2166 m_pDeviceBitmap = NULL;
2165 m_pFile = NULL; 2167 m_pFile = NULL;
2166 return m_status = error_status; 2168 return m_status = error_status;
2167 } 2169 }
2168 if (pPause && pPause->NeedToPauseNow()) { 2170 if (pPause && pPause->NeedToPauseNow()) {
2169 return m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE; 2171 return m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
2170 } 2172 }
2171 readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur); 2173 readRes = pGifModule->LoadFrame(m_pGifContext, m_FrameCur, nullptr);
2172 } 2174 }
2173 if (readRes == 1) { 2175 if (readRes == 1) {
2174 m_pDeviceBitmap = NULL; 2176 m_pDeviceBitmap = NULL;
2175 m_pFile = NULL; 2177 m_pFile = NULL;
2176 return m_status = FXCODEC_STATUS_DECODE_FINISH; 2178 return m_status = FXCODEC_STATUS_DECODE_FINISH;
2177 } 2179 }
2178 m_pDeviceBitmap = NULL; 2180 m_pDeviceBitmap = NULL;
2179 m_pFile = NULL; 2181 m_pFile = NULL;
2180 return m_status = FXCODEC_STATUS_ERROR; 2182 return m_status = FXCODEC_STATUS_ERROR;
2181 } 2183 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 } 2345 }
2344 } break; 2346 } break;
2345 default: 2347 default:
2346 break; 2348 break;
2347 } 2349 }
2348 return FXCODEC_STATUS_ERROR; 2350 return FXCODEC_STATUS_ERROR;
2349 } 2351 }
2350 ICodec_ProgressiveDecoder* CCodec_ModuleMgr::CreateProgressiveDecoder() { 2352 ICodec_ProgressiveDecoder* CCodec_ModuleMgr::CreateProgressiveDecoder() {
2351 return new CCodec_ProgressiveDecoder(this); 2353 return new CCodec_ProgressiveDecoder(this);
2352 } 2354 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_progress.h ('k') | xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698