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

Side by Side Diff: core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp

Issue 1418623011: Give names to the shading types (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 1 month 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/fpdfapi/fpdf_page/fpdf_page_pattern.cpp ('k') | no next file » | 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/fpdfapi/fpdf_render.h" 7 #include "../../../include/fpdfapi/fpdf_render.h"
8 #include "../../../include/fpdfapi/fpdf_pageobj.h" 8 #include "../../../include/fpdfapi/fpdf_pageobj.h"
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../fpdf_page/pageint.h" 10 #include "../fpdf_page/pageint.h"
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 buffer.Initialize(m_pContext, m_pDevice, &clip_rect, m_pCurObj, 150); 861 buffer.Initialize(m_pContext, m_pDevice, &clip_rect, m_pCurObj, 150);
862 CFX_AffineMatrix FinalMatrix = *pMatrix; 862 CFX_AffineMatrix FinalMatrix = *pMatrix;
863 FinalMatrix.Concat(*buffer.GetMatrix()); 863 FinalMatrix.Concat(*buffer.GetMatrix());
864 CFX_DIBitmap* pBitmap = buffer.GetBitmap(); 864 CFX_DIBitmap* pBitmap = buffer.GetBitmap();
865 if (pBitmap->GetBuffer() == NULL) { 865 if (pBitmap->GetBuffer() == NULL) {
866 return; 866 return;
867 } 867 }
868 pBitmap->Clear(background); 868 pBitmap->Clear(background);
869 int fill_mode = m_Options.m_Flags; 869 int fill_mode = m_Options.m_Flags;
870 switch (pPattern->m_ShadingType) { 870 switch (pPattern->m_ShadingType) {
871 case 1: 871 case kInvalidShading:
872 case kMaxShading:
873 return;
dsinclair 2015/10/27 17:15:17 I added handling for the two extra types here, it
Tom Sepez 2015/10/27 17:17:13 Acknowledged.
874 case kFunctionBasedShading:
872 DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace, 875 DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace,
873 alpha); 876 alpha);
874 break; 877 break;
875 case 2: 878 case kAxialShading:
876 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 879 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
877 pColorSpace, alpha); 880 pColorSpace, alpha);
878 break; 881 break;
879 case 3: 882 case kRadialShading:
880 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 883 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
881 pColorSpace, alpha); 884 pColorSpace, alpha);
882 break; 885 break;
883 case 4: { 886 case kFreeFormGouraudTriangleMeshShading: {
884 DrawFreeGouraudShading(pBitmap, &FinalMatrix, 887 DrawFreeGouraudShading(pBitmap, &FinalMatrix,
885 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 888 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
886 pColorSpace, alpha); 889 pColorSpace, alpha);
887 } break; 890 } break;
888 case 5: { 891 case kLatticeFormGouraudTriangleMeshShading: {
889 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, 892 DrawLatticeGouraudShading(pBitmap, &FinalMatrix,
890 ToStream(pPattern->m_pShadingObj), pFuncs, 893 ToStream(pPattern->m_pShadingObj), pFuncs,
891 nFuncs, pColorSpace, alpha); 894 nFuncs, pColorSpace, alpha);
892 } break; 895 } break;
893 case 6: 896 case kCoonsPatchMeshShading:
894 case 7: { 897 case kTensorProductPatchMeshShading: {
895 DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix, 898 DrawCoonPatchMeshes(
896 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 899 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
897 pColorSpace, fill_mode, alpha); 900 &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
901 pColorSpace, fill_mode, alpha);
898 } break; 902 } break;
899 } 903 }
900 if (bAlphaMode) { 904 if (bAlphaMode) {
901 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); 905 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
902 } 906 }
903 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { 907 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
904 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); 908 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
905 } 909 }
906 buffer.OutputToDevice(); 910 buffer.OutputToDevice();
907 } 911 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1207 }
1204 } 1208 }
1205 if (bStroke) { 1209 if (bStroke) {
1206 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1210 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1207 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1211 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1208 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1212 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1209 bStroke = FALSE; 1213 bStroke = FALSE;
1210 } 1214 }
1211 } 1215 }
1212 } 1216 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698