OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 case kARGB_4444_SkColorType: return "ARGB_4444"; | 27 case kARGB_4444_SkColorType: return "ARGB_4444"; |
28 case kRGB_565_SkColorType: return "RGB_565"; | 28 case kRGB_565_SkColorType: return "RGB_565"; |
29 case kRGBA_8888_SkColorType: return "RGBA_8888"; | 29 case kRGBA_8888_SkColorType: return "RGBA_8888"; |
30 case kBGRA_8888_SkColorType: return "BGRA_8888"; | 30 case kBGRA_8888_SkColorType: return "BGRA_8888"; |
31 default: | 31 default: |
32 SkASSERT(false); | 32 SkASSERT(false); |
33 return "unexpected colortype"; | 33 return "unexpected colortype"; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 SkColor color_to_565(SkColor color) { | 37 void color_to_565(SkColor* color) { |
38 SkPMColor pmColor = SkPreMultiplyColor(color); | 38 SkPMColor pmColor = SkPreMultiplyColor(*color); |
39 U16CPU color16 = SkPixel32ToPixel16(pmColor); | 39 U16CPU color16 = SkPixel32ToPixel16(pmColor); |
40 return SkPixel16ToColor(color16); | 40 *color = SkPixel16ToColor(color16); |
41 } | 41 } |
42 | 42 |
43 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style)
{ | 43 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style style)
{ |
44 SkTypeface* face; | 44 SkTypeface* face; |
45 if (FLAGS_portableFonts) { | 45 if (FLAGS_portableFonts) { |
46 face = create_font(name, style); | 46 face = create_font(name, style); |
47 } else if (FLAGS_resourceFonts) { | 47 } else if (FLAGS_resourceFonts) { |
48 face = resource_font(name, style); | 48 face = resource_font(name, style); |
49 } else { | 49 } else { |
50 face = SkTypeface::CreateFromName(name, style); | 50 face = SkTypeface::CreateFromName(name, style); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 paint.textToGlyphs(text, len, glyphs.begin()); | 103 paint.textToGlyphs(text, len, glyphs.begin()); |
104 | 104 |
105 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 105 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
106 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, | 106 const SkTextBlobBuilder::RunBuffer& run = builder->allocRun(paint, glyphs.co
unt(), x, y, |
107 NULL); | 107 NULL); |
108 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); | 108 memcpy(run.glyphs, glyphs.begin(), glyphs.count() * sizeof(uint16_t)); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 } // namespace sk_tool_utils | 112 } // namespace sk_tool_utils |
OLD | NEW |