Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp

Issue 2055103002: remove redundant CFX_Matrix* cast in one-d barcode (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/oned/BC_OneDimWriter.cpp ('k') | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, 215 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize,
216 blank); 216 blank);
217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); 217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
218 CFX_FxgeDevice ge; 218 CFX_FxgeDevice ge;
219 if (pOutBitmap) { 219 if (pOutBitmap) {
220 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); 220 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
221 FX_RECT rect(0, 0, strWidth, iTextHeight); 221 FX_RECT rect(0, 0, strWidth, iTextHeight);
222 ge.FillRect(&rect, m_backgroundColor); 222 ge.FillRect(&rect, m_backgroundColor);
223 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, 223 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
224 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, 224 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
225 (CFX_Matrix*)&affine_matrix, m_fontColor, 225 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
226 FXTEXT_CLEARTYPE);
227 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); 226 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
228 } else { 227 } else {
229 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 228 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
230 (FX_FLOAT)leftPosition * m_outputHScale, 229 (FX_FLOAT)leftPosition * m_outputHScale,
231 (FX_FLOAT)(m_Height - iTextHeight) + iFontSize); 230 (FX_FLOAT)(m_Height - iTextHeight) + iFontSize);
232 if (matrix) { 231 if (matrix) {
233 affine_matrix1.Concat(*matrix); 232 affine_matrix1.Concat(*matrix);
234 } 233 }
235 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, 234 device->DrawNormalText(
236 CFX_GEModule::Get()->GetFontCache(), 235 iLen, pCharPos + 1, m_pFont, CFX_GEModule::Get()->GetFontCache(),
237 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, 236 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
238 m_fontColor, FXTEXT_CLEARTYPE);
239 } 237 }
240 tempStr = str.Mid(7, 6); 238 tempStr = str.Mid(7, 6);
241 iLen = tempStr.GetLength(); 239 iLen = tempStr.GetLength();
242 CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize, 240 CalcTextInfo(tempStr, pCharPos + 7, m_pFont, (FX_FLOAT)strWidth, iFontSize,
243 blank); 241 blank);
244 if (pOutBitmap) { 242 if (pOutBitmap) {
245 FX_RECT rect1(0, 0, strWidth, iTextHeight); 243 FX_RECT rect1(0, 0, strWidth, iTextHeight);
246 ge.FillRect(&rect1, m_backgroundColor); 244 ge.FillRect(&rect1, m_backgroundColor);
247 ge.DrawNormalText(iLen, pCharPos + 7, m_pFont, 245 ge.DrawNormalText(iLen, pCharPos + 7, m_pFont,
248 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, 246 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
249 (CFX_Matrix*)&affine_matrix, m_fontColor, 247 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
250 FXTEXT_CLEARTYPE);
251 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple, 248 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 47 * multiple,
252 m_Height - iTextHeight); 249 m_Height - iTextHeight);
253 } else { 250 } else {
254 CFX_Matrix affine_matrix1( 251 CFX_Matrix affine_matrix1(
255 1.0, 0.0, 0.0, -1.0, 252 1.0, 0.0, 0.0, -1.0,
256 (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale, 253 (FX_FLOAT)(leftPosition + 47 * multiple) * m_outputHScale,
257 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 254 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
258 if (matrix) { 255 if (matrix) {
259 affine_matrix1.Concat(*matrix); 256 affine_matrix1.Concat(*matrix);
260 } 257 }
261 device->DrawNormalText(iLen, pCharPos + 7, m_pFont, 258 device->DrawNormalText(
262 CFX_GEModule::Get()->GetFontCache(), 259 iLen, pCharPos + 7, m_pFont, CFX_GEModule::Get()->GetFontCache(),
263 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, 260 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
264 m_fontColor, FXTEXT_CLEARTYPE);
265 } 261 }
266 tempStr = str.Mid(0, 1); 262 tempStr = str.Mid(0, 1);
267 iLen = tempStr.GetLength(); 263 iLen = tempStr.GetLength();
268 strWidth = multiple * 7; 264 strWidth = multiple * 7;
269 if (!pOutBitmap) 265 if (!pOutBitmap)
270 strWidth = (int32_t)(strWidth * m_outputHScale); 266 strWidth = (int32_t)(strWidth * m_outputHScale);
271 267
272 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, 268 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize,
273 blank); 269 blank);
274 if (pOutBitmap) { 270 if (pOutBitmap) {
275 delete ge.GetBitmap(); 271 delete ge.GetBitmap();
276 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); 272 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
277 ge.GetBitmap()->Clear(m_backgroundColor); 273 ge.GetBitmap()->Clear(m_backgroundColor);
278 ge.DrawNormalText(iLen, pCharPos, m_pFont, 274 ge.DrawNormalText(iLen, pCharPos, m_pFont,
279 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize, 275 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
280 (CFX_Matrix*)&affine_matrix, m_fontColor, 276 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
281 FXTEXT_CLEARTYPE);
282 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); 277 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
283 } else { 278 } else {
284 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0, 279 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0.0,
285 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 280 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
286 if (matrix) { 281 if (matrix) {
287 affine_matrix1.Concat(*matrix); 282 affine_matrix1.Concat(*matrix);
288 } 283 }
289 device->DrawNormalText(iLen, pCharPos, m_pFont, 284 device->DrawNormalText(
290 CFX_GEModule::Get()->GetFontCache(), 285 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(),
291 (FX_FLOAT)iFontSize, (CFX_Matrix*)&affine_matrix1, 286 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
292 m_fontColor, FXTEXT_CLEARTYPE);
293 } 287 }
294 FX_Free(pCharPos); 288 FX_Free(pCharPos);
295 } 289 }
296 290
297 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents, 291 void CBC_OnedEAN13Writer::RenderResult(const CFX_WideStringC& contents,
298 uint8_t* code, 292 uint8_t* code,
299 int32_t codeLength, 293 int32_t codeLength,
300 FX_BOOL isDevice, 294 FX_BOOL isDevice,
301 int32_t& e) { 295 int32_t& e) {
302 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); 296 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
303 } 297 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/oned/BC_OneDimWriter.cpp ('k') | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698