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

Side by Side Diff: src/core/SkFontStyle.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. Created 4 years, 8 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/core/SkFontMgr.cpp ('k') | src/core/SkTypeface.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 2015 Google Inc. 2 * Copyright 2015 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 "SkFontStyle.h" 8 #include "SkFontStyle.h"
9 #include "SkTypeface.h" 9 #include "SkTypeface.h"
10 #include "SkTypes.h" 10 #include "SkTypes.h"
11 11
12 SkFontStyle::SkFontStyle() { 12 SkFontStyle::SkFontStyle() {
13 fUnion.fU32 = 0; 13 fUnion.fU32 = 0;
14 fUnion.fR.fWeight = kNormal_Weight; 14 fUnion.fR.fWeight = kNormal_Weight;
15 fUnion.fR.fWidth = kNormal_Width; 15 fUnion.fR.fWidth = kNormal_Width;
16 fUnion.fR.fSlant = kUpright_Slant; 16 fUnion.fR.fSlant = kUpright_Slant;
17 } 17 }
18 18
19 SkFontStyle::SkFontStyle(int weight, int width, Slant slant) { 19 SkFontStyle::SkFontStyle(int weight, int width, Slant slant) {
20 fUnion.fU32 = 0; 20 fUnion.fU32 = 0;
21 fUnion.fR.fWeight = SkTPin<int>(weight, kThin_Weight, kBlack_Weight); 21 fUnion.fR.fWeight = SkTPin<int>(weight, kThin_Weight, kBlack_Weight);
22 fUnion.fR.fWidth = SkTPin<int>(width, kUltraCondensed_Width, kUltaExpanded_W idth); 22 fUnion.fR.fWidth = SkTPin<int>(width, kUltraCondensed_Width, kUltaExpanded_W idth);
23 fUnion.fR.fSlant = SkTPin<int>(slant, kUpright_Slant, kItalic_Slant); 23 fUnion.fR.fSlant = SkTPin<int>(slant, kUpright_Slant, kItalic_Slant);
24 } 24 }
25 25
26 SkFontStyle::SkFontStyle(unsigned oldStyle) { 26 /*static*/SkFontStyle SkFontStyle::FromOldStyle(unsigned oldStyle) {
27 fUnion.fU32 = 0; 27 return SkFontStyle((oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weigh t
28 fUnion.fR.fWeight = (oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weig ht 28 : SkFontStyle::kNormal_Wei ght,
29 : SkFontStyle::kNormal_We ight; 29 SkFontStyle::kNormal_Width,
30 fUnion.fR.fWidth = SkFontStyle::kNormal_Width; 30 (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_S lant
31 fUnion.fR.fSlant = (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_S lant 31 : SkFontStyle::kUpright_ Slant);
32 : SkFontStyle::kUpright_ Slant;
33 } 32 }
OLDNEW
« no previous file with comments | « src/core/SkFontMgr.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698