Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "../../../include/fpdfapi/fpdf_serial.h" | 9 #include "../../../include/fpdfapi/fpdf_serial.h" |
| 10 #include "pageint.h" | 10 #include "pageint.h" |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 if (nvalues != nargs) { | 1085 if (nvalues != nargs) { |
| 1086 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); | 1086 CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); |
| 1087 if (pPattern) { | 1087 if (pPattern) { |
| 1088 m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); | 1088 m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); |
| 1089 } | 1089 } |
| 1090 } else { | 1090 } else { |
| 1091 m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues); | 1091 m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues); |
| 1092 } | 1092 } |
| 1093 FX_Free(values); | 1093 FX_Free(values); |
| 1094 } | 1094 } |
| 1095 CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, | 1095 CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, |
| 1096 int type, | 1096 ShadingType type, |
| 1097 const CFX_AffineMatrix* pMatrix, | 1097 const CFX_AffineMatrix* pMatrix, |
| 1098 CPDF_Function** pFuncs, | 1098 CPDF_Function** pFuncs, |
| 1099 int nFuncs, | 1099 int nFuncs, |
| 1100 CPDF_ColorSpace* pCS); | 1100 CPDF_ColorSpace* pCS); |
| 1101 void CPDF_StreamContentParser::Handle_ShadeFill() { | 1101 void CPDF_StreamContentParser::Handle_ShadeFill() { |
| 1102 if (m_Options.m_bTextOnly) { | 1102 if (m_Options.m_bTextOnly) { |
| 1103 return; | 1103 return; |
| 1104 } | 1104 } |
| 1105 CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); | 1105 CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); |
| 1106 if (pPattern == NULL) { | 1106 if (pPattern == NULL) { |
| 1107 return; | 1107 return; |
| 1108 } | 1108 } |
| 1109 if (pPattern->m_PatternType != PATTERN_SHADING) { | 1109 if (pPattern->m_PatternType != PATTERN_SHADING) { |
| 1110 return; | 1110 return; |
| 1111 } | 1111 } |
| 1112 CPDF_ShadingPattern* pShading = (CPDF_ShadingPattern*)pPattern; | 1112 CPDF_ShadingPattern* pShading = (CPDF_ShadingPattern*)pPattern; |
| 1113 if (!pShading->m_bShadingObj) { | 1113 if (!pShading->m_bShadingObj) { |
| 1114 return; | 1114 return; |
| 1115 } | 1115 } |
| 1116 if (!pShading->Load()) { | 1116 if (!pShading->Load()) { |
| 1117 return; | 1117 return; |
| 1118 } | 1118 } |
| 1119 CPDF_ShadingObject* pObj = new CPDF_ShadingObject; | 1119 CPDF_ShadingObject* pObj = new CPDF_ShadingObject; |
| 1120 pObj->m_pShading = pShading; | 1120 pObj->m_pShading = pShading; |
| 1121 SetGraphicStates(pObj, FALSE, FALSE, FALSE); | 1121 SetGraphicStates(pObj, FALSE, FALSE, FALSE); |
| 1122 pObj->m_Matrix = m_pCurStates->m_CTM; | 1122 pObj->m_Matrix = m_pCurStates->m_CTM; |
| 1123 pObj->m_Matrix.Concat(m_mtContentToUser); | 1123 pObj->m_Matrix.Concat(m_mtContentToUser); |
| 1124 CFX_FloatRect bbox; | 1124 CFX_FloatRect bbox; |
| 1125 if (!pObj->m_ClipPath.IsNull()) { | 1125 if (!pObj->m_ClipPath.IsNull()) { |
| 1126 bbox = pObj->m_ClipPath.GetClipBox(); | 1126 bbox = pObj->m_ClipPath.GetClipBox(); |
| 1127 } else { | 1127 } else { |
| 1128 bbox = m_BBox; | 1128 bbox = m_BBox; |
| 1129 } | 1129 } |
| 1130 if (pShading->m_ShadingType >= 4) { | 1130 if (pShading->m_ShadingType >= kFreeFormGouraudTriangleMeshShading) { |
|
Tom Sepez
2015/10/27 00:43:16
Really dislike >= comparisions with enums, can we
dsinclair
2015/10/27 02:11:30
Done.
| |
| 1131 bbox.Intersect(_GetShadingBBox(ToStream(pShading->m_pShadingObj), | 1131 bbox.Intersect(GetShadingBBox(ToStream(pShading->m_pShadingObj), |
| 1132 pShading->m_ShadingType, &pObj->m_Matrix, | 1132 pShading->m_ShadingType, &pObj->m_Matrix, |
| 1133 pShading->m_pFunctions, pShading->m_nFuncs, | 1133 pShading->m_pFunctions, pShading->m_nFuncs, |
| 1134 pShading->m_pCS)); | 1134 pShading->m_pCS)); |
| 1135 } | 1135 } |
| 1136 pObj->m_Left = bbox.left; | 1136 pObj->m_Left = bbox.left; |
| 1137 pObj->m_Right = bbox.right; | 1137 pObj->m_Right = bbox.right; |
| 1138 pObj->m_Top = bbox.top; | 1138 pObj->m_Top = bbox.top; |
| 1139 pObj->m_Bottom = bbox.bottom; | 1139 pObj->m_Bottom = bbox.bottom; |
| 1140 m_pObjectList->m_ObjectList.AddTail(pObj); | 1140 m_pObjectList->m_ObjectList.AddTail(pObj); |
| 1141 } | 1141 } |
| 1142 void CPDF_StreamContentParser::Handle_SetCharSpace() { | 1142 void CPDF_StreamContentParser::Handle_SetCharSpace() { |
| 1143 m_pCurStates->m_TextState.GetModify()->m_CharSpace = GetNumber(0); | 1143 m_pCurStates->m_TextState.GetModify()->m_CharSpace = GetNumber(0); |
| 1144 } | 1144 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 buf.AppendChar((char)code); | 1563 buf.AppendChar((char)code); |
| 1564 } | 1564 } |
| 1565 bFirst = !bFirst; | 1565 bFirst = !bFirst; |
| 1566 } | 1566 } |
| 1567 } | 1567 } |
| 1568 if (!bFirst) { | 1568 if (!bFirst) { |
| 1569 buf.AppendChar((char)code); | 1569 buf.AppendChar((char)code); |
| 1570 } | 1570 } |
| 1571 return buf.GetByteString(); | 1571 return buf.GetByteString(); |
| 1572 } | 1572 } |
| OLD | NEW |