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