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 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2010 ZXing authors | 8 * Copyright 2010 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 (FX_FLOAT)m_Height); | 175 (FX_FLOAT)m_Height); |
176 matr3.Concat(*matrix); | 176 matr3.Concat(*matrix); |
177 matr3.TransformRect(rect3); | 177 matr3.TransformRect(rect3); |
178 re = rect3.GetOutterRect(); | 178 re = rect3.GetOutterRect(); |
179 device->FillRect(&re, m_backgroundColor); | 179 device->FillRect(&re, m_backgroundColor); |
180 } | 180 } |
181 if (pOutBitmap == NULL) { | 181 if (pOutBitmap == NULL) { |
182 strWidth = strWidth * m_outputHScale; | 182 strWidth = strWidth * m_outputHScale; |
183 } | 183 } |
184 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank); | 184 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank); |
185 CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); | 185 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); |
186 CFX_FxgeDevice ge; | 186 CFX_FxgeDevice ge; |
187 if (pOutBitmap != NULL) { | 187 if (pOutBitmap != NULL) { |
188 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); | 188 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); |
189 ge.GetBitmap()->Clear(m_backgroundColor); | 189 ge.GetBitmap()->Clear(m_backgroundColor); |
190 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, | 190 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, |
191 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 191 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
192 (CFX_AffineMatrix*)&affine_matrix, m_fontColor, | 192 (CFX_Matrix*)&affine_matrix, m_fontColor, |
193 FXTEXT_CLEARTYPE); | 193 FXTEXT_CLEARTYPE); |
194 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); | 194 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); |
195 } else { | 195 } else { |
196 CFX_AffineMatrix affine_matrix1( | 196 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, |
197 1.0, 0.0, 0.0, -1.0, (FX_FLOAT)leftPosition * m_outputHScale, | 197 (FX_FLOAT)leftPosition * m_outputHScale, |
198 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 198 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
199 if (matrix != NULL) { | 199 if (matrix != NULL) { |
200 affine_matrix1.Concat(*matrix); | 200 affine_matrix1.Concat(*matrix); |
201 } | 201 } |
202 device->DrawNormalText( | 202 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, |
203 iLen, pCharPos + 1, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 203 CFX_GEModule::Get()->GetFontCache(), |
204 (FX_FLOAT)iFontSize, (CFX_AffineMatrix*)&affine_matrix1, m_fontColor, | 204 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, |
205 FXTEXT_CLEARTYPE); | 205 m_fontColor, FXTEXT_CLEARTYPE); |
206 } | 206 } |
207 tempStr = str.Mid(6, 5); | 207 tempStr = str.Mid(6, 5); |
208 iLen = tempStr.GetLength(); | 208 iLen = tempStr.GetLength(); |
209 charsWidth = 0.0f; | 209 charsWidth = 0.0f; |
210 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank); | 210 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank); |
211 if (pOutBitmap != NULL) { | 211 if (pOutBitmap != NULL) { |
212 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); | 212 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); |
213 ge.FillRect(&rect2, m_backgroundColor); | 213 ge.FillRect(&rect2, m_backgroundColor); |
214 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, | 214 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, |
215 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 215 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
216 (CFX_AffineMatrix*)&affine_matrix, m_fontColor, | 216 (CFX_Matrix*)&affine_matrix, m_fontColor, |
217 FXTEXT_CLEARTYPE); | 217 FXTEXT_CLEARTYPE); |
218 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, | 218 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, |
219 m_Height - iTextHeight); | 219 m_Height - iTextHeight); |
220 } else { | 220 } else { |
221 CFX_AffineMatrix affine_matrix1( | 221 CFX_Matrix affine_matrix1( |
222 1.0, 0.0, 0.0, -1.0, | 222 1.0, 0.0, 0.0, -1.0, |
223 (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale, | 223 (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale, |
224 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 224 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
225 if (matrix != NULL) { | 225 if (matrix != NULL) { |
226 affine_matrix1.Concat(*matrix); | 226 affine_matrix1.Concat(*matrix); |
227 } | 227 } |
228 device->DrawNormalText( | 228 device->DrawNormalText(iLen, pCharPos + 6, m_pFont, |
229 iLen, pCharPos + 6, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 229 CFX_GEModule::Get()->GetFontCache(), |
230 (FX_FLOAT)iFontSize, (CFX_AffineMatrix*)&affine_matrix1, m_fontColor, | 230 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, |
231 FXTEXT_CLEARTYPE); | 231 m_fontColor, FXTEXT_CLEARTYPE); |
232 } | 232 } |
233 tempStr = str.Mid(0, 1); | 233 tempStr = str.Mid(0, 1); |
234 iLen = tempStr.GetLength(); | 234 iLen = tempStr.GetLength(); |
235 strWidth = (FX_FLOAT)multiple * 7; | 235 strWidth = (FX_FLOAT)multiple * 7; |
236 if (pOutBitmap == NULL) { | 236 if (pOutBitmap == NULL) { |
237 strWidth = strWidth * m_outputHScale; | 237 strWidth = strWidth * m_outputHScale; |
238 } | 238 } |
239 CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank); | 239 CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank); |
240 if (pOutBitmap != NULL) { | 240 if (pOutBitmap != NULL) { |
241 delete ge.GetBitmap(); | 241 delete ge.GetBitmap(); |
242 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); | 242 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); |
243 ge.GetBitmap()->Clear(m_backgroundColor); | 243 ge.GetBitmap()->Clear(m_backgroundColor); |
244 ge.DrawNormalText(iLen, pCharPos, m_pFont, | 244 ge.DrawNormalText(iLen, pCharPos, m_pFont, |
245 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 245 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
246 (CFX_AffineMatrix*)&affine_matrix, m_fontColor, | 246 (CFX_Matrix*)&affine_matrix, m_fontColor, |
247 FXTEXT_CLEARTYPE); | 247 FXTEXT_CLEARTYPE); |
248 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); | 248 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); |
249 } else { | 249 } else { |
250 CFX_AffineMatrix affine_matrix1( | 250 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0, |
251 1.0, 0.0, 0.0, -1.0, 0, (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 251 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
252 if (matrix != NULL) { | 252 if (matrix != NULL) { |
253 affine_matrix1.Concat(*matrix); | 253 affine_matrix1.Concat(*matrix); |
254 } | 254 } |
255 device->DrawNormalText( | 255 device->DrawNormalText(iLen, pCharPos, m_pFont, |
256 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 256 CFX_GEModule::Get()->GetFontCache(), |
257 (FX_FLOAT)iFontSize, (CFX_AffineMatrix*)&affine_matrix1, m_fontColor, | 257 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, |
258 FXTEXT_CLEARTYPE); | 258 m_fontColor, FXTEXT_CLEARTYPE); |
259 } | 259 } |
260 tempStr = str.Mid(11, 1); | 260 tempStr = str.Mid(11, 1); |
261 iLen = tempStr.GetLength(); | 261 iLen = tempStr.GetLength(); |
262 CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank); | 262 CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank); |
263 if (pOutBitmap != NULL) { | 263 if (pOutBitmap != NULL) { |
264 delete ge.GetBitmap(); | 264 delete ge.GetBitmap(); |
265 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); | 265 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb); |
266 ge.GetBitmap()->Clear(m_backgroundColor); | 266 ge.GetBitmap()->Clear(m_backgroundColor); |
267 ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, | 267 ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, |
268 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 268 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
269 (CFX_AffineMatrix*)&affine_matrix, m_fontColor, | 269 (CFX_Matrix*)&affine_matrix, m_fontColor, |
270 FXTEXT_CLEARTYPE); | 270 FXTEXT_CLEARTYPE); |
271 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple, | 271 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple, |
272 m_Height - iTextHeight); | 272 m_Height - iTextHeight); |
273 } else { | 273 } else { |
274 CFX_AffineMatrix affine_matrix1( | 274 CFX_Matrix affine_matrix1( |
275 1.0, 0.0, 0.0, -1.0, | 275 1.0, 0.0, 0.0, -1.0, |
276 (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale, | 276 (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale, |
277 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 277 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
278 if (matrix != NULL) { | 278 if (matrix != NULL) { |
279 affine_matrix1.Concat(*matrix); | 279 affine_matrix1.Concat(*matrix); |
280 } | 280 } |
281 device->DrawNormalText( | 281 device->DrawNormalText(iLen, pCharPos + 11, m_pFont, |
282 iLen, pCharPos + 11, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 282 CFX_GEModule::Get()->GetFontCache(), |
283 (FX_FLOAT)iFontSize, (CFX_AffineMatrix*)&affine_matrix1, m_fontColor, | 283 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, |
284 FXTEXT_CLEARTYPE); | 284 m_fontColor, FXTEXT_CLEARTYPE); |
285 } | 285 } |
286 FX_Free(pCharPos); | 286 FX_Free(pCharPos); |
287 } | 287 } |
288 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, | 288 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, |
289 uint8_t* code, | 289 uint8_t* code, |
290 int32_t codeLength, | 290 int32_t codeLength, |
291 FX_BOOL isDevice, | 291 FX_BOOL isDevice, |
292 int32_t& e) { | 292 int32_t& e) { |
293 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 293 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
294 } | 294 } |
OLD | NEW |