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 "../../../include/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
8 #include "codec_int.h" | 8 #include "codec_int.h" |
9 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" | 9 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" |
10 #include "../lcms2/include/fx_lcms2.h" | 10 #include "../lcms2/include/fx_lcms2.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 } else { | 722 } else { |
723 *pPixel = (FX_BYTE)(src << -adjust_comps[channel]); | 723 *pPixel = (FX_BYTE)(src << -adjust_comps[channel]); |
724 } | 724 } |
725 } | 725 } |
726 } | 726 } |
727 } else { | 727 } else { |
728 for(row = 0; row < hei; row++) { | 728 for(row = 0; row < hei; row++) { |
729 pScanline = pChannel + row * pitch; | 729 pScanline = pChannel + row * pitch; |
730 for (col = 0; col < wid; col++) { | 730 for (col = 0; col < wid; col++) { |
731 pPixel = pScanline + col * image->numcomps; | 731 pPixel = pScanline + col * image->numcomps; |
732 » » » » » » if (!image->comps[channel].data)
continue; | 732 if (!image->comps[channel].data) { |
| 733 continue; |
| 734 } |
733 src = image->comps[channel].data[row * wid + col]; | 735 src = image->comps[channel].data[row * wid + col]; |
734 src += image->comps[channel].sgnd ? 1 << (image->comps[c
hannel].prec - 1) : 0; | 736 src += image->comps[channel].sgnd ? 1 << (image->comps[c
hannel].prec - 1) : 0; |
735 if (adjust_comps[channel] - 1 < 0) { | 737 if (adjust_comps[channel] - 1 < 0) { |
736 *pPixel = (FX_BYTE)((src >> adjust_comps[channel])); | 738 *pPixel = (FX_BYTE)((src >> adjust_comps[channel])); |
737 } else { | 739 } else { |
738 int tmpPixel = (src >> adjust_comps[channel]) + ((sr
c >> (adjust_comps[channel] - 1)) % 2); | 740 int tmpPixel = (src >> adjust_comps[channel]) + ((sr
c >> (adjust_comps[channel] - 1)) % 2); |
739 if (tmpPixel > 255) { | 741 if (tmpPixel > 255) { |
740 tmpPixel = 255; | 742 tmpPixel = 255; |
741 } else if (tmpPixel < 0) { | 743 } else if (tmpPixel < 0) { |
742 tmpPixel = 0; | 744 tmpPixel = 0; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B
OOL bTranslateColor, FX_LPBYTE offsets) | 792 FX_BOOL CCodec_JpxModule::Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_B
OOL bTranslateColor, FX_LPBYTE offsets) |
791 { | 793 { |
792 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 794 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
793 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); | 795 return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); |
794 } | 796 } |
795 void CCodec_JpxModule::DestroyDecoder(void* ctx) | 797 void CCodec_JpxModule::DestroyDecoder(void* ctx) |
796 { | 798 { |
797 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; | 799 CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; |
798 delete pDecoder; | 800 delete pDecoder; |
799 } | 801 } |
OLD | NEW |