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

Side by Side Diff: core/src/fxge/android/fpf_skiafontmgr.cpp

Issue 1084613006: Fix all remaining instances of FX_NEW. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: std::min Created 5 years, 8 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 | « core/src/fxge/agg/agg23/fx_agg_driver.cpp ('k') | core/src/fxge/android/fpf_skiamodule.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 6
7 #include "fx_fpf.h" 7 #include "fx_fpf.h"
8 #if _FX_OS_ == _FX_ANDROID_ 8 #if _FX_OS_ == _FX_ANDROID_
9 #define FPF_SKIAMATCHWEIGHT_NAME1 62 9 #define FPF_SKIAMATCHWEIGHT_NAME1 62
10 #define FPF_SKIAMATCHWEIGHT_NAME2 60 10 #define FPF_SKIAMATCHWEIGHT_NAME2 60
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 nMax = nFind; 345 nMax = nFind;
346 nItem = i; 346 nItem = i;
347 } 347 }
348 if (nExpectVal <= nFind) { 348 if (nExpectVal <= nFind) {
349 nItem = i; 349 nItem = i;
350 break; 350 break;
351 } 351 }
352 } 352 }
353 if (nItem > -1) { 353 if (nItem > -1) {
354 CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFace s.ElementAt(nItem); 354 CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFace s.ElementAt(nItem);
355 CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; 355 CFPF_SkiaFont *pFont = new CFPF_SkiaFont;
356 if (pFont) { 356 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) {
357 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset) ) { 357 m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont);
358 m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); 358 return pFont->Retain();
359 return pFont->Retain();
360 }
361 pFont->Release();
362 pFont = NULL;
363 } 359 }
364 return pFont; 360 pFont->Release();
365 } 361 }
366 return NULL; 362 return NULL;
367 } 363 }
368 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI ndex) 364 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI ndex)
369 { 365 {
370 if (!pFileRead) { 366 if (!pFileRead) {
371 return NULL; 367 return NULL;
372 } 368 }
373 if (pFileRead->GetSize() == 0) { 369 if (pFileRead->GetSize() == 0) {
374 return NULL; 370 return NULL;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } else { 453 } else {
458 ScanFile(fullpath); 454 ScanFile(fullpath);
459 } 455 }
460 } 456 }
461 FX_CloseFolder(handle); 457 FX_CloseFolder(handle);
462 } 458 }
463 void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) 459 void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file)
464 { 460 {
465 FXFT_Face face = GetFontFace(file); 461 FXFT_Face face = GetFontFace(file);
466 if (face) { 462 if (face) {
467 CFPF_SkiaPathFont *pFontDesc = FX_NEW CFPF_SkiaPathFont; 463 CFPF_SkiaPathFont *pFontDesc = new CFPF_SkiaPathFont;
468 if (!pFontDesc) {
469 return;
470 }
471 pFontDesc->SetPath(file.GetCStr()); 464 pFontDesc->SetPath(file.GetCStr());
472 ReportFace(face, pFontDesc); 465 ReportFace(face, pFontDesc);
473 m_FontFaces.Add(pFontDesc); 466 m_FontFaces.Add(pFontDesc);
474 FXFT_Done_Face(face); 467 FXFT_Done_Face(face);
475 } 468 }
476 } 469 }
477 static const FX_DWORD g_FPFSkiaFontCharsets [] = { 470 static const FX_DWORD g_FPFSkiaFontCharsets [] = {
478 FPF_SKIACHARSET_Ansi, 471 FPF_SKIACHARSET_Ansi,
479 FPF_SKIACHARSET_EeasternEuropean, 472 FPF_SKIACHARSET_EeasternEuropean,
480 FPF_SKIACHARSET_Cyrillic, 473 FPF_SKIACHARSET_Cyrillic,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; 545 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC;
553 } 546 }
554 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); 547 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2);
555 pFontDesc->m_iFaceIndex = face->face_index; 548 pFontDesc->m_iFaceIndex = face->face_index;
556 pFontDesc->m_iGlyphNum = face->num_glyphs; 549 pFontDesc->m_iGlyphNum = face->num_glyphs;
557 } 550 }
558 void CFPF_SkiaFontMgr::OutputSystemFonts() 551 void CFPF_SkiaFontMgr::OutputSystemFonts()
559 { 552 {
560 } 553 }
561 #endif 554 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/agg/agg23/fx_agg_driver.cpp ('k') | core/src/fxge/android/fpf_skiamodule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698