diff options
author | caryclark <caryclark@google.com> | 2015-07-28 10:37:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-28 10:37:53 -0700 |
commit | f597c42c50718d5c39769077040de1768c89bbd3 (patch) | |
tree | 8cc51fbb20f2e1c8ed1a20ff8ee6360d62aa4331 /gm/pixelsnap.cpp | |
parent | 7a0d697ed69610efac1b964896edfc9bd869243c (diff) |
make pixelsnap textblob* etc gm portable
TBR=reed@google.com
Review URL: https://codereview.chromium.org/1263553002
Diffstat (limited to 'gm/pixelsnap.cpp')
-rw-r--r-- | gm/pixelsnap.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/gm/pixelsnap.cpp b/gm/pixelsnap.cpp index 8a513f3ca5..3358e9d410 100644 --- a/gm/pixelsnap.cpp +++ b/gm/pixelsnap.cpp @@ -35,7 +35,9 @@ protected: void onDraw(SkCanvas* canvas) override { SkPaint bgPaint; bgPaint.setShader( - sk_tool_utils::create_checkerboard_shader(0xFFAAAAAA, 0xFF777777, 1))->unref(); + sk_tool_utils::create_checkerboard_shader( + sk_tool_utils::color_to_565(0xFFAAAAAA), + sk_tool_utils::color_to_565(0xFF777777), 1))->unref(); canvas->drawPaint(bgPaint); SkString offset; @@ -43,33 +45,31 @@ protected: labelPaint.setAntiAlias(true); labelPaint.setColor(SK_ColorWHITE); labelPaint.setTextSize(SkIntToScalar(kLabelTextSize)); + sk_tool_utils::set_portable_typeface(&labelPaint); SkPaint linePaint; linePaint.setColor(SK_ColorWHITE); - // Drawing labels is useful for debugging, but bad for baselining (x-platform txt diffs). - if (false) { - // Draw row labels - canvas->save(); - canvas->translate(0, SkIntToScalar(kLabelOffsetY)); - for (int i = 0; i <= kSubPixelSteps; ++i) { - offset.printf("%d", i); - canvas->drawText(offset.c_str(), offset.size(), - 0, i * kTrans + labelPaint.getTextSize(), - labelPaint); - } - canvas->restore(); - - // Draw col labels - canvas->save(); - canvas->translate(SkIntToScalar(kLabelOffsetX), 0); - for (int i = 0; i <= kSubPixelSteps; ++i) { - offset.printf("%d", i); - canvas->drawText(offset.c_str(), offset.size(), - i * SkIntToScalar(kTrans), labelPaint.getTextSize(), - labelPaint); - } - canvas->restore(); - } + // Draw row labels + canvas->save(); + canvas->translate(0, SkIntToScalar(kLabelOffsetY)); + for (int i = 0; i <= kSubPixelSteps; ++i) { + offset.printf("%d", i); + canvas->drawText(offset.c_str(), offset.size(), + 0, i * kTrans + labelPaint.getTextSize(), + labelPaint); + } + canvas->restore(); + + // Draw col labels + canvas->save(); + canvas->translate(SkIntToScalar(kLabelOffsetX), 0); + for (int i = 0; i <= kSubPixelSteps; ++i) { + offset.printf("%d", i); + canvas->drawText(offset.c_str(), offset.size(), + i * SkIntToScalar(kTrans), labelPaint.getTextSize(), + labelPaint); + } + canvas->restore(); canvas->translate(SkIntToScalar(kLabelOffsetX), SkIntToScalar(kLabelOffsetY)); |