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

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
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 kFunctionBasedShading:
872 DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace, 872 DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace,
873 alpha); 873 alpha);
874 break; 874 break;
875 case 2: 875 case kAxialShading:
876 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 876 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
877 pColorSpace, alpha); 877 pColorSpace, alpha);
878 break; 878 break;
879 case 3: 879 case kRadialShading:
880 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 880 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
881 pColorSpace, alpha); 881 pColorSpace, alpha);
882 break; 882 break;
883 case 4: { 883 case kFreeFormGouraudTriangleMeshShading: {
884 DrawFreeGouraudShading(pBitmap, &FinalMatrix, 884 DrawFreeGouraudShading(pBitmap, &FinalMatrix,
885 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 885 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
886 pColorSpace, alpha); 886 pColorSpace, alpha);
887 } break; 887 } break;
888 case 5: { 888 case kLatticeFormGouraudTriangleMeshShading: {
889 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, 889 DrawLatticeGouraudShading(pBitmap, &FinalMatrix,
890 ToStream(pPattern->m_pShadingObj), pFuncs, 890 ToStream(pPattern->m_pShadingObj), pFuncs,
891 nFuncs, pColorSpace, alpha); 891 nFuncs, pColorSpace, alpha);
892 } break; 892 } break;
893 case 6: 893 case kCoonsPatchMeshShading:
894 case 7: { 894 case kTensorProductPatchMeshShading: {
895 DrawCoonPatchMeshes(pPattern->m_ShadingType - 6, pBitmap, &FinalMatrix, 895 DrawCoonPatchMeshes(
896 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 896 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
897 pColorSpace, fill_mode, alpha); 897 &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
898 pColorSpace, fill_mode, alpha);
898 } break; 899 } break;
899 } 900 }
900 if (bAlphaMode) { 901 if (bAlphaMode) {
901 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); 902 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
902 } 903 }
903 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { 904 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
904 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); 905 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
905 } 906 }
906 buffer.OutputToDevice(); 907 buffer.OutputToDevice();
907 } 908 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 } 1204 }
1204 } 1205 }
1205 if (bStroke) { 1206 if (bStroke) {
1206 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1207 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1207 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1208 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1208 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1209 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1209 bStroke = FALSE; 1210 bStroke = FALSE;
1210 } 1211 }
1211 } 1212 }
1212 } 1213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698