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

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

Issue 2350243002: Make CFX_FontCache global (Closed)
Patch Set: Remove fix leaks code. Created 4 years, 3 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_OnedEAN13Writer.cpp ('k') | xfa/fxbarcode/oned/BC_OnedUPCAWriter.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 strWidth = (int32_t)(strWidth * m_outputHScale); 215 strWidth = (int32_t)(strWidth * m_outputHScale);
216 216
217 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, 217 CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize,
218 blank); 218 blank);
219 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); 219 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
220 CFX_FxgeDevice ge; 220 CFX_FxgeDevice ge;
221 if (pOutBitmap) { 221 if (pOutBitmap) {
222 delete ge.GetBitmap(); 222 delete ge.GetBitmap();
223 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); 223 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
224 ge.GetBitmap()->Clear(m_backgroundColor); 224 ge.GetBitmap()->Clear(m_backgroundColor);
225 ge.DrawNormalText(iLen, pCharPos, m_pFont, 225 ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
226 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
227 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 226 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
228 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); 227 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
229 } else { 228 } else {
230 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 229 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
231 (FX_FLOAT)leftPosition * m_outputHScale, 230 (FX_FLOAT)leftPosition * m_outputHScale,
232 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 231 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
233 affine_matrix1.Concat(*matrix); 232 affine_matrix1.Concat(*matrix);
234 device->DrawNormalText( 233 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize,
235 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), 234 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
236 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
237 } 235 }
238 tempStr = str.Mid(4, 4); 236 tempStr = str.Mid(4, 4);
239 iLen = tempStr.GetLength(); 237 iLen = tempStr.GetLength();
240 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, 238 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize,
241 blank); 239 blank);
242 if (pOutBitmap) { 240 if (pOutBitmap) {
243 delete ge.GetBitmap(); 241 delete ge.GetBitmap();
244 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); 242 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
245 ge.GetBitmap()->Clear(m_backgroundColor); 243 ge.GetBitmap()->Clear(m_backgroundColor);
246 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, 244 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize,
247 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
248 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 245 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
249 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple, 246 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
250 m_Height - iTextHeight); 247 m_Height - iTextHeight);
251 } else { 248 } else {
252 CFX_Matrix affine_matrix1( 249 CFX_Matrix affine_matrix1(
253 1.0, 0.0, 0.0, -1.0, 250 1.0, 0.0, 0.0, -1.0,
254 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, 251 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale,
255 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 252 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
256 if (matrix) { 253 if (matrix) {
257 affine_matrix1.Concat(*matrix); 254 affine_matrix1.Concat(*matrix);
258 } 255 }
259 device->DrawNormalText( 256 device->DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize,
260 iLen, pCharPos + 4, m_pFont, CFX_GEModule::Get()->GetFontCache(), 257 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
261 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
262 } 258 }
263 FX_Free(pCharPos); 259 FX_Free(pCharPos);
264 } 260 }
265 261
266 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, 262 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents,
267 uint8_t* code, 263 uint8_t* code,
268 int32_t codeLength, 264 int32_t codeLength,
269 FX_BOOL isDevice, 265 FX_BOOL isDevice,
270 int32_t& e) { 266 int32_t& e) {
271 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); 267 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
272 } 268 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp ('k') | xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698