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

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

Issue 2158023002: Pdfium: Fix fonts leaking on ClosePage. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix xfa tests. 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
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 2011 ZXing authors 8 * Copyright 2011 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 rect.right -= 1; 212 rect.right -= 1;
213 } 213 }
214 matrix->TransformRect(rect); 214 matrix->TransformRect(rect);
215 FX_RECT re = rect.GetOuterRect(); 215 FX_RECT re = rect.GetOuterRect();
216 device->FillRect(&re, m_backgroundColor); 216 device->FillRect(&re, m_backgroundColor);
217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX, 217 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (FX_FLOAT)locX,
218 (FX_FLOAT)(locY + iFontSize)); 218 (FX_FLOAT)(locY + iFontSize));
219 if (matrix) { 219 if (matrix) {
220 affine_matrix.Concat(*matrix); 220 affine_matrix.Concat(*matrix);
221 } 221 }
222 device->DrawNormalText( 222 device->DrawNormalText(str.GetLength(), pCharPos, m_pFont,
223 str.GetLength(), pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(), 223 (FX_FLOAT)iFontSize, &affine_matrix, m_fontColor,
224 (FX_FLOAT)iFontSize, &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 224 FXTEXT_CLEARTYPE);
225 } 225 }
226 226
227 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap, 227 void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
228 const CFX_ByteString str, 228 const CFX_ByteString str,
229 FX_FLOAT geWidth, 229 FX_FLOAT geWidth,
230 FXTEXT_CHARPOS* pCharPos, 230 FXTEXT_CHARPOS* pCharPos,
231 FX_FLOAT locX, 231 FX_FLOAT locX,
232 FX_FLOAT locY, 232 FX_FLOAT locY,
233 int32_t barWidth) { 233 int32_t barWidth) {
234 int32_t iFontSize = (int32_t)fabs(m_fFontSize); 234 int32_t iFontSize = (int32_t)fabs(m_fFontSize);
235 int32_t iTextHeight = iFontSize + 1; 235 int32_t iTextHeight = iFontSize + 1;
236 CFX_FxgeDevice ge; 236 CFX_FxgeDevice ge;
237 ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr); 237 ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
238 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight); 238 FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
239 ge.FillRect(&geRect, m_backgroundColor); 239 ge.FillRect(&geRect, m_backgroundColor);
240 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); 240 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
241 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, 241 ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, (FX_FLOAT)iFontSize,
242 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
243 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 242 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
244 CFX_FxgeDevice geBitmap; 243 CFX_FxgeDevice geBitmap;
245 geBitmap.Attach(pOutBitmap, false, nullptr, false); 244 geBitmap.Attach(pOutBitmap, false, nullptr, false);
246 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY); 245 geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
247 } 246 }
248 247
249 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents, 248 void CBC_OneDimWriter::ShowChars(const CFX_WideStringC& contents,
250 CFX_DIBitmap* pOutBitmap, 249 CFX_DIBitmap* pOutBitmap,
251 CFX_RenderDevice* device, 250 CFX_RenderDevice* device,
252 const CFX_Matrix* matrix, 251 const CFX_Matrix* matrix,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 467
469 CFX_WideString CBC_OneDimWriter::FilterContents( 468 CFX_WideString CBC_OneDimWriter::FilterContents(
470 const CFX_WideStringC& contents) { 469 const CFX_WideStringC& contents) {
471 return CFX_WideString(); 470 return CFX_WideString();
472 } 471 }
473 472
474 CFX_WideString CBC_OneDimWriter::RenderTextContents( 473 CFX_WideString CBC_OneDimWriter::RenderTextContents(
475 const CFX_WideStringC& contents) { 474 const CFX_WideStringC& contents) {
476 return CFX_WideString(); 475 return CFX_WideString();
477 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698