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

Side by Side Diff: include/core/SkFontStyle.h

Issue 488143002: Replace SkTypeface::Style with SkFontStyle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add expectations, remove whitespace. Created 6 years, 2 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 | « gyp/ports.gyp ('k') | include/core/SkTypeface.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 2013 Google Inc. 2 * Copyright 2013 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 #ifndef SkFontStyle_DEFINED 8 #ifndef SkFontStyle_DEFINED
9 #define SkFontStyle_DEFINED 9 #define SkFontStyle_DEFINED
10 10
(...skipping 25 matching lines...) Expand all
36 kUltaExpanded_Width = 9 36 kUltaExpanded_Width = 9
37 }; 37 };
38 38
39 enum Slant { 39 enum Slant {
40 kUpright_Slant, 40 kUpright_Slant,
41 kItalic_Slant, 41 kItalic_Slant,
42 }; 42 };
43 43
44 SkFontStyle(); 44 SkFontStyle();
45 SkFontStyle(int weight, int width, Slant); 45 SkFontStyle(int weight, int width, Slant);
46 /** oldStyle means the style-bits in SkTypeface::Style: bold=1, italic=2 */
47 explicit SkFontStyle(unsigned oldStyle);
46 48
47 bool operator==(const SkFontStyle& rhs) const { 49 bool operator==(const SkFontStyle& rhs) const {
48 return fUnion.fU32 == rhs.fUnion.fU32; 50 return fUnion.fU32 == rhs.fUnion.fU32;
49 } 51 }
50 52
51 int weight() const { return fUnion.fR.fWeight; } 53 int weight() const { return fUnion.fR.fWeight; }
52 int width() const { return fUnion.fR.fWidth; } 54 int width() const { return fUnion.fR.fWidth; }
53 Slant slant() const { return (Slant)fUnion.fR.fSlant; } 55 Slant slant() const { return (Slant)fUnion.fR.fSlant; }
54 56
55 bool isItalic() const { 57 bool isItalic() const {
56 return kItalic_Slant == fUnion.fR.fSlant; 58 return kItalic_Slant == fUnion.fR.fSlant;
57 } 59 }
58 60
59 private: 61 private:
60 union { 62 union {
61 struct { 63 struct {
62 uint16_t fWeight; // 100 .. 900 64 uint16_t fWeight; // 100 .. 900
63 uint8_t fWidth; // 1 .. 9 65 uint8_t fWidth; // 1 .. 9
64 uint8_t fSlant; // 0 .. 2 66 uint8_t fSlant; // 0 .. 2
65 } fR; 67 } fR;
66 uint32_t fU32; 68 uint32_t fU32;
67 } fUnion; 69 } fUnion;
68 }; 70 };
69 71
70 #endif 72 #endif
OLDNEW
« no previous file with comments | « gyp/ports.gyp ('k') | include/core/SkTypeface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698