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 "fpdfsdk/fxedit/include/fxet_edit.h" | 7 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 nullptr, &ro); | 130 nullptr, &ro); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, | 136 void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, |
137 FX_COLORREF crFill, | 137 FX_COLORREF crFill, |
138 const CFX_FloatRect& rcFill) { | 138 const CFX_FloatRect& rcFill) { |
139 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); | 139 std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); |
140 CFX_PathData* pPathData = pPathObj->m_Path.GetPrivateCopy(); | 140 pPathObj->m_Path.MakePrivateCopy(); |
141 pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); | 141 pPathObj->m_Path->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, |
| 142 rcFill.top); |
142 | 143 |
143 FX_FLOAT rgb[3]; | 144 FX_FLOAT rgb[3]; |
144 rgb[0] = FXARGB_R(crFill) / 255.0f; | 145 rgb[0] = FXARGB_R(crFill) / 255.0f; |
145 rgb[1] = FXARGB_G(crFill) / 255.0f; | 146 rgb[1] = FXARGB_G(crFill) / 255.0f; |
146 rgb[2] = FXARGB_B(crFill) / 255.0f; | 147 rgb[2] = FXARGB_B(crFill) / 255.0f; |
147 pPathObj->m_ColorState.SetFillColor( | 148 pPathObj->m_ColorState.SetFillColor( |
148 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); | 149 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); |
149 | 150 |
150 pPathObj->m_FillType = FXFILL_ALTERNATE; | 151 pPathObj->m_FillType = FXFILL_ALTERNATE; |
151 pPathObj->m_bStroke = FALSE; | 152 pPathObj->m_bStroke = FALSE; |
152 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj)); | 153 pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj)); |
153 } | 154 } |
154 | 155 |
155 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, | 156 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, |
156 FX_COLORREF crText, | 157 FX_COLORREF crText, |
157 CPDF_Font* pFont, | 158 CPDF_Font* pFont, |
158 FX_FLOAT fFontSize, | 159 FX_FLOAT fFontSize, |
159 FX_FLOAT fCharSpace, | 160 FX_FLOAT fCharSpace, |
160 int32_t nHorzScale, | 161 int32_t nHorzScale, |
161 const CFX_FloatPoint& point, | 162 const CFX_FloatPoint& point, |
162 const CFX_ByteString& text) { | 163 const CFX_ByteString& text) { |
163 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); | 164 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); |
164 CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetPrivateCopy(); | 165 pTxtObj->m_TextState.MakePrivateCopy(); |
165 pTextStateData->m_pFont = pFont; | 166 pTxtObj->m_TextState->m_pFont = pFont; |
166 pTextStateData->m_FontSize = fFontSize; | 167 pTxtObj->m_TextState->m_FontSize = fFontSize; |
167 pTextStateData->m_CharSpace = fCharSpace; | 168 pTxtObj->m_TextState->m_CharSpace = fCharSpace; |
168 pTextStateData->m_WordSpace = 0; | 169 pTxtObj->m_TextState->m_WordSpace = 0; |
169 pTextStateData->m_TextMode = TextRenderingMode::MODE_FILL; | 170 pTxtObj->m_TextState->m_TextMode = TextRenderingMode::MODE_FILL; |
170 pTextStateData->m_Matrix[0] = nHorzScale / 100.0f; | 171 pTxtObj->m_TextState->m_Matrix[0] = nHorzScale / 100.0f; |
171 pTextStateData->m_Matrix[1] = 0; | 172 pTxtObj->m_TextState->m_Matrix[1] = 0; |
172 pTextStateData->m_Matrix[2] = 0; | 173 pTxtObj->m_TextState->m_Matrix[2] = 0; |
173 pTextStateData->m_Matrix[3] = 1; | 174 pTxtObj->m_TextState->m_Matrix[3] = 1; |
174 | 175 |
175 FX_FLOAT rgb[3]; | 176 FX_FLOAT rgb[3]; |
176 rgb[0] = FXARGB_R(crText) / 255.0f; | 177 rgb[0] = FXARGB_R(crText) / 255.0f; |
177 rgb[1] = FXARGB_G(crText) / 255.0f; | 178 rgb[1] = FXARGB_G(crText) / 255.0f; |
178 rgb[2] = FXARGB_B(crText) / 255.0f; | 179 rgb[2] = FXARGB_B(crText) / 255.0f; |
179 pTxtObj->m_ColorState.SetFillColor( | 180 pTxtObj->m_ColorState.SetFillColor( |
180 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); | 181 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); |
181 pTxtObj->m_ColorState.SetStrokeColor( | 182 pTxtObj->m_ColorState.SetStrokeColor( |
182 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); | 183 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); |
183 | 184 |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 int32_t CFX_Edit_RectArray::GetSize() const { | 3056 int32_t CFX_Edit_RectArray::GetSize() const { |
3056 return m_Rects.GetSize(); | 3057 return m_Rects.GetSize(); |
3057 } | 3058 } |
3058 | 3059 |
3059 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { | 3060 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { |
3060 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) | 3061 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) |
3061 return nullptr; | 3062 return nullptr; |
3062 | 3063 |
3063 return m_Rects.GetAt(nIndex); | 3064 return m_Rects.GetAt(nIndex); |
3064 } | 3065 } |
OLD | NEW |