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

Side by Side Diff: xfa/fxbarcode/oned/BC_OnedUPCAWriter.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_OnedEAN8Writer.cpp ('k') | xfa/fxgraphics/cfx_graphics.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 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 if (!pOutBitmap) 184 if (!pOutBitmap)
185 strWidth = strWidth * m_outputHScale; 185 strWidth = strWidth * m_outputHScale;
186 186
187 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank); 187 CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
188 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize); 188 CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
189 CFX_FxgeDevice ge; 189 CFX_FxgeDevice ge;
190 if (pOutBitmap) { 190 if (pOutBitmap) {
191 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); 191 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
192 ge.GetBitmap()->Clear(m_backgroundColor); 192 ge.GetBitmap()->Clear(m_backgroundColor);
193 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize, 193 ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
194 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
194 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 195 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
195 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight); 196 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
196 } else { 197 } else {
197 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 198 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
198 (FX_FLOAT)leftPosition * m_outputHScale, 199 (FX_FLOAT)leftPosition * m_outputHScale,
199 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 200 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
200 if (matrix) { 201 if (matrix) {
201 affine_matrix1.Concat(*matrix); 202 affine_matrix1.Concat(*matrix);
202 } 203 }
203 device->DrawNormalText(iLen, pCharPos + 1, m_pFont, (FX_FLOAT)iFontSize, 204 device->DrawNormalText(
204 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 205 iLen, pCharPos + 1, m_pFont, CFX_GEModule::Get()->GetFontCache(),
206 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
205 } 207 }
206 tempStr = str.Mid(6, 5); 208 tempStr = str.Mid(6, 5);
207 iLen = tempStr.GetLength(); 209 iLen = tempStr.GetLength();
208 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank); 210 CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
209 if (pOutBitmap) { 211 if (pOutBitmap) {
210 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight); 212 FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
211 ge.FillRect(&rect2, m_backgroundColor); 213 ge.FillRect(&rect2, m_backgroundColor);
212 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont, (FX_FLOAT)iFontSize, 214 ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
215 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
213 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 216 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
214 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple, 217 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
215 m_Height - iTextHeight); 218 m_Height - iTextHeight);
216 } else { 219 } else {
217 CFX_Matrix affine_matrix1( 220 CFX_Matrix affine_matrix1(
218 1.0, 0.0, 0.0, -1.0, 221 1.0, 0.0, 0.0, -1.0,
219 (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale, 222 (FX_FLOAT)(leftPosition + 40 * multiple) * m_outputHScale,
220 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 223 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
221 if (matrix) { 224 if (matrix) {
222 affine_matrix1.Concat(*matrix); 225 affine_matrix1.Concat(*matrix);
223 } 226 }
224 device->DrawNormalText(iLen, pCharPos + 6, m_pFont, (FX_FLOAT)iFontSize, 227 device->DrawNormalText(
225 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 228 iLen, pCharPos + 6, m_pFont, CFX_GEModule::Get()->GetFontCache(),
229 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
226 } 230 }
227 tempStr = str.Mid(0, 1); 231 tempStr = str.Mid(0, 1);
228 iLen = tempStr.GetLength(); 232 iLen = tempStr.GetLength();
229 strWidth = (FX_FLOAT)multiple * 7; 233 strWidth = (FX_FLOAT)multiple * 7;
230 if (!pOutBitmap) 234 if (!pOutBitmap)
231 strWidth = strWidth * m_outputHScale; 235 strWidth = strWidth * m_outputHScale;
232 236
233 CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank); 237 CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
234 if (pOutBitmap) { 238 if (pOutBitmap) {
235 delete ge.GetBitmap(); 239 delete ge.GetBitmap();
236 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); 240 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
237 ge.GetBitmap()->Clear(m_backgroundColor); 241 ge.GetBitmap()->Clear(m_backgroundColor);
238 ge.DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, 242 ge.DrawNormalText(iLen, pCharPos, m_pFont,
243 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
239 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 244 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
240 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight); 245 geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
241 } else { 246 } else {
242 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0, 247 CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
243 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 248 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
244 if (matrix) { 249 if (matrix) {
245 affine_matrix1.Concat(*matrix); 250 affine_matrix1.Concat(*matrix);
246 } 251 }
247 device->DrawNormalText(iLen, pCharPos, m_pFont, (FX_FLOAT)iFontSize, 252 device->DrawNormalText(
248 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 253 iLen, pCharPos, m_pFont, CFX_GEModule::Get()->GetFontCache(),
254 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
249 } 255 }
250 tempStr = str.Mid(11, 1); 256 tempStr = str.Mid(11, 1);
251 iLen = tempStr.GetLength(); 257 iLen = tempStr.GetLength();
252 CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank); 258 CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
253 if (pOutBitmap) { 259 if (pOutBitmap) {
254 delete ge.GetBitmap(); 260 delete ge.GetBitmap();
255 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr); 261 ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
256 ge.GetBitmap()->Clear(m_backgroundColor); 262 ge.GetBitmap()->Clear(m_backgroundColor);
257 ge.DrawNormalText(iLen, pCharPos + 11, m_pFont, (FX_FLOAT)iFontSize, 263 ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
264 CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
258 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE); 265 &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
259 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple, 266 geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
260 m_Height - iTextHeight); 267 m_Height - iTextHeight);
261 } else { 268 } else {
262 CFX_Matrix affine_matrix1( 269 CFX_Matrix affine_matrix1(
263 1.0, 0.0, 0.0, -1.0, 270 1.0, 0.0, 0.0, -1.0,
264 (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale, 271 (FX_FLOAT)(leftPosition + 85 * multiple) * m_outputHScale,
265 (FX_FLOAT)(m_Height - iTextHeight + iFontSize)); 272 (FX_FLOAT)(m_Height - iTextHeight + iFontSize));
266 if (matrix) { 273 if (matrix) {
267 affine_matrix1.Concat(*matrix); 274 affine_matrix1.Concat(*matrix);
268 } 275 }
269 device->DrawNormalText(iLen, pCharPos + 11, m_pFont, (FX_FLOAT)iFontSize, 276 device->DrawNormalText(
270 &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE); 277 iLen, pCharPos + 11, m_pFont, CFX_GEModule::Get()->GetFontCache(),
278 (FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
271 } 279 }
272 FX_Free(pCharPos); 280 FX_Free(pCharPos);
273 } 281 }
274 282
275 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents, 283 void CBC_OnedUPCAWriter::RenderResult(const CFX_WideStringC& contents,
276 uint8_t* code, 284 uint8_t* code,
277 int32_t codeLength, 285 int32_t codeLength,
278 FX_BOOL isDevice, 286 FX_BOOL isDevice,
279 int32_t& e) { 287 int32_t& e) {
280 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e); 288 CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
281 } 289 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp ('k') | xfa/fxgraphics/cfx_graphics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698