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

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 | « no previous file | 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 (pPattern->m_pShadingObj->IsStream()) {
Tom Sepez 2016/04/21 16:24:24 nit: maybe if (CPFD_Stream* pStream = pPattern->m_
dsinclair 2016/04/21 16:56:00 Done.
895 DrawFreeGouraudShading(pBitmap, &FinalMatrix,
896 ToStream(pPattern->m_pShadingObj), pFuncs,
Tom Sepez 2016/04/21 16:24:24 nit: then you can write pStream, pFuncts, and
dsinclair 2016/04/21 16:56:00 Done.
897 nFuncs, pColorSpace, alpha);
898 }
895 } break; 899 } break;
896 case kLatticeFormGouraudTriangleMeshShading: { 900 case kLatticeFormGouraudTriangleMeshShading: {
897 DrawLatticeGouraudShading(pBitmap, &FinalMatrix, 901 // The shading object can be a stream or a dictionary. We do not handle
898 ToStream(pPattern->m_pShadingObj), pFuncs, 902 // the case of dictionary at the moment.
899 nFuncs, pColorSpace, alpha); 903 if (pPattern->m_pShadingObj->IsStream()) {
904 DrawLatticeGouraudShading(pBitmap, &FinalMatrix,
905 ToStream(pPattern->m_pShadingObj), pFuncs,
906 nFuncs, pColorSpace, alpha);
907 }
900 } break; 908 } break;
901 case kCoonsPatchMeshShading: 909 case kCoonsPatchMeshShading:
902 case kTensorProductPatchMeshShading: { 910 case kTensorProductPatchMeshShading: {
903 DrawCoonPatchMeshes( 911 // The shading object can be a stream or a dictionary. We do not handle
904 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap, 912 // the case of dictionary at the moment.
905 &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs, 913 if (pPattern->m_pShadingObj->IsStream()) {
906 pColorSpace, fill_mode, alpha); 914 DrawCoonPatchMeshes(
915 pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
916 &FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
917 pColorSpace, fill_mode, alpha);
918 }
907 } break; 919 } break;
908 } 920 }
909 if (bAlphaMode) { 921 if (bAlphaMode) {
910 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha); 922 pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
911 } 923 }
912 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) { 924 if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
913 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor); 925 pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
914 } 926 }
915 buffer.OutputToDevice(); 927 buffer.OutputToDevice();
916 } 928 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } 1222 }
1211 } 1223 }
1212 if (bStroke) { 1224 if (bStroke) {
1213 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor(); 1225 CPDF_Color& StrokeColor = *pPathObj->m_ColorState.GetStrokeColor();
1214 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) { 1226 if (StrokeColor.m_pCS && StrokeColor.m_pCS->GetFamily() == PDFCS_PATTERN) {
1215 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE); 1227 DrawPathWithPattern(pPathObj, pObj2Device, &StrokeColor, TRUE);
1216 bStroke = FALSE; 1228 bStroke = FALSE;
1217 } 1229 }
1218 } 1230 }
1219 } 1231 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698