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

Unified Diff: src/ports/SkFontHost_win_dw.cpp

Issue 201213003: SkFontStyleSet_DirectWrite::getStyle to properly handle NULL out params. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win_dw.cpp
===================================================================
--- src/ports/SkFontHost_win_dw.cpp (revision 13821)
+++ src/ports/SkFontHost_win_dw.cpp (working copy)
@@ -1832,27 +1832,31 @@
SkTScopedComPtr<IDWriteFont> font;
HRVM(fFontFamily->GetFont(index, &font), "Could not get font.");
- SkFontStyle::Slant slant;
- switch (font->GetStyle()) {
- case DWRITE_FONT_STYLE_NORMAL:
- slant = SkFontStyle::kUpright_Slant;
- break;
- case DWRITE_FONT_STYLE_OBLIQUE:
- case DWRITE_FONT_STYLE_ITALIC:
- slant = SkFontStyle::kItalic_Slant;
- break;
- default:
- SkASSERT(false);
- }
+ if (fs) {
+ SkFontStyle::Slant slant;
+ switch (font->GetStyle()) {
+ case DWRITE_FONT_STYLE_NORMAL:
+ slant = SkFontStyle::kUpright_Slant;
+ break;
+ case DWRITE_FONT_STYLE_OBLIQUE:
+ case DWRITE_FONT_STYLE_ITALIC:
+ slant = SkFontStyle::kItalic_Slant;
+ break;
+ default:
+ SkASSERT(false);
+ }
- int weight = font->GetWeight();
- int width = font->GetStretch();
+ int weight = font->GetWeight();
+ int width = font->GetStretch();
- *fs = SkFontStyle(weight, width, slant);
+ *fs = SkFontStyle(weight, width, slant);
+ }
- SkTScopedComPtr<IDWriteLocalizedStrings> faceNames;
- if (SUCCEEDED(font->GetFaceNames(&faceNames))) {
- get_locale_string(faceNames.get(), fFontMgr->fLocaleName.get(), styleName);
+ if (styleName) {
+ SkTScopedComPtr<IDWriteLocalizedStrings> faceNames;
+ if (SUCCEEDED(font->GetFaceNames(&faceNames))) {
+ get_locale_string(faceNames.get(), fFontMgr->fLocaleName.get(), styleName);
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698