| 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 |
| 1101 void CPDF_StreamContentParser::Handle_ShadeFill() { | 1102 void CPDF_StreamContentParser::Handle_ShadeFill() { |
| 1102 if (m_Options.m_bTextOnly) { | 1103 if (m_Options.m_bTextOnly) { |
| 1103 return; | 1104 return; |
| 1104 } | 1105 } |
| 1105 CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); | 1106 CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); |
| 1106 if (pPattern == NULL) { | 1107 if (pPattern == NULL) { |
| 1107 return; | 1108 return; |
| 1108 } | 1109 } |
| 1109 if (pPattern->m_PatternType != PATTERN_SHADING) { | 1110 if (pPattern->m_PatternType != PATTERN_SHADING) { |
| 1110 return; | 1111 return; |
| 1111 } | 1112 } |
| 1112 CPDF_ShadingPattern* pShading = (CPDF_ShadingPattern*)pPattern; | 1113 CPDF_ShadingPattern* pShading = (CPDF_ShadingPattern*)pPattern; |
| 1113 if (!pShading->m_bShadingObj) { | 1114 if (!pShading->m_bShadingObj) { |
| 1114 return; | 1115 return; |
| 1115 } | 1116 } |
| 1116 if (!pShading->Load()) { | 1117 if (!pShading->Load()) { |
| 1117 return; | 1118 return; |
| 1118 } | 1119 } |
| 1119 CPDF_ShadingObject* pObj = new CPDF_ShadingObject; | 1120 CPDF_ShadingObject* pObj = new CPDF_ShadingObject; |
| 1120 pObj->m_pShading = pShading; | 1121 pObj->m_pShading = pShading; |
| 1121 SetGraphicStates(pObj, FALSE, FALSE, FALSE); | 1122 SetGraphicStates(pObj, FALSE, FALSE, FALSE); |
| 1122 pObj->m_Matrix = m_pCurStates->m_CTM; | 1123 pObj->m_Matrix = m_pCurStates->m_CTM; |
| 1123 pObj->m_Matrix.Concat(m_mtContentToUser); | 1124 pObj->m_Matrix.Concat(m_mtContentToUser); |
| 1124 CFX_FloatRect bbox; | 1125 CFX_FloatRect bbox; |
| 1125 if (!pObj->m_ClipPath.IsNull()) { | 1126 if (!pObj->m_ClipPath.IsNull()) { |
| 1126 bbox = pObj->m_ClipPath.GetClipBox(); | 1127 bbox = pObj->m_ClipPath.GetClipBox(); |
| 1127 } else { | 1128 } else { |
| 1128 bbox = m_BBox; | 1129 bbox = m_BBox; |
| 1129 } | 1130 } |
| 1130 if (pShading->m_ShadingType >= 4) { | 1131 if (pShading->IsMeshShading()) { |
| 1131 bbox.Intersect(_GetShadingBBox(ToStream(pShading->m_pShadingObj), | 1132 bbox.Intersect(GetShadingBBox(ToStream(pShading->m_pShadingObj), |
| 1132 pShading->m_ShadingType, &pObj->m_Matrix, | 1133 pShading->m_ShadingType, &pObj->m_Matrix, |
| 1133 pShading->m_pFunctions, pShading->m_nFuncs, | 1134 pShading->m_pFunctions, pShading->m_nFuncs, |
| 1134 pShading->m_pCS)); | 1135 pShading->m_pCS)); |
| 1135 } | 1136 } |
| 1136 pObj->m_Left = bbox.left; | 1137 pObj->m_Left = bbox.left; |
| 1137 pObj->m_Right = bbox.right; | 1138 pObj->m_Right = bbox.right; |
| 1138 pObj->m_Top = bbox.top; | 1139 pObj->m_Top = bbox.top; |
| 1139 pObj->m_Bottom = bbox.bottom; | 1140 pObj->m_Bottom = bbox.bottom; |
| 1140 m_pObjectList->m_ObjectList.AddTail(pObj); | 1141 m_pObjectList->m_ObjectList.AddTail(pObj); |
| 1141 } | 1142 } |
| 1142 void CPDF_StreamContentParser::Handle_SetCharSpace() { | 1143 void CPDF_StreamContentParser::Handle_SetCharSpace() { |
| 1143 m_pCurStates->m_TextState.GetModify()->m_CharSpace = GetNumber(0); | 1144 m_pCurStates->m_TextState.GetModify()->m_CharSpace = GetNumber(0); |
| 1144 } | 1145 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 buf.AppendChar((char)code); | 1564 buf.AppendChar((char)code); |
| 1564 } | 1565 } |
| 1565 bFirst = !bFirst; | 1566 bFirst = !bFirst; |
| 1566 } | 1567 } |
| 1567 } | 1568 } |
| 1568 if (!bFirst) { | 1569 if (!bFirst) { |
| 1569 buf.AppendChar((char)code); | 1570 buf.AppendChar((char)code); |
| 1570 } | 1571 } |
| 1571 return buf.GetByteString(); | 1572 return buf.GetByteString(); |
| 1572 } | 1573 } |
| OLD | NEW |