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

Side by Side Diff: src/ports/SkFontMgr_android_parser.h

Issue 1726213004: Deduplicate axis value resolving code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Convince gcc that the values are assigned before use. Created 4 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_android_parser.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 2011 The Android Open Source Project 2 * Copyright 2011 The Android Open Source Project
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 #ifndef SkFontMgr_android_parser_DEFINED 8 #ifndef SkFontMgr_android_parser_DEFINED
9 #define SkFontMgr_android_parser_DEFINED 9 #define SkFontMgr_android_parser_DEFINED
10 10
11 #include "SkFixed.h" 11 #include "SkFontMgr.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTArray.h" 13 #include "SkTArray.h"
14 #include "SkTDArray.h" 14 #include "SkTDArray.h"
15 #include "SkTypes.h" 15 #include "SkTypes.h"
16 16
17 #include <climits> 17 #include <climits>
18 #include <limits> 18 #include <limits>
19 19
20 /** \class SkLanguage 20 /** \class SkLanguage
21 21
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 typedef uint32_t FontVariant; 66 typedef uint32_t FontVariant;
67 67
68 // Must remain trivially movable (can be memmoved). 68 // Must remain trivially movable (can be memmoved).
69 struct FontFileInfo { 69 struct FontFileInfo {
70 FontFileInfo() : fIndex(0), fWeight(0), fStyle(Style::kAuto) { } 70 FontFileInfo() : fIndex(0), fWeight(0), fStyle(Style::kAuto) { }
71 71
72 SkString fFileName; 72 SkString fFileName;
73 int fIndex; 73 int fIndex;
74 int fWeight; 74 int fWeight;
75 enum class Style { kAuto, kNormal, kItalic } fStyle; 75 enum class Style { kAuto, kNormal, kItalic } fStyle;
76 struct Axis { 76 SkTArray<SkFontMgr::FontParameters::Axis, true> fAxes;
77 Axis() : fTag(SkSetFourByteTag('\0','\0','\0','\0')), fValue(0) { }
78 SkFourByteTag fTag;
79 SkFixed fValue;
80 };
81 SkTArray<Axis, true> fAxes;
82 }; 77 };
83 78
84 /** 79 /**
85 * A font family provides one or more names for a collection of fonts, each of 80 * A font family provides one or more names for a collection of fonts, each of
86 * which has a different style (normal, italic) or weight (thin, light, bold, 81 * which has a different style (normal, italic) or weight (thin, light, bold,
87 * etc). 82 * etc).
88 * Some fonts may occur in compact variants for use in the user interface. 83 * Some fonts may occur in compact variants for use in the user interface.
89 * Android distinguishes "fallback" fonts to support non-ASCII character sets. 84 * Android distinguishes "fallback" fonts to support non-ASCII character sets.
90 */ 85 */
91 struct FontFamily { 86 struct FontFamily {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 204 }
210 if (negate) { 205 if (negate) {
211 n = -n; 206 n = -n;
212 frac = -frac; 207 frac = -frac;
213 } 208 }
214 *value = SkLeftShift(n, N) + frac; 209 *value = SkLeftShift(n, N) + frac;
215 return true; 210 return true;
216 } 211 }
217 212
218 #endif /* SkFontMgr_android_parser_DEFINED */ 213 #endif /* SkFontMgr_android_parser_DEFINED */
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_android.cpp ('k') | src/ports/SkFontMgr_android_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698