| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 int32_t iLen = str.GetLength(); | 123 int32_t iLen = str.GetLength(); |
| 124 FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); | 124 FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen); |
| 125 FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); | 125 FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen); |
| 126 CFX_ByteString tempStr = str.Mid(1, 5); | 126 CFX_ByteString tempStr = str.Mid(1, 5); |
| 127 FX_FLOAT strWidth = (FX_FLOAT)35 * multiple; | 127 FX_FLOAT strWidth = (FX_FLOAT)35 * multiple; |
| 128 FX_FLOAT blank = 0.0; | 128 FX_FLOAT blank = 0.0; |
| 129 CFX_FxgeDevice geBitmap; | 129 CFX_FxgeDevice geBitmap; |
| 130 if (pOutBitmap) { | 130 if (pOutBitmap) { |
| 131 geBitmap.Attach(pOutBitmap); | 131 geBitmap.Attach(pOutBitmap); |
| 132 } | 132 } |
| 133 FX_FLOAT charsWidth = 0; | |
| 134 iLen = tempStr.GetLength(); | 133 iLen = tempStr.GetLength(); |
| 135 int32_t iFontSize = (int32_t)fabs(m_fFontSize); | 134 int32_t iFontSize = (int32_t)fabs(m_fFontSize); |
| 136 int32_t iTextHeight = iFontSize + 1; | 135 int32_t iTextHeight = iFontSize + 1; |
| 137 if (pOutBitmap == NULL) { | 136 if (pOutBitmap == NULL) { |
| 138 CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); | 137 CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); |
| 139 CFX_FloatRect rect( | 138 CFX_FloatRect rect( |
| 140 (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), | 139 (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), |
| 141 (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); | 140 (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); |
| 142 matr.Concat(*matrix); | 141 matr.Concat(*matrix); |
| 143 matr.TransformRect(rect); | 142 matr.TransformRect(rect); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 if (matrix) { | 192 if (matrix) { |
| 194 affine_matrix1.Concat(*matrix); | 193 affine_matrix1.Concat(*matrix); |
| 195 } | 194 } |
| 196 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, | 195 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, |
| 197 CFX_GEModule::Get()->GetFontCache(), | 196 CFX_GEModule::Get()->GetFontCache(), |
| 198 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, | 197 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, |
| 199 m_fontColor, FXTEXT_CLEARTYPE); | 198 m_fontColor, FXTEXT_CLEARTYPE); |
| 200 } | 199 } |
| 201 tempStr = str.Mid(6, 5); | 200 tempStr = str.Mid(6, 5); |
| 202 iLen = tempStr.GetLength(); | 201 iLen = tempStr.GetLength(); |
| 203 charsWidth = 0.0f; | |
| 204 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank); | 202 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank); |
| 205 if (pOutBitmap) { | 203 if (pOutBitmap) { |
| 206 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); | 204 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); |
| 207 ge.FillRect(&rect2, m_backgroundColor); | 205 ge.FillRect(&rect2, m_backgroundColor); |
| 208 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, | 206 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, |
| 209 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, | 207 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, |
| 210 (CFX_Matrix*)&affine_matrix, m_fontColor, | 208 (CFX_Matrix*)&affine_matrix, m_fontColor, |
| 211 FXTEXT_CLEARTYPE); | 209 FXTEXT_CLEARTYPE); |
| 212 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, | 210 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, |
| 213 m_Height - iTextHeight); | 211 m_Height - iTextHeight); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 277 } |
| 280 FX_Free(pCharPos); | 278 FX_Free(pCharPos); |
| 281 } | 279 } |
| 282 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, | 280 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, |
| 283 uint8_t* code, | 281 uint8_t* code, |
| 284 int32_t codeLength, | 282 int32_t codeLength, |
| 285 FX_BOOL isDevice, | 283 FX_BOOL isDevice, |
| 286 int32_t& e) { | 284 int32_t& e) { |
| 287 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 285 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
| 288 } | 286 } |
| OLD | NEW |