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

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

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. 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
« no previous file with comments | « core/src/fxge/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 case FXDIB_1bppMask: 836 case FXDIB_1bppMask:
837 case FXDIB_1bppRgb: 837 case FXDIB_1bppRgb:
838 ASSERT(FALSE); 838 ASSERT(FALSE);
839 return FALSE; 839 return FALSE;
840 case FXDIB_8bppMask: { 840 case FXDIB_8bppMask: {
841 if ((src_format & 0xff) == 1) { 841 if ((src_format & 0xff) == 1) {
842 if (pSrcBitmap->GetPalette()) { 842 if (pSrcBitmap->GetPalette()) {
843 return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 843 return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
844 } 844 }
845 return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top); 845 return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top);
846 } else if ((src_format & 0xff) == 8) { 846 }
847 if ((src_format & 0xff) == 8) {
847 if (pSrcBitmap->GetPalette()) { 848 if (pSrcBitmap->GetPalette()) {
848 return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 849 return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
849 } 850 }
850 return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top); 851 return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, wi dth, height, pSrcBitmap, src_left, src_top);
851 } else if ((src_format & 0xff) >= 24) { 852 }
853 if ((src_format & 0xff) >= 24) {
852 return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 854 return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
853 } 855 }
854 return FALSE; 856 return FALSE;
855 } 857 }
856 case FXDIB_8bppRgb: 858 case FXDIB_8bppRgb:
857 case FXDIB_8bppRgba: { 859 case FXDIB_8bppRgba: {
858 if ((src_format & 0xff) == 8 && pSrcBitmap->GetPalette() == NULL ) { 860 if ((src_format & 0xff) == 8 && pSrcBitmap->GetPalette() == NULL ) {
859 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 861 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
860 } 862 }
861 d_pal = FX_Alloc(FX_DWORD, 256); 863 d_pal = FX_Alloc(FX_DWORD, 256);
862 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pS rcBitmap->GetPalette()) { 864 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pS rcBitmap->GetPalette()) {
863 return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 865 return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
864 } else if ((src_format & 0xff) >= 24) { 866 }
867 if ((src_format & 0xff) >= 24) {
865 return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); 868 return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, widt h, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
866 } 869 }
867 return FALSE; 870 return FALSE;
868 } 871 }
869 case FXDIB_Rgb: 872 case FXDIB_Rgb:
870 case FXDIB_Rgba: { 873 case FXDIB_Rgba: {
871 if ((src_format & 0xff) == 1) { 874 if ((src_format & 0xff) == 1) {
872 if (pSrcBitmap->GetPalette()) { 875 if (pSrcBitmap->GetPalette()) {
873 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 876 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
874 } 877 }
875 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 878 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
876 } else if ((src_format & 0xff) == 8) { 879 }
880 if ((src_format & 0xff) == 8) {
877 if (pSrcBitmap->GetPalette()) { 881 if (pSrcBitmap->GetPalette()) {
878 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 882 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
879 } 883 }
880 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 884 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
881 } else if ((src_format & 0xff) == 24) { 885 }
886 if ((src_format & 0xff) == 24) {
882 return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 887 return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
883 } else if ((src_format & 0xff) == 32) { 888 }
889 if ((src_format & 0xff) == 32) {
884 return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform); 890 return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, w idth, height, pSrcBitmap, src_left, src_top, pIccTransform);
885 } 891 }
886 return FALSE; 892 return FALSE;
887 } 893 }
888 case FXDIB_Argb: 894 case FXDIB_Argb:
889 case FXDIB_Rgb32: { 895 case FXDIB_Rgb32: {
890 if ((src_format & 0xff) == 1) { 896 if ((src_format & 0xff) == 1) {
891 if (pSrcBitmap->GetPalette()) { 897 if (pSrcBitmap->GetPalette()) {
892 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 898 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
893 } 899 }
894 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 900 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
895 } else if ((src_format & 0xff) == 8) { 901 }
902 if ((src_format & 0xff) == 8) {
896 if (pSrcBitmap->GetPalette()) { 903 if (pSrcBitmap->GetPalette()) {
897 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 904 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
898 } 905 }
899 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top); 906 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, de st_pitch, width, height, pSrcBitmap, src_left, src_top);
900 } else if ((src_format & 0xff) >= 24) { 907 }
908 if ((src_format & 0xff) >= 24) {
901 if (src_format & 0x0400) { 909 if (src_format & 0x0400) {
902 return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pit ch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 910 return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pit ch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
903 } 911 }
904 return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform); 912 return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
905 } 913 }
906 return FALSE; 914 return FALSE;
907 } 915 }
908 default: 916 default:
909 return FALSE; 917 return FALSE;
910 } 918 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 if (!m_bExtBuf) { 1067 if (!m_bExtBuf) {
1060 FX_Free(m_pBuffer); 1068 FX_Free(m_pBuffer);
1061 } 1069 }
1062 m_bExtBuf = FALSE; 1070 m_bExtBuf = FALSE;
1063 m_pBuffer = dest_buf; 1071 m_pBuffer = dest_buf;
1064 m_bpp = (uint8_t)dest_format; 1072 m_bpp = (uint8_t)dest_format;
1065 m_AlphaFlag = (uint8_t)(dest_format >> 8); 1073 m_AlphaFlag = (uint8_t)(dest_format >> 8);
1066 m_Pitch = dest_pitch; 1074 m_Pitch = dest_pitch;
1067 return TRUE; 1075 return TRUE;
1068 } 1076 }
OLDNEW
« no previous file with comments | « core/src/fxge/dib/fx_dib_composite.cpp ('k') | core/src/fxge/dib/fx_dib_engine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698