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 "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) : |
| 11 m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL) | 11 m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL) |
| 12 { | 12 { |
| 13 if (pParentMatrix) { | 13 if (pParentMatrix) { |
| 14 m_ParentMatrix = *pParentMatrix; | 14 m_ParentMatrix = *pParentMatrix; |
| 15 } | 15 } |
| 16 m_bForceClear = FALSE; | |
|
Tom Sepez
2014/09/16 19:18:06
nit: I'd move this to the initializer list.
jun_fang
2014/09/16 19:24:38
It should be initialized in the parameter list?
| |
| 16 } | 17 } |
| 17 CPDF_Pattern::~CPDF_Pattern() | 18 CPDF_Pattern::~CPDF_Pattern() |
| 18 { | 19 { |
| 19 } | 20 } |
| 20 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter nObj, const CFX_AffineMatrix* parentMatrix) : | 21 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter nObj, const CFX_AffineMatrix* parentMatrix) : |
| 21 CPDF_Pattern(parentMatrix) | 22 CPDF_Pattern(parentMatrix) |
| 22 { | 23 { |
| 23 m_PatternType = PATTERN_TILING; | 24 m_PatternType = PATTERN_TILING; |
| 24 m_pPatternObj = pPatternObj; | 25 m_pPatternObj = pPatternObj; |
| 25 m_pDocument = pDoc; | 26 m_pDocument = pDoc; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 } | 91 } |
| 91 void CPDF_ShadingPattern::Clear() | 92 void CPDF_ShadingPattern::Clear() |
| 92 { | 93 { |
| 93 for (int i = 0; i < m_nFuncs; i ++) { | 94 for (int i = 0; i < m_nFuncs; i ++) { |
| 94 if (m_pFunctions[i]) { | 95 if (m_pFunctions[i]) { |
| 95 delete m_pFunctions[i]; | 96 delete m_pFunctions[i]; |
| 96 } | 97 } |
| 97 m_pFunctions[i] = NULL; | 98 m_pFunctions[i] = NULL; |
| 98 } | 99 } |
| 99 CPDF_ColorSpace* pCS = m_pCS; | 100 CPDF_ColorSpace* pCS = m_pCS; |
| 100 if (pCS && m_pDocument) { | 101 if (!m_bForceClear && pCS && m_pDocument) { |
| 101 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); | 102 m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); |
| 102 } | 103 } |
| 103 m_ShadingType = 0; | 104 m_ShadingType = 0; |
| 104 m_pCS = NULL; | 105 m_pCS = NULL; |
| 105 m_nFuncs = 0; | 106 m_nFuncs = 0; |
| 106 } | 107 } |
| 107 FX_BOOL CPDF_ShadingPattern::Load() | 108 FX_BOOL CPDF_ShadingPattern::Load() |
| 108 { | 109 { |
| 109 if (m_ShadingType != 0) { | 110 if (m_ShadingType != 0) { |
| 110 return TRUE; | 111 return TRUE; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 } | 282 } |
| 282 } | 283 } |
| 283 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color _count); | 284 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color _count); |
| 284 if (bGouraud) { | 285 if (bGouraud) { |
| 285 stream.m_BitStream.ByteAlign(); | 286 stream.m_BitStream.ByteAlign(); |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 rect.Transform(pMatrix); | 289 rect.Transform(pMatrix); |
| 289 return rect; | 290 return rect; |
| 290 } | 291 } |
| OLD | NEW |