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 "core/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/fx_ge.h" |
8 | 8 |
9 #include "core/fxcodec/include/fx_codec.h" | 9 #include "core/fxcodec/include/fx_codec.h" |
10 #include "core/fxge/ge/fx_text_int.h" | 10 #include "core/fxge/ge/fx_text_int.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (m_bInited) { | 70 if (m_bInited) { |
71 OUTPUT_PS("\nrestore\n"); | 71 OUTPUT_PS("\nrestore\n"); |
72 } | 72 } |
73 m_bInited = FALSE; | 73 m_bInited = FALSE; |
74 } | 74 } |
75 void CFX_PSRenderer::SaveState() { | 75 void CFX_PSRenderer::SaveState() { |
76 StartRendering(); | 76 StartRendering(); |
77 OUTPUT_PS("q\n"); | 77 OUTPUT_PS("q\n"); |
78 m_ClipBoxStack.Add(m_ClipBox); | 78 m_ClipBoxStack.Add(m_ClipBox); |
79 } | 79 } |
80 void CFX_PSRenderer::RestoreState(FX_BOOL bKeepSaved) { | 80 |
| 81 void CFX_PSRenderer::RestoreState(bool bKeepSaved) { |
81 StartRendering(); | 82 StartRendering(); |
82 if (bKeepSaved) { | 83 if (bKeepSaved) { |
83 OUTPUT_PS("Q\nq\n"); | 84 OUTPUT_PS("Q\nq\n"); |
84 } else { | 85 } else { |
85 OUTPUT_PS("Q\n"); | 86 OUTPUT_PS("Q\n"); |
86 } | 87 } |
87 m_bColorSet = m_bGraphStateSet = FALSE; | 88 m_bColorSet = FALSE; |
88 m_ClipBox = m_ClipBoxStack.GetAt(m_ClipBoxStack.GetSize() - 1); | 89 m_bGraphStateSet = FALSE; |
89 if (!bKeepSaved) { | 90 int size = m_ClipBoxStack.GetSize(); |
90 m_ClipBoxStack.RemoveAt(m_ClipBoxStack.GetSize() - 1); | 91 if (!size) |
91 } | 92 return; |
| 93 |
| 94 m_ClipBox = m_ClipBoxStack.GetAt(size - 1); |
| 95 if (!bKeepSaved) |
| 96 m_ClipBoxStack.RemoveAt(size - 1); |
92 } | 97 } |
| 98 |
93 void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, | 99 void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, |
94 const CFX_Matrix* pObject2Device) { | 100 const CFX_Matrix* pObject2Device) { |
95 int nPoints = pPathData->GetPointCount(); | 101 int nPoints = pPathData->GetPointCount(); |
96 CFX_ByteTextBuf buf; | 102 CFX_ByteTextBuf buf; |
97 buf.EstimateSize(nPoints * 10); | 103 buf.EstimateSize(nPoints * 10); |
98 for (int i = 0; i < nPoints; i++) { | 104 for (int i = 0; i < nPoints; i++) { |
99 uint8_t flag = pPathData->GetFlag(i); | 105 uint8_t flag = pPathData->GetFlag(i); |
100 FX_FLOAT x = pPathData->GetPointX(i); | 106 FX_FLOAT x = pPathData->GetPointX(i); |
101 FX_FLOAT y = pPathData->GetPointY(i); | 107 FX_FLOAT y = pPathData->GetPointY(i); |
102 if (pObject2Device) { | 108 if (pObject2Device) { |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 uint32_t dest_size; | 697 uint32_t dest_size; |
692 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 698 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); |
693 if (pEncoders && | 699 if (pEncoders && |
694 pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { | 700 pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { |
695 m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); | 701 m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); |
696 FX_Free(dest_buf); | 702 FX_Free(dest_buf); |
697 } else { | 703 } else { |
698 m_pOutput->OutputPS((const FX_CHAR*)data, len); | 704 m_pOutput->OutputPS((const FX_CHAR*)data, len); |
699 } | 705 } |
700 } | 706 } |
OLD | NEW |