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

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

Issue 2350763002: Revert of Pdfium: Fix fonts leaking on ClosePage. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: 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, (FX_FLOAT)iFontSize, 225 ge.DrawNormalText(iLen, pCharPos, m_pFont,
226 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
226 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 227 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
227 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); 228 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
228 } else { 229 } else {
229 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 230 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
230 (FX_FLOAT)leftPosition * m_outputHScale, 231 (FX_FLOAT)leftPosition * m_outputHScale,
231 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 232 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
232 affine_matrix1.Concat(*matrix); 233 affine_matrix1.Concat(*matrix);
233 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, 234 device->DrawNormalText(
234 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 235 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(),
236 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
235 } 237 }
236 tempStr = str.Mid(4, 4); 238 tempStr = str.Mid(4, 4);
237 iLen = tempStr.GetLength(); 239 iLen = tempStr.GetLength();
238 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize, 240 CalcTextInfo(tempStr, pCharPos + 4, m_pFont, (FX_FLOAT)strWidth, iFontSize,
239 blank); 241 blank);
240 if (pOutBitmap) { 242 if (pOutBitmap) {
241 delete ge.GetBitmap(); 243 delete ge.GetBitmap();
242 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr); 244 ge.Create(strWidth, iTextHeight, FXDIB_Argb, nullptr);
243 ge.GetBitmap()->Clear(m_backgroundColor); 245 ge.GetBitmap()->Clear(m_backgroundColor);
244 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize, 246 ge.DrawNormalText(iLen, pCharPos + 4, m_pFont,
247 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
245 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 248 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
246 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple, 249 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 33 * multiple,
247 m_Height - iTextHeight); 250 m_Height - iTextHeight);
248 } else { 251 } else {
249 CFX_Matrix affine_matrix1( 252 CFX_Matrix affine_matrix1(
250 1.0, 0.0, 0.0, -1.0, 253 1.0, 0.0, 0.0, -1.0,
251 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale, 254 (FX_FLOAT)(leftPosition + 33 * multiple) * m_outputHScale,
252 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 255 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
253 if (matrix) { 256 if (matrix) {
254 affine_matrix1.Concat(*matrix); 257 affine_matrix1.Concat(*matrix);
255 } 258 }
256 device->DrawNormalText(iLen, pCharPos + 4, m_pFont, (FX_FLOAT)iFontSize, 259 device->DrawNormalText(
257 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 260 iLen, pCharPos + 4, m_pFont, CFX_GEModule::Get()->GetFontCache(),
261 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
258 } 262 }
259 FX_Free(pCharPos); 263 FX_Free(pCharPos);
260 } 264 }
261 265
262 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents, 266 void CBC_OnedEAN8Writer::RenderResult(const CFX_WideStringC& contents,
263 uint8_t* code, 267 uint8_t* code,
264 int32_t codeLength, 268 int32_t codeLength,
265 FX_BOOL isDevice, 269 FX_BOOL isDevice,
266 int32_t& e) { 270 int32_t& e) {
267 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); 271 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
268 } 272 }
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