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

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

Issue 2211143002: Move to SkDataTable::MakeXXX and sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use bare pointer for global. Created 4 years, 4 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/SkFontMgr_fontconfig.cpp ('k') | tests/DataRefTest.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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 #include "SkTypes.h" 7 #include "SkTypes.h"
8 #if defined(SK_BUILD_FOR_WIN32) 8 #if defined(SK_BUILD_FOR_WIN32)
9 9
10 #include "SkDWrite.h" 10 #include "SkDWrite.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 /** localeNameLength must include the null terminator. */ 84 /** localeNameLength must include the null terminator. */
85 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, 85 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection,
86 WCHAR* localeName, int localeNameLength) 86 WCHAR* localeName, int localeNameLength)
87 : fFontCollection(SkRefComPtr(fontCollection)) 87 : fFontCollection(SkRefComPtr(fontCollection))
88 , fLocaleName(localeNameLength) 88 , fLocaleName(localeNameLength)
89 { 89 {
90 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); 90 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR));
91 } 91 }
92 92
93 SkDataTable* getFamilyNames() const override { 93 sk_sp<SkDataTable> getFamilyNames() const override {
94 int count = fFontCollection->GetFontFamilyCount(); 94 int count = fFontCollection->GetFontFamilyCount();
95 95
96 SkDataTableBuilder names(1024); 96 SkDataTableBuilder names(1024);
97 for (int index = 0; index < count; ++index) { 97 for (int index = 0; index < count; ++index) {
98 SkTScopedComPtr<IDWriteFontFamily> fontFamily; 98 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
99 HRNM(fFontCollection->GetFontFamily(index, &fontFamily), 99 HRNM(fFontCollection->GetFontFamily(index, &fontFamily),
100 "Could not get requested family."); 100 "Could not get requested family.");
101 101
102 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; 102 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
103 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family names."); 103 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family names.");
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } else { 481 } else {
482 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N AME_MAX_LENGTH); 482 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N AME_MAX_LENGTH);
483 if (localeNameLen) { 483 if (localeNameLen) {
484 localeName = localeNameStorage; 484 localeName = localeNameStorage;
485 }; 485 };
486 } 486 }
487 487
488 return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeNam e, localeNameLen); 488 return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeNam e, localeNameLen);
489 } 489 }
490 #endif//defined(SK_BUILD_FOR_WIN32) 490 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_fontconfig.cpp ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698