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: src/ports/SkFontHost_win.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years, 11 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 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAdvancedTypefaceMetrics.h" 9 #include "SkAdvancedTypefaceMetrics.h"
10 #include "SkBase64.h" 10 #include "SkBase64.h"
(...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 ((LogFontTypeface*)familyMember)->getFamilyName(&familyName); 2479 ((LogFontTypeface*)familyMember)->getFamilyName(&familyName);
2480 return this->matchFamilyStyle(familyName.c_str(), fontstyle); 2480 return this->matchFamilyStyle(familyName.c_str(), fontstyle);
2481 } 2481 }
2482 2482
2483 SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVER RIDE { 2483 SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVER RIDE {
2484 return create_from_stream(stream); 2484 return create_from_stream(stream);
2485 } 2485 }
2486 2486
2487 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE { 2487 SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const SK_OVERRIDE {
2488 // could be in base impl 2488 // could be in base impl
2489 SkAutoTUnref<SkStream> stream(SkNEW_ARGS(SkMemoryStream, (data))); 2489 return this->createFromStream(SkNEW_ARGS(SkMemoryStream, (data)));
2490 return this->createFromStream(stream);
2491 } 2490 }
2492 2491
2493 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERR IDE { 2492 SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const SK_OVERR IDE {
2494 // could be in base impl 2493 // could be in base impl
2495 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 2494 return this->createFromStream(SkStream::NewFromFile(path));
2496 return this->createFromStream(stream);
2497 } 2495 }
2498 2496
2499 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], 2497 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
2500 unsigned styleBits) const SK_OVER RIDE { 2498 unsigned styleBits) const SK_OVER RIDE {
2501 LOGFONT lf; 2499 LOGFONT lf;
2502 if (NULL == familyName) { 2500 if (NULL == familyName) {
2503 lf = get_default_font(); 2501 lf = get_default_font();
2504 } else { 2502 } else {
2505 logfont_for_name(familyName, &lf); 2503 logfont_for_name(familyName, &lf);
2506 } 2504 }
2507 2505
2508 SkTypeface::Style style = (SkTypeface::Style)styleBits; 2506 SkTypeface::Style style = (SkTypeface::Style)styleBits;
2509 lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL; 2507 lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL;
2510 lf.lfItalic = ((style & SkTypeface::kItalic) != 0); 2508 lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
2511 return SkCreateTypefaceFromLOGFONT(lf); 2509 return SkCreateTypefaceFromLOGFONT(lf);
2512 } 2510 }
2513 2511
2514 private: 2512 private:
2515 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2513 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2516 }; 2514 };
2517 2515
2518 /////////////////////////////////////////////////////////////////////////////// 2516 ///////////////////////////////////////////////////////////////////////////////
2519 2517
2520 SkFontMgr* SkFontMgr_New_GDI() { 2518 SkFontMgr* SkFontMgr_New_GDI() {
2521 return SkNEW(SkFontMgrGDI); 2519 return SkNEW(SkFontMgrGDI);
2522 } 2520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698