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/codec_int.h" | 7 #include "core/fxcodec/codec/codec_int.h" |
8 #include "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
9 #include "core/fxge/include/fx_dib.h" | 9 #include "core/fxge/include/fx_dib.h" |
10 | 10 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 uint32_t bpp = bps * spp; | 505 uint32_t bpp = bps * spp; |
506 if (bpp == 1) { | 506 if (bpp == 1) { |
507 return Decode1bppRGB(pDIBitmap, height, width, bps, spp); | 507 return Decode1bppRGB(pDIBitmap, height, width, bps, spp); |
508 } else if (bpp <= 8) { | 508 } else if (bpp <= 8) { |
509 return Decode8bppRGB(pDIBitmap, height, width, bps, spp); | 509 return Decode8bppRGB(pDIBitmap, height, width, bps, spp); |
510 } else if (bpp <= 24) { | 510 } else if (bpp <= 24) { |
511 return Decode24bppRGB(pDIBitmap, height, width, bps, spp); | 511 return Decode24bppRGB(pDIBitmap, height, width, bps, spp); |
512 } | 512 } |
513 return FALSE; | 513 return FALSE; |
514 } | 514 } |
515 void* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) { | 515 |
| 516 CCodec_TiffContext* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) { |
516 CCodec_TiffContext* pDecoder = new CCodec_TiffContext; | 517 CCodec_TiffContext* pDecoder = new CCodec_TiffContext; |
517 if (!pDecoder->InitDecoder(file_ptr)) { | 518 if (!pDecoder->InitDecoder(file_ptr)) { |
518 delete pDecoder; | 519 delete pDecoder; |
519 return NULL; | 520 return nullptr; |
520 } | 521 } |
521 return pDecoder; | 522 return pDecoder; |
522 } | 523 } |
523 void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames) { | 524 |
524 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 525 void CCodec_TiffModule::GetFrames(CCodec_TiffContext* ctx, int32_t& frames) { |
525 pDecoder->GetFrames(frames); | 526 ctx->GetFrames(frames); |
526 } | 527 } |
527 FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx, | 528 |
| 529 FX_BOOL CCodec_TiffModule::LoadFrameInfo(CCodec_TiffContext* ctx, |
528 int32_t frame, | 530 int32_t frame, |
529 uint32_t& width, | 531 uint32_t& width, |
530 uint32_t& height, | 532 uint32_t& height, |
531 uint32_t& comps, | 533 uint32_t& comps, |
532 uint32_t& bpc, | 534 uint32_t& bpc, |
533 CFX_DIBAttribute* pAttribute) { | 535 CFX_DIBAttribute* pAttribute) { |
534 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 536 return ctx->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); |
535 return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); | |
536 } | 537 } |
537 FX_BOOL CCodec_TiffModule::Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) { | 538 |
538 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 539 FX_BOOL CCodec_TiffModule::Decode(CCodec_TiffContext* ctx, |
539 return pDecoder->Decode(pDIBitmap); | 540 class CFX_DIBitmap* pDIBitmap) { |
| 541 return ctx->Decode(pDIBitmap); |
540 } | 542 } |
541 void CCodec_TiffModule::DestroyDecoder(void* ctx) { | 543 |
542 CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; | 544 void CCodec_TiffModule::DestroyDecoder(CCodec_TiffContext* ctx) { |
543 delete pDecoder; | 545 delete ctx; |
544 } | 546 } |
OLD | NEW |