| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 strWidth = (int32_t)(strWidth * m_outputHScale); | 224 strWidth = (int32_t)(strWidth * m_outputHScale); |
| 225 } | 225 } |
| 226 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, | 226 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, |
| 227 blank); | 227 blank); |
| 228 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); | 228 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); |
| 229 CFX_FxgeDevice ge; | 229 CFX_FxgeDevice ge; |
| 230 if (pOutBitmap) { | 230 if (pOutBitmap) { |
| 231 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); | 231 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); |
| 232 FX_RECT rect(0, 0, strWidth, iTextHeight); | 232 FX_RECT rect(0, 0, strWidth, iTextHeight); |
| 233 ge.FillRect(&rect, m_backgroundColor); | 233 ge.FillRect(&rect, m_backgroundColor); |
| 234 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, | 234 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize, |
| 235 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | |
| 236 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); | 235 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
| 237 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); | 236 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); |
| 238 } else { | 237 } else { |
| 239 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, | 238 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, |
| 240 (FX_FLOAT)leftPosition * m_outputHScale, | 239 (FX_FLOAT)leftPosition * m_outputHScale, |
| 241 (FX_FLOAT)(m_Height - iTextHeight) + iFontSize); | 240 (FX_FLOAT)(m_Height - iTextHeight) + iFontSize); |
| 242 if (matrix) { | 241 if (matrix) { |
| 243 affine_matrix1.Concat(*matrix); | 242 affine_matrix1.Concat(*matrix); |
| 244 } | 243 } |
| 245 device->DrawNormalText( | 244 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize, |
| 246 iLen, pCharPos + 1, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 245 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
| 247 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); | |
| 248 } | 246 } |
| 249 tempStr = str.Mid(7, 6); | 247 tempStr = str.Mid(7, 6); |
| 250 iLen = tempStr.GetLength(); | 248 iLen = tempStr.GetLength(); |
| 251 CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize, | 249 CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize, |
| 252 blank); | 250 blank); |
| 253 if (pOutBitmap) { | 251 if (pOutBitmap) { |
| 254 FX_RECT rect1(0, 0, strWidth, iTextHeight); | 252 FX_RECT rect1(0, 0, strWidth, iTextHeight); |
| 255 ge.FillRect(&rect1, m_backgroundColor); | 253 ge.FillRect(&rect1, m_backgroundColor); |
| 256 ge.DrawNormalText(iLen, pCharPos + 7, m_pFont, | 254 ge.DrawNormalText(iLen, pCharPos + 7, m_pFont, (FX_FLOAT)iFontSize, |
| 257 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | |
| 258 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); | 255 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
| 259 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple, | 256 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple, |
| 260 m_Height - iTextHeight); | 257 m_Height - iTextHeight); |
| 261 } else { | 258 } else { |
| 262 CFX_Matrix affine_matrix1( | 259 CFX_Matrix affine_matrix1( |
| 263 1.0, 0.0, 0.0, -1.0, | 260 1.0, 0.0, 0.0, -1.0, |
| 264 (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale, | 261 (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale, |
| 265 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 262 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
| 266 if (matrix) { | 263 if (matrix) { |
| 267 affine_matrix1.Concat(*matrix); | 264 affine_matrix1.Concat(*matrix); |
| 268 } | 265 } |
| 269 device->DrawNormalText( | 266 device->DrawNormalText(iLen, pCharPos + 7, m_pFont, (FX_FLOAT)iFontSize, |
| 270 iLen, pCharPos + 7, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 267 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
| 271 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); | |
| 272 } | 268 } |
| 273 tempStr = str.Mid(0, 1); | 269 tempStr = str.Mid(0, 1); |
| 274 iLen = tempStr.GetLength(); | 270 iLen = tempStr.GetLength(); |
| 275 strWidth = multiple * 7; | 271 strWidth = multiple * 7; |
| 276 if (!pOutBitmap) | 272 if (!pOutBitmap) |
| 277 strWidth = (int32_t)(strWidth * m_outputHScale); | 273 strWidth = (int32_t)(strWidth * m_outputHScale); |
| 278 | 274 |
| 279 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, | 275 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, |
| 280 blank); | 276 blank); |
| 281 if (pOutBitmap) { | 277 if (pOutBitmap) { |
| 282 delete ge.GetBitmap(); | 278 delete ge.GetBitmap(); |
| 283 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); | 279 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); |
| 284 ge.GetBitmap()->Clear(m_backgroundColor); | 280 ge.GetBitmap()->Clear(m_backgroundColor); |
| 285 ge.DrawNormalText(iLen, pCharPos, m_pFont, | 281 ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, |
| 286 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | |
| 287 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); | 282 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); |
| 288 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); | 283 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); |
| 289 } else { | 284 } else { |
| 290 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0, | 285 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0, |
| 291 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); | 286 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); |
| 292 if (matrix) { | 287 if (matrix) { |
| 293 affine_matrix1.Concat(*matrix); | 288 affine_matrix1.Concat(*matrix); |
| 294 } | 289 } |
| 295 device->DrawNormalText( | 290 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, |
| 296 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), | 291 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); |
| 297 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); | |
| 298 } | 292 } |
| 299 FX_Free(pCharPos); | 293 FX_Free(pCharPos); |
| 300 } | 294 } |
| 301 | 295 |
| 302 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents, | 296 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents, |
| 303 uint8_t* code, | 297 uint8_t* code, |
| 304 int32_t codeLength, | 298 int32_t codeLength, |
| 305 FX_BOOL isDevice, | 299 FX_BOOL isDevice, |
| 306 int32_t& e) { | 300 int32_t& e) { |
| 307 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 301 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
| 308 } | 302 } |
| OLD | NEW |