| OLD | NEW |
| 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 "core/fxcodec/codec/include/ccodec_progressivedecoder.h" | 7 #include "core/fxcodec/codec/include/ccodec_progressivedecoder.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 return m_status; | 1315 return m_status; |
| 1316 } | 1316 } |
| 1317 m_pFile = pFile; | 1317 m_pFile = pFile; |
| 1318 m_offSet = 0; | 1318 m_offSet = 0; |
| 1319 m_SrcWidth = m_SrcHeight = 0; | 1319 m_SrcWidth = m_SrcHeight = 0; |
| 1320 m_SrcComponents = m_SrcBPC = 0; | 1320 m_SrcComponents = m_SrcBPC = 0; |
| 1321 m_clipBox = FX_RECT(0, 0, 0, 0); | 1321 m_clipBox = FX_RECT(0, 0, 0, 0); |
| 1322 m_startX = m_startY = 0; | 1322 m_startX = m_startY = 0; |
| 1323 m_sizeX = m_sizeY = 0; | 1323 m_sizeX = m_sizeY = 0; |
| 1324 m_SrcPassNumber = 0; | 1324 m_SrcPassNumber = 0; |
| 1325 if (bSkipImageTypeCheck || (imageType != FXCODEC_IMAGE_UNKNOWN && | 1325 if (imageType != FXCODEC_IMAGE_UNKNOWN && |
| 1326 DetectImageType(imageType, pAttribute))) { | 1326 DetectImageType(imageType, pAttribute)) { |
| 1327 m_imagType = imageType; | 1327 m_imagType = imageType; |
| 1328 m_status = FXCODEC_STATUS_FRAME_READY; | 1328 m_status = FXCODEC_STATUS_FRAME_READY; |
| 1329 return m_status; | 1329 return m_status; |
| 1330 } | 1330 } |
| 1331 // If we got here then the image data does not match the requested decoder. |
| 1332 // If we're skipping the type check then bail out at this point and return |
| 1333 // the failed status. |
| 1334 if (bSkipImageTypeCheck) |
| 1335 return m_status; |
| 1336 |
| 1331 for (int type = FXCODEC_IMAGE_BMP; type < FXCODEC_IMAGE_MAX; type++) { | 1337 for (int type = FXCODEC_IMAGE_BMP; type < FXCODEC_IMAGE_MAX; type++) { |
| 1332 if (DetectImageType((FXCODEC_IMAGE_TYPE)type, pAttribute)) { | 1338 if (DetectImageType((FXCODEC_IMAGE_TYPE)type, pAttribute)) { |
| 1333 m_imagType = (FXCODEC_IMAGE_TYPE)type; | 1339 m_imagType = (FXCODEC_IMAGE_TYPE)type; |
| 1334 m_status = FXCODEC_STATUS_FRAME_READY; | 1340 m_status = FXCODEC_STATUS_FRAME_READY; |
| 1335 return m_status; | 1341 return m_status; |
| 1336 } | 1342 } |
| 1337 } | 1343 } |
| 1338 m_status = FXCODEC_STATUS_ERR_FORMAT; | 1344 m_status = FXCODEC_STATUS_ERR_FORMAT; |
| 1339 m_pFile = nullptr; | 1345 m_pFile = nullptr; |
| 1340 return m_status; | 1346 return m_status; |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 return m_status; | 2369 return m_status; |
| 2364 } | 2370 } |
| 2365 default: | 2371 default: |
| 2366 return FXCODEC_STATUS_ERROR; | 2372 return FXCODEC_STATUS_ERROR; |
| 2367 } | 2373 } |
| 2368 } | 2374 } |
| 2369 | 2375 |
| 2370 CCodec_ProgressiveDecoder* CCodec_ModuleMgr::CreateProgressiveDecoder() { | 2376 CCodec_ProgressiveDecoder* CCodec_ModuleMgr::CreateProgressiveDecoder() { |
| 2371 return new CCodec_ProgressiveDecoder(this); | 2377 return new CCodec_ProgressiveDecoder(this); |
| 2372 } | 2378 } |
| OLD | NEW |