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

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

Issue 1908903003: Only call shading code with streams. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « DEPS ('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 "core/fpdfapi/fpdf_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h" 9 #include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h"
10 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h"
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 break; 882 break;
883 case kAxialShading: 883 case kAxialShading:
884 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 884 DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
885 pColorSpace, alpha); 885 pColorSpace, alpha);
886 break; 886 break;
887 case kRadialShading: 887 case kRadialShading:
888 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, 888 DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
889 pColorSpace, alpha); 889 pColorSpace, alpha);
890 break; 890 break;
891 case kFreeFormGouraudTriangleMeshShading: { 891 case kFreeFormGouraudTriangleMeshShading: {
892 DrawFreeGouraudShading(pBitmap, &FinalMatrix, 892 // The shading object can be a stream or a dictionary. We do not handle
893 ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 893 // the case of dictionary at the moment.
894 pColorSpace, alpha); 894 if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) {
895 DrawFreeGouraudShading(pBitmap, &FinalMatrix, pStream, pFuncs, nFuncs,
896 pColorSpace, alpha);
897 }
895 } break; 898 } break;
896 case kLatticeFormGouraudTriangleMeshShading: { 899 case kLatticeFormGouraudTriangleMeshShading: {
897 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, 900 // The shading object can be a stream or a dictionary. We do not handle
898 ToStream(pPattern->m_pShadingObj), pFuncs, 901 // the case of dictionary at the moment.
899 nFuncs, pColorSpace, alpha); 902 if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) {
903 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, pStream, pFuncs,
904 nFuncs, pColorSpace, alpha);
905 }
900 } break; 906 } break;
901 case kCoonsPatchMeshShading: 907 case kCoonsPatchMeshShading:
902 case kTensorProductPatchMeshShading: { 908 case kTensorProductPatchMeshShading: {
903 DrawCoonPatchMeshes( 909 // The shading object can be a stream or a dictionary. We do not handle
904 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap, 910 // the case of dictionary at the moment.
905 &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 911 if (CPDF_Stream* pStream = ToStream(pPattern->m_pShadingObj)) {
906 pColorSpace, fill_mode, alpha); 912 DrawCoonPatchMeshes(
913 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
914 &FinalMatrix, pStream, pFuncs, nFuncs, pColorSpace, fill_mode,
915 alpha);
916 }
907 } break; 917 } break;
908 } 918 }
909 if (bAlphaMode) { 919 if (bAlphaMode) {
910 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); 920 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
911 } 921 }
912 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { 922 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
913 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); 923 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
914 } 924 }
915 buffer.OutputToDevice(); 925 buffer.OutputToDevice();
916 } 926 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } 1220 }
1211 } 1221 }
1212 if (bStroke) { 1222 if (bStroke) {
1213 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1223 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1214 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1224 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1215 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1225 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1216 bStroke = FALSE; 1226 bStroke = FALSE;
1217 } 1227 }
1218 } 1228 }
1219 } 1229 }
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698