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

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 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 | « tools/sk_tool_utils.h ('k') | tools/sk_tool_utils_font.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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "sk_tool_utils_flags.h" 9 #include "sk_tool_utils_flags.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return "SBIX"; 73 return "SBIX";
74 } 74 }
75 return ""; 75 return "";
76 } 76 }
77 77
78 sk_sp<SkTypeface> emoji_typeface() { 78 sk_sp<SkTypeface> emoji_typeface() {
79 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { 79 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
80 return MakeResourceAsTypeface("/fonts/Funkster.ttf"); 80 return MakeResourceAsTypeface("/fonts/Funkster.ttf");
81 } 81 }
82 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { 82 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
83 return SkTypeface::MakeFromName("Apple Color Emoji", SkTypeface::kNormal ); 83 return SkTypeface::MakeFromName("Apple Color Emoji", SkFontStyle());
84 } 84 }
85 return nullptr; 85 return nullptr;
86 } 86 }
87 87
88 const char* emoji_sample_text() { 88 const char* emoji_sample_text() {
89 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) { 89 if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
90 return "Hamburgefons"; 90 return "Hamburgefons";
91 } 91 }
92 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) { 92 if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
93 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅 93 return "\xF0\x9F\x92\xB0" "\xF0\x9F\x8F\xA1" "\xF0\x9F\x8E\x85" // 💰🏡🎅
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return "unexpected colortype"; 149 return "unexpected colortype";
150 } 150 }
151 } 151 }
152 152
153 SkColor color_to_565(SkColor color) { 153 SkColor color_to_565(SkColor color) {
154 SkPMColor pmColor = SkPreMultiplyColor(color); 154 SkPMColor pmColor = SkPreMultiplyColor(color);
155 U16CPU color16 = SkPixel32ToPixel16(pmColor); 155 U16CPU color16 = SkPixel32ToPixel16(pmColor);
156 return SkPixel16ToColor(color16); 156 return SkPixel16ToColor(color16);
157 } 157 }
158 158
159 sk_sp<SkTypeface> create_portable_typeface(const char* name, SkTypeface::Style s tyle) { 159 sk_sp<SkTypeface> create_portable_typeface(const char* name, SkFontStyle style) {
160 return create_font(name, style); 160 return create_font(name, style);
161 } 161 }
162 162
163 void set_portable_typeface(SkPaint* paint, const char* name, SkTypeface::Style s tyle) { 163 void set_portable_typeface(SkPaint* paint, const char* name, SkFontStyle style) {
164 paint->setTypeface(create_font(name, style)); 164 paint->setTypeface(create_font(name, style));
165 } 165 }
166 166
167 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, 167 void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y,
168 SkColorType colorType, SkAlphaType alphaType) { 168 SkColorType colorType, SkAlphaType alphaType) {
169 SkBitmap tmp(bitmap); 169 SkBitmap tmp(bitmap);
170 tmp.lockPixels(); 170 tmp.lockPixels();
171 171
172 const SkImageInfo info = SkImageInfo::Make(tmp.width(), tmp.height(), colorT ype, alphaType); 172 const SkImageInfo info = SkImageInfo::Make(tmp.width(), tmp.height(), colorT ype, alphaType);
173 173
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 for (int y = 0; y < src.height(); ++y) { 433 for (int y = 0; y < src.height(); ++y) {
434 for (int x = 0; x < src.width(); ++x) { 434 for (int x = 0; x < src.width(); ++x) {
435 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh); 435 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh);
436 } 436 }
437 } 437 }
438 438
439 return dst; 439 return dst;
440 } 440 }
441 441
442 } // namespace sk_tool_utils 442 } // namespace sk_tool_utils
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.h ('k') | tools/sk_tool_utils_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698