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

Side by Side Diff: src/ports/SkFontHost_win.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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 | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.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 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBase64.h" 9 #include "SkBase64.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 } 2270 }
2271 2271
2272 SelectObject(hdc, savefont); 2272 SelectObject(hdc, savefont);
2273 DeleteObject(font); 2273 DeleteObject(font);
2274 DeleteDC(hdc); 2274 DeleteDC(hdc);
2275 2275
2276 return bufferSize == GDI_ERROR ? 0 : bufferSize; 2276 return bufferSize == GDI_ERROR ? 0 : bufferSize;
2277 } 2277 }
2278 2278
2279 SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc ) const { 2279 SkScalerContext* LogFontTypeface::onCreateScalerContext(const SkDescriptor* desc ) const {
2280 SkScalerContext_GDI* ctx = SkNEW_ARGS(SkScalerContext_GDI, 2280 SkScalerContext_GDI* ctx = new SkScalerContext_GDI(const_cast<LogFontTypefac e*>(this), desc);
2281 (const_cast<LogFontTypeface*>(th is), desc));
2282 if (!ctx->isValid()) { 2281 if (!ctx->isValid()) {
2283 SkDELETE(ctx); 2282 delete ctx;
2284 ctx = NULL; 2283 ctx = NULL;
2285 } 2284 }
2286 return ctx; 2285 return ctx;
2287 } 2286 }
2288 2287
2289 void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const { 2288 void LogFontTypeface::onFilterRec(SkScalerContextRec* rec) const {
2290 if (rec->fFlags & SkScalerContext::kLCD_BGROrder_Flag || 2289 if (rec->fFlags & SkScalerContext::kLCD_BGROrder_Flag ||
2291 rec->fFlags & SkScalerContext::kLCD_Vertical_Flag) 2290 rec->fFlags & SkScalerContext::kLCD_Vertical_Flag)
2292 { 2291 {
2293 rec->fMaskFormat = SkMask::kA8_Format; 2292 rec->fMaskFormat = SkMask::kA8_Format;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 return fLogFontArray.count(); 2434 return fLogFontArray.count();
2436 } 2435 }
2437 2436
2438 void onGetFamilyName(int index, SkString* familyName) const override { 2437 void onGetFamilyName(int index, SkString* familyName) const override {
2439 SkASSERT((unsigned)index < (unsigned)fLogFontArray.count()); 2438 SkASSERT((unsigned)index < (unsigned)fLogFontArray.count());
2440 tchar_to_skstring(fLogFontArray[index].elfLogFont.lfFaceName, familyName ); 2439 tchar_to_skstring(fLogFontArray[index].elfLogFont.lfFaceName, familyName );
2441 } 2440 }
2442 2441
2443 SkFontStyleSet* onCreateStyleSet(int index) const override { 2442 SkFontStyleSet* onCreateStyleSet(int index) const override {
2444 SkASSERT((unsigned)index < (unsigned)fLogFontArray.count()); 2443 SkASSERT((unsigned)index < (unsigned)fLogFontArray.count());
2445 return SkNEW_ARGS(SkFontStyleSetGDI, (fLogFontArray[index].elfLogFont.lf FaceName)); 2444 return new SkFontStyleSetGDI(fLogFontArray[index].elfLogFont.lfFaceName) ;
2446 } 2445 }
2447 2446
2448 SkFontStyleSet* onMatchFamily(const char familyName[]) const override { 2447 SkFontStyleSet* onMatchFamily(const char familyName[]) const override {
2449 if (NULL == familyName) { 2448 if (NULL == familyName) {
2450 familyName = ""; // do we need this check??? 2449 familyName = ""; // do we need this check???
2451 } 2450 }
2452 LOGFONT lf; 2451 LOGFONT lf;
2453 logfont_for_name(familyName, &lf); 2452 logfont_for_name(familyName, &lf);
2454 return SkNEW_ARGS(SkFontStyleSetGDI, (lf.lfFaceName)); 2453 return new SkFontStyleSetGDI(lf.lfFaceName);
2455 } 2454 }
2456 2455
2457 virtual SkTypeface* onMatchFamilyStyle(const char familyName[], 2456 virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
2458 const SkFontStyle& fontstyle) const o verride { 2457 const SkFontStyle& fontstyle) const o verride {
2459 // could be in base impl 2458 // could be in base impl
2460 SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName)); 2459 SkAutoTUnref<SkFontStyleSet> sset(this->matchFamily(familyName));
2461 return sset->matchStyle(fontstyle); 2460 return sset->matchStyle(fontstyle);
2462 } 2461 }
2463 2462
2464 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&, 2463 virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], con st SkFontStyle&,
(...skipping 10 matching lines...) Expand all
2475 return this->matchFamilyStyle(familyName.c_str(), fontstyle); 2474 return this->matchFamilyStyle(familyName.c_str(), fontstyle);
2476 } 2475 }
2477 2476
2478 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override { 2477 SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) cons t override {
2479 SkAutoTDelete<SkStreamAsset> stream(bareStream); 2478 SkAutoTDelete<SkStreamAsset> stream(bareStream);
2480 return create_from_stream(stream); 2479 return create_from_stream(stream);
2481 } 2480 }
2482 2481
2483 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override { 2482 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
2484 // could be in base impl 2483 // could be in base impl
2485 return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data))); 2484 return this->createFromStream(new SkMemoryStream(data));
2486 } 2485 }
2487 2486
2488 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override { 2487 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
2489 // could be in base impl 2488 // could be in base impl
2490 return this->createFromStream(SkStream::NewFromFile(path)); 2489 return this->createFromStream(SkStream::NewFromFile(path));
2491 } 2490 }
2492 2491
2493 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 2492 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
2494 unsigned styleBits) const overrid e { 2493 unsigned styleBits) const overrid e {
2495 LOGFONT lf; 2494 LOGFONT lf;
2496 if (NULL == familyName) { 2495 if (NULL == familyName) {
2497 lf = get_default_font(); 2496 lf = get_default_font();
2498 } else { 2497 } else {
2499 logfont_for_name(familyName, &lf); 2498 logfont_for_name(familyName, &lf);
2500 } 2499 }
2501 2500
2502 SkTypeface::Style style = (SkTypeface::Style)styleBits; 2501 SkTypeface::Style style = (SkTypeface::Style)styleBits;
2503 lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL; 2502 lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL;
2504 lf.lfItalic = ((style & SkTypeface::kItalic) != 0); 2503 lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
2505 return SkCreateTypefaceFromLOGFONT(lf); 2504 return SkCreateTypefaceFromLOGFONT(lf);
2506 } 2505 }
2507 2506
2508 private: 2507 private:
2509 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2508 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2510 }; 2509 };
2511 2510
2512 /////////////////////////////////////////////////////////////////////////////// 2511 ///////////////////////////////////////////////////////////////////////////////
2513 2512
2514 SkFontMgr* SkFontMgr_New_GDI() { 2513 SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
2515 return SkNEW(SkFontMgrGDI);
2516 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698