| 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 #ifndef sk_tool_utils_DEFINED | 8 #ifndef sk_tool_utils_DEFINED |
| 9 #define sk_tool_utils_DEFINED | 9 #define sk_tool_utils_DEFINED |
| 10 | 10 |
| 11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 #include "SkPixelSerializer.h" | 14 #include "SkPixelSerializer.h" |
| 15 #include "SkTypeface.h" | 15 #include "SkTypeface.h" |
| 16 | 16 |
| 17 class SkBitmap; | 17 class SkBitmap; |
| 18 class SkCanvas; | 18 class SkCanvas; |
| 19 class SkPaint; | 19 class SkPaint; |
| 20 class SkShader; | 20 class SkShader; |
| 21 class SkTestFont; | 21 class SkTestFont; |
| 22 class SkTextBlobBuilder; | 22 class SkTextBlobBuilder; |
| 23 | 23 |
| 24 namespace sk_tool_utils { | 24 namespace sk_tool_utils { |
| 25 | 25 |
| 26 const char* colortype_name(SkColorType); | 26 const char* colortype_name(SkColorType); |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Sets the paint to use a platform-independent text renderer. | 29 * Sets the paint to use a platform-independent text renderer if FLAGS_porta
bleFonts is set. |
| 30 * FIXME: will become obsolete as GMs migrate to set portable typeface alway
s. |
| 30 */ | 31 */ |
| 31 void set_portable_typeface(SkPaint* paint, const char* name = NULL, | 32 void set_portable_typeface(SkPaint* paint, const char* name = NULL, |
| 32 SkTypeface::Style style = SkTypeface::kNormal); | 33 SkTypeface::Style style = SkTypeface::kNormal); |
| 34 void set_portable_typeface_always(SkPaint* paint, const char* name = NULL, |
| 35 SkTypeface::Style style = SkTypeface::kNormal); |
| 33 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style sty
le); | 36 SkTypeface* create_portable_typeface(const char* name, SkTypeface::Style sty
le); |
| 37 SkTypeface* create_portable_typeface_always(const char* name, SkTypeface::St
yle style); |
| 34 void report_used_chars(); | 38 void report_used_chars(); |
| 35 | 39 |
| 36 /** | 40 /** |
| 37 * Call canvas->writePixels() by using the pixels from bitmap, but with an
info that claims | 41 * Call canvas->writePixels() by using the pixels from bitmap, but with an
info that claims |
| 38 * the pixels are colorType + alphaType | 42 * the pixels are colorType + alphaType |
| 39 */ | 43 */ |
| 40 void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkA
lphaType); | 44 void write_pixels(SkCanvas*, const SkBitmap&, int x, int y, SkColorType, SkA
lphaType); |
| 41 | 45 |
| 42 // private to sk_tool_utils | 46 // private to sk_tool_utils |
| 43 SkTypeface* create_font(const char* name, SkTypeface::Style ); | 47 SkTypeface* create_font(const char* name, SkTypeface::Style ); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 } | 74 } |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 // A helper for inserting a drawtext call into a SkTextBlobBuilder | 77 // A helper for inserting a drawtext call into a SkTextBlobBuilder |
| 74 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk
Paint& origPaint, | 78 void add_to_text_blob(SkTextBlobBuilder* builder, const char* text, const Sk
Paint& origPaint, |
| 75 SkScalar x, SkScalar y); | 79 SkScalar x, SkScalar y); |
| 76 | 80 |
| 77 } // namespace sk_tool_utils | 81 } // namespace sk_tool_utils |
| 78 | 82 |
| 79 #endif // sk_tool_utils_DEFINED | 83 #endif // sk_tool_utils_DEFINED |
| OLD | NEW |