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

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

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (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
« no previous file with comments | « src/ports/SkImageDecoder_WIC.cpp ('k') | src/ports/SkScalerContext_win_dw.h » ('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 7
8 #include "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkDWrite.h" 9 #include "SkDWrite.h"
10 #include "SkDWriteFontFileStream.h" 10 #include "SkDWriteFontFileStream.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 /** localeNameLength must include the null terminator. */ 106 /** localeNameLength must include the null terminator. */
107 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection, 107 SkRemotableFontMgr_DirectWrite(IDWriteFontCollection* fontCollection,
108 WCHAR* localeName, int localeNameLength) 108 WCHAR* localeName, int localeNameLength)
109 : fFontCollection(SkRefComPtr(fontCollection)) 109 : fFontCollection(SkRefComPtr(fontCollection))
110 , fLocaleName(localeNameLength) 110 , fLocaleName(localeNameLength)
111 { 111 {
112 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR)); 112 memcpy(fLocaleName.get(), localeName, localeNameLength * sizeof(WCHAR));
113 } 113 }
114 114
115 virtual SkDataTable* getFamilyNames() const SK_OVERRIDE { 115 SkDataTable* getFamilyNames() const SK_OVERRIDE {
116 int count = fFontCollection->GetFontFamilyCount(); 116 int count = fFontCollection->GetFontFamilyCount();
117 117
118 SkDataTableBuilder names(1024); 118 SkDataTableBuilder names(1024);
119 for (int index = 0; index < count; ++index) { 119 for (int index = 0; index < count; ++index) {
120 SkTScopedComPtr<IDWriteFontFamily> fontFamily; 120 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
121 HRNM(fFontCollection->GetFontFamily(index, &fontFamily), 121 HRNM(fFontCollection->GetFontFamily(index, &fontFamily),
122 "Could not get requested family."); 122 "Could not get requested family.");
123 123
124 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; 124 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames;
125 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family names."); 125 HRNM(fontFamily->GetFamilyNames(&familyNames), "Could not get family names.");
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 SkASSERT(false); 172 SkASSERT(false);
173 } 173 }
174 174
175 int weight = font->GetWeight(); 175 int weight = font->GetWeight();
176 int width = font->GetStretch(); 176 int width = font->GetStretch();
177 177
178 fontId->fFontStyle = SkFontStyle(weight, width, slant); 178 fontId->fFontStyle = SkFontStyle(weight, width, slant);
179 return S_OK; 179 return S_OK;
180 } 180 }
181 181
182 virtual SkRemotableFontIdentitySet* getIndex(int familyIndex) const SK_OVERR IDE { 182 SkRemotableFontIdentitySet* getIndex(int familyIndex) const SK_OVERRIDE {
183 SkTScopedComPtr<IDWriteFontFamily> fontFamily; 183 SkTScopedComPtr<IDWriteFontFamily> fontFamily;
184 HRNM(fFontCollection->GetFontFamily(familyIndex, &fontFamily), 184 HRNM(fFontCollection->GetFontFamily(familyIndex, &fontFamily),
185 "Could not get requested family."); 185 "Could not get requested family.");
186 186
187 int count = fontFamily->GetFontCount(); 187 int count = fontFamily->GetFontCount();
188 SkFontIdentity* fontIds; 188 SkFontIdentity* fontIds;
189 SkAutoTUnref<SkRemotableFontIdentitySet> fontIdSet( 189 SkAutoTUnref<SkRemotableFontIdentitySet> fontIdSet(
190 new SkRemotableFontIdentitySet(count, &fontIds)); 190 new SkRemotableFontIdentitySet(count, &fontIds));
191 for (int fontIndex = 0; fontIndex < count; ++fontIndex) { 191 for (int fontIndex = 0; fontIndex < count; ++fontIndex) {
192 SkTScopedComPtr<IDWriteFont> font; 192 SkTScopedComPtr<IDWriteFont> font;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 230 }
231 231
232 size_t len = wcsnlen_s(metrics.lfMessageFont.lfFaceName, LF_FACESIZE) + 1; 232 size_t len = wcsnlen_s(metrics.lfMessageFont.lfFaceName, LF_FACESIZE) + 1;
233 if (0 != wcsncpy_s(name->reset(len), len, metrics.lfMessageFont.lfFaceNa me, _TRUNCATE)) { 233 if (0 != wcsncpy_s(name->reset(len), len, metrics.lfMessageFont.lfFaceNa me, _TRUNCATE)) {
234 return E_UNEXPECTED; 234 return E_UNEXPECTED;
235 } 235 }
236 236
237 return S_OK; 237 return S_OK;
238 } 238 }
239 239
240 virtual SkRemotableFontIdentitySet* matchName(const char familyName[]) const SK_OVERRIDE { 240 SkRemotableFontIdentitySet* matchName(const char familyName[]) const SK_OVER RIDE {
241 SkSMallocWCHAR dwFamilyName; 241 SkSMallocWCHAR dwFamilyName;
242 if (NULL == familyName) { 242 if (NULL == familyName) {
243 HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName), 243 HR_GENERAL(getDefaultFontFamilyName(&dwFamilyName),
244 NULL, SkRemotableFontIdentitySet::NewEmpty()); 244 NULL, SkRemotableFontIdentitySet::NewEmpty());
245 } else { 245 } else {
246 HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName), 246 HR_GENERAL(sk_cstring_to_wchar(familyName, &dwFamilyName),
247 NULL, SkRemotableFontIdentitySet::NewEmpty()); 247 NULL, SkRemotableFontIdentitySet::NewEmpty());
248 } 248 }
249 249
250 UINT32 index; 250 UINT32 index;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 virtual HRESULT STDMETHODCALLTYPE GetPixelsPerDip( 366 virtual HRESULT STDMETHODCALLTYPE GetPixelsPerDip(
367 void* clientDrawingContext, 367 void* clientDrawingContext,
368 FLOAT* pixelsPerDip) SK_OVERRIDE 368 FLOAT* pixelsPerDip) SK_OVERRIDE
369 { 369 {
370 *pixelsPerDip = 1.0f; 370 *pixelsPerDip = 1.0f;
371 return S_OK; 371 return S_OK;
372 } 372 }
373 373
374 // IUnknown methods 374 // IUnknown methods
375 virtual ULONG STDMETHODCALLTYPE AddRef() SK_OVERRIDE { 375 ULONG STDMETHODCALLTYPE AddRef() SK_OVERRIDE {
376 return InterlockedIncrement(&fRefCount); 376 return InterlockedIncrement(&fRefCount);
377 } 377 }
378 378
379 virtual ULONG STDMETHODCALLTYPE Release() SK_OVERRIDE { 379 ULONG STDMETHODCALLTYPE Release() SK_OVERRIDE {
380 ULONG newCount = InterlockedDecrement(&fRefCount); 380 ULONG newCount = InterlockedDecrement(&fRefCount);
381 if (0 == newCount) { 381 if (0 == newCount) {
382 delete this; 382 delete this;
383 } 383 }
384 return newCount; 384 return newCount;
385 } 385 }
386 386
387 virtual HRESULT STDMETHODCALLTYPE QueryInterface( 387 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
388 IID const& riid, void** ppvObject) SK_OVERRIDE 388 IID const& riid, void** ppvObject) SK_OVERRIDE
389 { 389 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 SkTScopedComPtr<FontFallbackRenderer> fontFallbackRenderer( 466 SkTScopedComPtr<FontFallbackRenderer> fontFallbackRenderer(
467 new FontFallbackRenderer(this, character)); 467 new FontFallbackRenderer(this, character));
468 468
469 HR_GENERAL(fallbackLayout->Draw(NULL, fontFallbackRenderer.get(), 50.0f, 50.0f), 469 HR_GENERAL(fallbackLayout->Draw(NULL, fontFallbackRenderer.get(), 50.0f, 50.0f),
470 "Could not draw layout with renderer.", 470 "Could not draw layout with renderer.",
471 identity); 471 identity);
472 472
473 return fontFallbackRenderer->FallbackIdentity(); 473 return fontFallbackRenderer->FallbackIdentity();
474 } 474 }
475 475
476 virtual SkStreamAsset* getData(int dataId) const SK_OVERRIDE { 476 SkStreamAsset* getData(int dataId) const SK_OVERRIDE {
477 SkAutoMutexAcquire ama(fDataIdCacheMutex); 477 SkAutoMutexAcquire ama(fDataIdCacheMutex);
478 if (dataId >= fDataIdCache.count()) { 478 if (dataId >= fDataIdCache.count()) {
479 return NULL; 479 return NULL;
480 } 480 }
481 const DataId& id = fDataIdCache[dataId]; 481 const DataId& id = fDataIdCache[dataId];
482 482
483 SkTScopedComPtr<IDWriteFontFileLoader> loader; 483 SkTScopedComPtr<IDWriteFontFileLoader> loader;
484 HRNM(id.fLoader->QueryInterface(&loader), "QuerryInterface IDWriteFontFi leLoader failed"); 484 HRNM(id.fLoader->QueryInterface(&loader), "QuerryInterface IDWriteFontFi leLoader failed");
485 485
486 SkTScopedComPtr<IDWriteFontFileStream> fontFileStream; 486 SkTScopedComPtr<IDWriteFontFileStream> fontFileStream;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } else { 519 } else {
520 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N AME_MAX_LENGTH); 520 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N AME_MAX_LENGTH);
521 if (localeNameLen) { 521 if (localeNameLen) {
522 localeName = localeNameStorage; 522 localeName = localeNameStorage;
523 }; 523 };
524 } 524 }
525 525
526 return SkNEW_ARGS(SkRemotableFontMgr_DirectWrite, (sysFontCollection.get(), 526 return SkNEW_ARGS(SkRemotableFontMgr_DirectWrite, (sysFontCollection.get(),
527 localeName, localeNameLen )); 527 localeName, localeNameLen ));
528 } 528 }
OLDNEW
« no previous file with comments | « src/ports/SkImageDecoder_WIC.cpp ('k') | src/ports/SkScalerContext_win_dw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698