From 5df0575f04393bd8aa29269930524148532ce4c3 Mon Sep 17 00:00:00 2001 From: caryclark Date: Wed, 15 Jul 2015 11:57:00 -0700 Subject: [PATCH] make gradtext quadpaths gm portable TBR=reed@google.com Review URL: https://codereview.chromium.org/1234233003 --- gm/gradtext.cpp | 8 ++++---- gm/quadpaths.cpp | 16 ++++++---------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/gm/gradtext.cpp b/gm/gradtext.cpp index eeaff5665f..0f1a1bfad1 100644 --- a/gm/gradtext.cpp +++ b/gm/gradtext.cpp @@ -47,7 +47,7 @@ protected: virtual SkISize onISize() { return SkISize::Make(500, 480); } virtual void onDraw(SkCanvas* canvas) { SkPaint paint; - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); canvas->clipRect(r); @@ -66,7 +66,7 @@ private: }; -// Replicate chrome layout test - switching between solid & gadient text +// Replicate chrome layout test - switching between solid & gradient text class ChromeGradTextGM2 : public GM { public: ChromeGradTextGM2() { } @@ -76,7 +76,7 @@ protected: virtual SkISize onISize() { return SkISize::Make(500, 480); } virtual void onDraw(SkCanvas* canvas) { SkPaint paint; - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); paint.setStyle(SkPaint::kFill_Style); canvas->drawText("Normal Fill Text", 16, 0, 50, paint); @@ -129,7 +129,7 @@ protected: void onDraw(SkCanvas* canvas) override { SkPaint paint; - sk_tool_utils::set_portable_typeface(&paint); + sk_tool_utils::set_portable_typeface_always(&paint); paint.setTextSize(SkIntToScalar(26)); const SkISize& size = this->getISize(); diff --git a/gm/quadpaths.cpp b/gm/quadpaths.cpp index d5eb646313..5e4b7a43a7 100644 --- a/gm/quadpaths.cpp +++ b/gm/quadpaths.cpp @@ -83,8 +83,7 @@ protected: SkPaint titlePaint; titlePaint.setColor(SK_ColorBLACK); titlePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&titlePaint); - titlePaint.setLCDRenderText(true); + sk_tool_utils::set_portable_typeface_always(&titlePaint); titlePaint.setTextSize(15 * SK_Scalar1); const char title[] = "Quad Drawn Into Rectangle Clips With " "Indicated Style, Fill and Linecaps, with stroke width 10"; @@ -113,7 +112,7 @@ protected: canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - SkColor color = 0xff007000; + SkColor color = sk_tool_utils::color_to_565(0xff007000); this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); @@ -128,8 +127,7 @@ protected: SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&labelPaint); - labelPaint.setLCDRenderText(true); + sk_tool_utils::set_portable_typeface_always(&labelPaint); labelPaint.setTextSize(10 * SK_Scalar1); canvas->drawText(gStyles[style].fName, strlen(gStyles[style].fName), @@ -229,8 +227,7 @@ protected: SkPaint titlePaint; titlePaint.setColor(SK_ColorBLACK); titlePaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&titlePaint); - titlePaint.setLCDRenderText(true); + sk_tool_utils::set_portable_typeface_always(&titlePaint); titlePaint.setTextSize(15 * SK_Scalar1); const char title[] = "Quad Closed Drawn Into Rectangle Clips With " "Indicated Style, Fill and Linecaps, with stroke width 10"; @@ -259,7 +256,7 @@ protected: canvas->translate(rect.width() + 40 * SK_Scalar1, 0); } - SkColor color = 0xff007000; + SkColor color = sk_tool_utils::color_to_565(0xff007000); this->drawPath(path.fPath, canvas, color, rect, gCaps[cap].fCap, gCaps[cap].fJoin, gStyles[style].fStyle, gFills[fill].fFill, SK_Scalar1*10); @@ -274,8 +271,7 @@ protected: SkPaint labelPaint; labelPaint.setColor(color); labelPaint.setAntiAlias(true); - sk_tool_utils::set_portable_typeface(&labelPaint); - labelPaint.setLCDRenderText(true); + sk_tool_utils::set_portable_typeface_always(&labelPaint); labelPaint.setTextSize(10 * SK_Scalar1); canvas->drawText(gStyles[style].fName, strlen(gStyles[style].fName),