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

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

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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_android_parser.h ('k') | src/ports/SkOSFile_posix.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 7
8 #include "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFixed.h" 9 #include "SkFixed.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // From [n] to +Inf 294 // From [n] to +Inf
295 // if (fcweight < Inf) 295 // if (fcweight < Inf)
296 return ranges[rangesCount-1].new_val; 296 return ranges[rangesCount-1].new_val;
297 } 297 }
298 298
299 static int map_ranges(int val, MapRanges const ranges[], int rangesCount) { 299 static int map_ranges(int val, MapRanges const ranges[], int rangesCount) {
300 return SkFixedRoundToInt(map_ranges_fixed(SkIntToFixed(val), ranges, rangesC ount)); 300 return SkFixedRoundToInt(map_ranges_fixed(SkIntToFixed(val), ranges, rangesC ount));
301 } 301 }
302 302
303 template<int n> struct SkTFixed { 303 template<int n> struct SkTFixed {
304 SK_COMPILE_ASSERT(-32768 <= n && n <= 32767, SkTFixed_n_not_in_range); 304 static_assert(-32768 <= n && n <= 32767, "SkTFixed_n_not_in_range");
305 static const SkFixed value = static_cast<SkFixed>(n << 16); 305 static const SkFixed value = static_cast<SkFixed>(n << 16);
306 }; 306 };
307 307
308 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) { 308 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) {
309 typedef SkFontStyle SkFS; 309 typedef SkFontStyle SkFS;
310 310
311 static const MapRanges weightRanges[] = { 311 static const MapRanges weightRanges[] = {
312 { SkTFixed<FC_WEIGHT_THIN>::value, SkTFixed<SkFS::kThin_Weight>::v alue }, 312 { SkTFixed<FC_WEIGHT_THIN>::value, SkTFixed<SkFS::kThin_Weight>::v alue },
313 { SkTFixed<FC_WEIGHT_EXTRALIGHT>::value, SkTFixed<SkFS::kExtraLight_Weig ht>::value }, 313 { SkTFixed<FC_WEIGHT_EXTRALIGHT>::value, SkTFixed<SkFS::kExtraLight_Weig ht>::value },
314 { SkTFixed<FC_WEIGHT_LIGHT>::value, SkTFixed<SkFS::kLight_Weight>:: value }, 314 { SkTFixed<FC_WEIGHT_LIGHT>::value, SkTFixed<SkFS::kLight_Weight>:: value },
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 return typeface.detach(); 873 return typeface.detach();
874 } 874 }
875 875
876 return this->matchFamilyStyle(NULL, style); 876 return this->matchFamilyStyle(NULL, style);
877 } 877 }
878 }; 878 };
879 879
880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { 880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) {
881 return new SkFontMgr_fontconfig(fc); 881 return new SkFontMgr_fontconfig(fc);
882 } 882 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_android_parser.h ('k') | src/ports/SkOSFile_posix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698