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

Side by Side Diff: tools/sk_tool_utils.cpp

Issue 1245643002: Generate platform specific fontmgr gm. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add key placeholder to enable SampleApp and VisualBench to link Created 5 years, 5 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') | no next file » | 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
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkCommonFlags.h"
13 #include "SkShader.h" 14 #include "SkShader.h"
14 #include "SkTestScalerContext.h" 15 #include "SkTestScalerContext.h"
15 #include "SkTextBlob.h" 16 #include "SkTextBlob.h"
16 17
17 DEFINE_bool(portableFonts, false, "Use portable fonts"); 18 DEFINE_bool(portableFonts, false, "Use portable fonts");
18 DEFINE_bool(resourceFonts, false, "Use resource fonts"); 19 DEFINE_bool(resourceFonts, false, "Use resource fonts");
19 20
20 namespace sk_tool_utils { 21 namespace sk_tool_utils {
21 22
23 const char* platform_os_name() {
24 for (int index = 0; index < FLAGS_key.count(); index += 2) {
25 if (!strcmp("os", FLAGS_key[index])) {
26 return FLAGS_key[index + 1];
27 }
28 }
29 // when running SampleApp or dm without a --key pair, omit the platform name
30 return "";
31 }
32
33 const char* platform_extra_config(const char* config) {
34 for (int index = 0; index < FLAGS_key.count(); index += 2) {
35 if (!strcmp("extra_config", FLAGS_key[index]) && !strcmp(config, FLAGS_k ey[index + 1])) {
36 return config;
37 }
38 }
39 return "";
40 }
41
22 const char* colortype_name(SkColorType ct) { 42 const char* colortype_name(SkColorType ct) {
23 switch (ct) { 43 switch (ct) {
24 case kUnknown_SkColorType: return "Unknown"; 44 case kUnknown_SkColorType: return "Unknown";
25 case kAlpha_8_SkColorType: return "Alpha_8"; 45 case kAlpha_8_SkColorType: return "Alpha_8";
26 case kIndex_8_SkColorType: return "Index_8"; 46 case kIndex_8_SkColorType: return "Index_8";
27 case kARGB_4444_SkColorType: return "ARGB_4444"; 47 case kARGB_4444_SkColorType: return "ARGB_4444";
28 case kRGB_565_SkColorType: return "RGB_565"; 48 case kRGB_565_SkColorType: return "RGB_565";
29 case kRGBA_8888_SkColorType: return "RGBA_8888"; 49 case kRGBA_8888_SkColorType: return "RGBA_8888";
30 case kBGRA_8888_SkColorType: return "BGRA_8888"; 50 case kBGRA_8888_SkColorType: return "BGRA_8888";
31 default: 51 default:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 paint.textToGlyphs(text, len, glyphs.begin()); 123 paint.textToGlyphs(text, len, glyphs.begin());
104 124
105 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 125 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
106 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co unt(), x, y, 126 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co unt(), x, y,
107 NULL); 127 NULL);
108 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); 128 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t));
109 } 129 }
110 130
111 131
112 } // namespace sk_tool_utils 132 } // namespace sk_tool_utils
OLDNEW
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698