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