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 2009 ZXing authors | 8 * Copyright 2009 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, | 212 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, |
213 blank); | 213 blank); |
214 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); | 214 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); |
215 CFX_FxgeDevice ge; | 215 CFX_FxgeDevice ge; |
216 if (pOutBitmap) { | 216 if (pOutBitmap) { |
217 delete ge.GetBitmap(); | 217 delete ge.GetBitmap(); |
218 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); | 218 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); |
219 ge.GetBitmap()->Clear(m_backgroundColor); | 219 ge.GetBitmap()->Clear(m_backgroundColor); |
220 ge.DrawNormalText(iLen, pCharPos, m_pFont, | 220 ge.DrawNormalText(iLen, pCharPos, m_pFont, |
221 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 221 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
222 (CFX_Matrix*)&affine_matrix, m_fontColor, | 222 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
223 FXTEXT_CLEARTYPE); | |
224 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); | 223 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); |
225 } else { | 224 } else { |
226 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, | 225 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, |
227 (FX_FLOAT)leftPosition * m_outputHScale, | 226 (FX_FLOAT)leftPosition * m_outputHScale, |
228 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 227 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
229 affine_matrix1.Concat(*matrix); | 228 affine_matrix1.Concat(*matrix); |
230 device->DrawNormalText(iLen, pCharPos, m_pFont, | 229 device->DrawNormalText( |
231 CFX_GEModule::Get()->GetFontCache(), | 230 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), |
232 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, | 231 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
233 m_fontColor, FXTEXT_CLEARTYPE); | |
234 } | 232 } |
235 tempStr = str.Mid(4, 4); | 233 tempStr = str.Mid(4, 4); |
236 iLen = tempStr.GetLength(); | 234 iLen = tempStr.GetLength(); |
237 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, | 235 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, |
238 blank); | 236 blank); |
239 if (pOutBitmap) { | 237 if (pOutBitmap) { |
240 delete ge.GetBitmap(); | 238 delete ge.GetBitmap(); |
241 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); | 239 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); |
242 ge.GetBitmap()->Clear(m_backgroundColor); | 240 ge.GetBitmap()->Clear(m_backgroundColor); |
243 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, | 241 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, |
244 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 242 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
245 (CFX_Matrix*)&affine_matrix, m_fontColor, | 243 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
246 FXTEXT_CLEARTYPE); | |
247 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple, | 244 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple, |
248 m_Height - iTextHeight); | 245 m_Height - iTextHeight); |
249 } else { | 246 } else { |
250 CFX_Matrix affine_matrix1( | 247 CFX_Matrix affine_matrix1( |
251 1.0, 0.0, 0.0, -1.0, | 248 1.0, 0.0, 0.0, -1.0, |
252 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, | 249 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, |
253 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 250 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
254 if (matrix) { | 251 if (matrix) { |
255 affine_matrix1.Concat(*matrix); | 252 affine_matrix1.Concat(*matrix); |
256 } | 253 } |
257 device->DrawNormalText(iLen, pCharPos + 4, m_pFont, | 254 device->DrawNormalText( |
258 CFX_GEModule::Get()->GetFontCache(), | 255 iLen, pCharPos + 4, m_pFont, CFX_GEModule::Get()->GetFontCache(), |
259 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, | 256 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
260 m_fontColor, FXTEXT_CLEARTYPE); | |
261 } | 257 } |
262 FX_Free(pCharPos); | 258 FX_Free(pCharPos); |
263 } | 259 } |
264 | 260 |
265 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, | 261 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, |
266 uint8_t* code, | 262 uint8_t* code, |
267 int32_t codeLength, | 263 int32_t codeLength, |
268 FX_BOOL isDevice, | 264 FX_BOOL isDevice, |
269 int32_t& e) { | 265 int32_t& e) { |
270 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 266 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
271 } | 267 } |
OLD | NEW |