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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
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_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "pageint.h" 8 #include "pageint.h"
9 9
10 CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) 10 CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (pShadingDict == NULL) { 111 if (pShadingDict == NULL) {
112 return FALSE; 112 return FALSE;
113 } 113 }
114 if (m_nFuncs) { 114 if (m_nFuncs) {
115 for (int i = 0; i < m_nFuncs; i++) 115 for (int i = 0; i < m_nFuncs; i++)
116 delete m_pFunctions[i]; 116 delete m_pFunctions[i];
117 m_nFuncs = 0; 117 m_nFuncs = 0;
118 } 118 }
119 CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function")); 119 CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
120 if (pFunc) { 120 if (pFunc) {
121 if (pFunc->GetType() == PDFOBJ_ARRAY) { 121 if (CPDF_Array* pArray = pFunc->AsArray()) {
122 m_nFuncs = ((CPDF_Array*)pFunc)->GetCount(); 122 m_nFuncs = std::min<int>(pArray->GetCount(), 4);
123 if (m_nFuncs > 4) { 123
124 m_nFuncs = 4;
125 }
126 for (int i = 0; i < m_nFuncs; i++) { 124 for (int i = 0; i < m_nFuncs; i++) {
127 m_pFunctions[i] = 125 m_pFunctions[i] = CPDF_Function::Load(pArray->GetElementValue(i));
128 CPDF_Function::Load(((CPDF_Array*)pFunc)->GetElementValue(i));
129 } 126 }
130 } else { 127 } else {
131 m_pFunctions[0] = CPDF_Function::Load(pFunc); 128 m_pFunctions[0] = CPDF_Function::Load(pFunc);
132 m_nFuncs = 1; 129 m_nFuncs = 1;
133 } 130 }
134 } 131 }
135 CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace")); 132 CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
136 if (pCSObj == NULL) { 133 if (pCSObj == NULL) {
137 return FALSE; 134 return FALSE;
138 } 135 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 288 }
292 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * 289 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits *
293 color_count); 290 color_count);
294 if (bGouraud) { 291 if (bGouraud) {
295 stream.m_BitStream.ByteAlign(); 292 stream.m_BitStream.ByteAlign();
296 } 293 }
297 } 294 }
298 rect.Transform(pMatrix); 295 rect.Transform(pMatrix);
299 return rect; 296 return rect;
300 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698