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

Side by Side Diff: core/src/fxge/dib/fx_dib_convert.cpp

Issue 1239313005: Merge to XFA - else after returns. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 5 months 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/fxge/fx_ge.h" 8 #include "../../../include/fxge/fx_ge.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 const FX_DWORD g_dwWinPalette[256] = { 10 const FX_DWORD g_dwWinPalette[256] = {
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 case FXDIB_1bppMask: 840 case FXDIB_1bppMask:
841 case FXDIB_1bppRgb: 841 case FXDIB_1bppRgb:
842 ASSERT(FALSE); 842 ASSERT(FALSE);
843 return FALSE; 843 return FALSE;
844 case FXDIB_8bppMask: { 844 case FXDIB_8bppMask: {
845 if ((src_format & 0xff) == 1) { 845 if ((src_format & 0xff) == 1) {
846 if (pSrcBitmap->GetPalette()) { 846 if (pSrcBitmap->GetPalette()) {
847 return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 847 return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
848 } 848 }
849 return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top); 849 return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top);
850 } else if ((src_format & 0xff) == 8) { 850 }
851 if ((src_format & 0xff) == 8) {
851 if (pSrcBitmap->GetPalette()) { 852 if (pSrcBitmap->GetPalette()) {
852 return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 853 return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
853 } 854 }
854 return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top); 855 return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top);
855 } else if ((src_format & 0xff) >= 24) { 856 }
857 if ((src_format & 0xff) >= 24) {
856 return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 858 return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
857 } 859 }
858 return FALSE; 860 return FALSE;
859 } 861 }
860 case FXDIB_8bppRgb: 862 case FXDIB_8bppRgb:
861 case FXDIB_8bppRgba: { 863 case FXDIB_8bppRgba: {
862 if ((src_format & 0xff) == 8 && pSrcBitmap->GetPalette() == NULL ) { 864 if ((src_format & 0xff) == 8 && pSrcBitmap->GetPalette() == NULL ) {
863 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 865 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
864 } 866 }
865 d_pal = FX_Alloc(FX_DWORD, 256); 867 d_pal = FX_Alloc(FX_DWORD, 256);
866 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pS rcBitmap->GetPalette()) { 868 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pS rcBitmap->GetPalette()) {
867 return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 869 return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
868 } else if ((src_format & 0xff) >= 24) { 870 }
871 if ((src_format & 0xff) >= 24) {
869 return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 872 return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
870 } 873 }
871 return FALSE; 874 return FALSE;
872 } 875 }
873 case FXDIB_Rgb: 876 case FXDIB_Rgb:
874 case FXDIB_Rgba: { 877 case FXDIB_Rgba: {
875 if ((src_format & 0xff) == 1) { 878 if ((src_format & 0xff) == 1) {
876 if (pSrcBitmap->GetPalette()) { 879 if (pSrcBitmap->GetPalette()) {
877 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 880 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
878 } 881 }
879 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 882 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
880 } else if ((src_format & 0xff) == 8) { 883 }
884 if ((src_format & 0xff) == 8) {
881 if (pSrcBitmap->GetPalette()) { 885 if (pSrcBitmap->GetPalette()) {
882 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 886 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
883 } 887 }
884 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 888 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
885 } else if ((src_format & 0xff) == 24) { 889 }
890 if ((src_format & 0xff) == 24) {
886 return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 891 return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
887 } else if ((src_format & 0xff) == 32) { 892 }
893 if ((src_format & 0xff) == 32) {
888 return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 894 return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
889 } 895 }
890 return FALSE; 896 return FALSE;
891 } 897 }
892 case FXDIB_Argb: 898 case FXDIB_Argb:
893 case FXDIB_Rgb32: { 899 case FXDIB_Rgb32: {
894 if ((src_format & 0xff) == 1) { 900 if ((src_format & 0xff) == 1) {
895 if (pSrcBitmap->GetPalette()) { 901 if (pSrcBitmap->GetPalette()) {
896 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 902 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
897 } 903 }
898 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 904 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
899 } else if ((src_format & 0xff) == 8) { 905 }
906 if ((src_format & 0xff) == 8) {
900 if (pSrcBitmap->GetPalette()) { 907 if (pSrcBitmap->GetPalette()) {
901 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 908 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
902 } 909 }
903 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 910 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
904 } else if ((src_format & 0xff) >= 24) { 911 }
912 if ((src_format & 0xff) >= 24) {
905 if (src_format & 0x0400) { 913 if (src_format & 0x0400) {
906 return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pit ch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 914 return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pit ch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
907 } 915 }
908 return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 916 return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
909 } 917 }
910 return FALSE; 918 return FALSE;
911 } 919 }
912 default: 920 default:
913 return FALSE; 921 return FALSE;
914 } 922 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 if (!m_bExtBuf) { 1074 if (!m_bExtBuf) {
1067 FX_Free(m_pBuffer); 1075 FX_Free(m_pBuffer);
1068 } 1076 }
1069 m_bExtBuf = FALSE; 1077 m_bExtBuf = FALSE;
1070 m_pBuffer = dest_buf; 1078 m_pBuffer = dest_buf;
1071 m_bpp = (uint8_t)dest_format; 1079 m_bpp = (uint8_t)dest_format;
1072 m_AlphaFlag = (uint8_t)(dest_format >> 8); 1080 m_AlphaFlag = (uint8_t)(dest_format >> 8);
1073 m_Pitch = dest_pitch; 1081 m_Pitch = dest_pitch;
1074 return TRUE; 1082 return TRUE;
1075 } 1083 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698