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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 iLen = tempStr.GetLength(); | 140 iLen = tempStr.GetLength(); |
141 int32_t iFontSize = (int32_t)fabs(m_fFontSize); | 141 int32_t iFontSize = (int32_t)fabs(m_fFontSize); |
142 int32_t iTextHeight = iFontSize + 1; | 142 int32_t iTextHeight = iFontSize + 1; |
143 if (!pOutBitmap) { | 143 if (!pOutBitmap) { |
144 CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); | 144 CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); |
145 CFX_FloatRect rect( | 145 CFX_FloatRect rect( |
146 (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), | 146 (FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), |
147 (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); | 147 (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height); |
148 matr.Concat(*matrix); | 148 matr.Concat(*matrix); |
149 matr.TransformRect(rect); | 149 matr.TransformRect(rect); |
150 FX_RECT re = rect.GetOutterRect(); | 150 FX_RECT re = rect.GetOuterRect(); |
151 device->FillRect(&re, m_backgroundColor); | 151 device->FillRect(&re, m_backgroundColor); |
152 CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); | 152 CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); |
153 CFX_FloatRect rect1( | 153 CFX_FloatRect rect1( |
154 (FX_FLOAT)(leftPosition + 40 * multiple), | 154 (FX_FLOAT)(leftPosition + 40 * multiple), |
155 (FX_FLOAT)(m_Height - iTextHeight), | 155 (FX_FLOAT)(m_Height - iTextHeight), |
156 (FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5), | 156 (FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5), |
157 (FX_FLOAT)m_Height); | 157 (FX_FLOAT)m_Height); |
158 matr1.Concat(*matrix); | 158 matr1.Concat(*matrix); |
159 matr1.TransformRect(rect1); | 159 matr1.TransformRect(rect1); |
160 re = rect1.GetOutterRect(); | 160 re = rect1.GetOuterRect(); |
161 device->FillRect(&re, m_backgroundColor); | 161 device->FillRect(&re, m_backgroundColor); |
162 FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7; | 162 FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7; |
163 CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); | 163 CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); |
164 CFX_FloatRect rect2(0.0, (FX_FLOAT)(m_Height - iTextHeight), | 164 CFX_FloatRect rect2(0.0, (FX_FLOAT)(m_Height - iTextHeight), |
165 (FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height); | 165 (FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height); |
166 matr2.Concat(*matrix); | 166 matr2.Concat(*matrix); |
167 matr2.TransformRect(rect2); | 167 matr2.TransformRect(rect2); |
168 re = rect2.GetOutterRect(); | 168 re = rect2.GetOuterRect(); |
169 device->FillRect(&re, m_backgroundColor); | 169 device->FillRect(&re, m_backgroundColor); |
170 CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); | 170 CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0); |
171 CFX_FloatRect rect3( | 171 CFX_FloatRect rect3( |
172 (FX_FLOAT)(leftPosition + 85 * multiple), | 172 (FX_FLOAT)(leftPosition + 85 * multiple), |
173 (FX_FLOAT)(m_Height - iTextHeight), | 173 (FX_FLOAT)(m_Height - iTextHeight), |
174 (FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5), | 174 (FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5), |
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.GetOuterRect(); |
179 device->FillRect(&re, m_backgroundColor); | 179 device->FillRect(&re, m_backgroundColor); |
180 } | 180 } |
181 if (!pOutBitmap) | 181 if (!pOutBitmap) |
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_Matrix 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) { | 187 if (pOutBitmap) { |
188 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); | 188 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 FX_Free(pCharPos); | 277 FX_Free(pCharPos); |
278 } | 278 } |
279 | 279 |
280 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, | 280 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, |
281 uint8_t* code, | 281 uint8_t* code, |
282 int32_t codeLength, | 282 int32_t codeLength, |
283 FX_BOOL isDevice, | 283 FX_BOOL isDevice, |
284 int32_t& e) { | 284 int32_t& e) { |
285 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); | 285 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); |
286 } | 286 } |
OLD | NEW |