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

Side by Side Diff: Source/platform/fonts/skia/FontCacheSkia.cpp

Issue 813883002: replace COMPILE_ASSERT with static_assert in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 years 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 | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | Source/platform/geometry/Region.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 (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 static inline SkFontStyle fontStyle(const FontDescription& fontDescription) 167 static inline SkFontStyle fontStyle(const FontDescription& fontDescription)
168 { 168 {
169 int width = static_cast<int>(fontDescription.stretch()); 169 int width = static_cast<int>(fontDescription.stretch());
170 int weight = (fontDescription.weight() - FontWeight100 + 1) * 100; 170 int weight = (fontDescription.weight() - FontWeight100 + 1) * 100;
171 SkFontStyle::Slant slant = fontDescription.style() == FontStyleItalic 171 SkFontStyle::Slant slant = fontDescription.style() == FontStyleItalic
172 ? SkFontStyle::kItalic_Slant 172 ? SkFontStyle::kItalic_Slant
173 : SkFontStyle::kUpright_Slant; 173 : SkFontStyle::kUpright_Slant;
174 return SkFontStyle(weight, width, slant); 174 return SkFontStyle(weight, width, slant);
175 } 175 }
176 176
177 COMPILE_ASSERT(static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(S kFontStyle::kUltraCondensed_Width), 177 static_assert(static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(Sk FontStyle::kUltraCondensed_Width),
178 FontStretchUltraCondensedMapsTokUltraCondensed_Width); 178 "FontStretchUltraCondensed should map to kUltraCondensed_Width");
179 COMPILE_ASSERT(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontSty le::kNormal_Width), 179 static_assert(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontStyl e::kNormal_Width),
180 FontStretchNormalMapsTokNormal_Width); 180 "FontStretchNormal should map to kNormal_Width");
181 COMPILE_ASSERT(static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(Sk FontStyle::kUltaExpanded_Width), 181 static_assert(static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(SkF ontStyle::kUltaExpanded_Width),
182 FontStretchUltraExpandedMapsTokUltaExpanded_Width); 182 "FontStretchUltraExpanded should map to kUltaExpanded_Width");
183 #endif 183 #endif
184 184
185 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc ription, const FontFaceCreationParams& creationParams, CString& name) 185 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc ription, const FontFaceCreationParams& creationParams, CString& name)
186 { 186 {
187 #if !OS(WIN) && !OS(ANDROID) 187 #if !OS(WIN) && !OS(ANDROID)
188 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { 188 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) {
189 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after 189 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after
190 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. 190 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed.
191 SkTypeface* typeface = nullptr; 191 SkTypeface* typeface = nullptr;
192 if (Platform::current()->sandboxSupport()) 192 if (Platform::current()->sandboxSupport())
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 fontSize, 251 fontSize,
252 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(), 252 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(),
253 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe ticItalic(), 253 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe ticItalic(),
254 fontDescription.orientation(), 254 fontDescription.orientation(),
255 fontDescription.useSubpixelPositioning()); 255 fontDescription.useSubpixelPositioning());
256 return result; 256 return result;
257 } 257 }
258 #endif // !OS(WIN) 258 #endif // !OS(WIN)
259 259
260 } // namespace blink 260 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | Source/platform/geometry/Region.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698