diff options
author | caryclark <caryclark@google.com> | 2014-06-23 11:25:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-23 11:25:00 -0700 |
commit | 5fb6bd4b7e8d00b7f2543ca10ec9022b32632f29 (patch) | |
tree | 9212da1f0a1c6bee32c3debd4b8fd1ff61beca60 /tools/sk_tool_utils.cpp | |
parent | c83780c9ec9fb7dc46abed71a64d83ec0ce7a274 (diff) |
use platform-independent font for gm
Create a custom typeface and scaler to render simple paths the
same on all platforms.
GM tests are modified to explicitly select the custom typeface.
R=reed@google.com, mtklein@google.com, bungeman@google.com
TBR=reed
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/348323003
Diffstat (limited to 'tools/sk_tool_utils.cpp')
-rw-r--r-- | tools/sk_tool_utils.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp index c75c496a89..1b35005d96 100644 --- a/tools/sk_tool_utils.cpp +++ b/tools/sk_tool_utils.cpp @@ -6,12 +6,15 @@ */ #include "sk_tool_utils.h" +#include "../src/fonts/SkTestScalerContext.h" #include "SkBitmap.h" #include "SkCanvas.h" namespace sk_tool_utils { +bool gEnablePortableTypeface = false; + const char* colortype_name(SkColorType ct) { switch (ct) { case kUnknown_SkColorType: return "Unknown"; @@ -27,6 +30,14 @@ const char* colortype_name(SkColorType ct) { } } +SkPaint::FontMetrics create_font(SkTDArray<SkPath*>& , SkTDArray<SkFixed>& ); + +void set_portable_typeface(SkPaint* paint, SkTypeface::Style style) { + if (gEnablePortableTypeface) { + SkSafeUnref(paint->setTypeface(CreateTestTypeface(create_font, style))); + } +} + void write_pixels(SkCanvas* canvas, const SkBitmap& bitmap, int x, int y, SkColorType colorType, SkAlphaType alphaType) { SkBitmap tmp(bitmap); |