make glyph_pos imageblur* largeglyphblur portable
authorcaryclark <caryclark@google.com>
Thu, 16 Jul 2015 21:16:04 +0000 (14:16 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 16 Jul 2015 21:16:04 +0000 (14:16 -0700)
R=reed@google.com,bungeman@google.com

Review URL: https://codereview.chromium.org/1243493003

gm/glyph_pos.cpp
gm/imageblur.cpp
gm/imageblurtiled.cpp
gm/largeglyphblur.cpp

index 16cdfca11a8a0fda5c66d3b44395a6ae534e566c..90329ed7fdc530982224b0d51cf9e49d2f445f9c 100644 (file)
@@ -48,9 +48,6 @@ protected:
     SkISize onISize() override { return SkISize::Make(800, 600); }
 
     void onDraw(SkCanvas* canvas) override {
-        if (!fProp) {
-            fProp.reset(sk_tool_utils::create_portable_typeface("Helvetica", SkTypeface::kNormal));
-        }
 
         // There's a black pixel at 40, 40 for reference.
         canvas->drawPoint(40.0f, 40.0f, SK_ColorBLACK);
@@ -108,8 +105,7 @@ protected:
         paint.setColor(SK_ColorBLACK);
         paint.setAntiAlias(true);
         paint.setTextSize(kTextHeight * textScale);
-        paint.setTypeface(fProp);
-        paint.setDevKernText(true);
+        sk_tool_utils::set_portable_typeface_always(&paint);
         paint.setStrokeWidth(fStrokeWidth);
         paint.setStyle(fStrokeStyle);
 
@@ -158,7 +154,6 @@ protected:
     }
 
 private:
-    SkAutoTUnref<SkTypeface> fProp;
     SkScalar fStrokeWidth;
     SkPaint::Style fStrokeStyle;
 
index c7139b4f65b054fc96b05863282d5c751ecc0ecd..d0f1fd1803ebc5cdea9a5aae9b890740029bdad9 100644 (file)
@@ -41,11 +41,11 @@ protected:
         SkRandom rand;
         SkPaint textPaint;
         textPaint.setAntiAlias(true);
-        sk_tool_utils::set_portable_typeface(&textPaint);
+        sk_tool_utils::set_portable_typeface_always(&textPaint);
         for (int i = 0; i < 25; ++i) {
             int x = rand.nextULessThan(WIDTH);
             int y = rand.nextULessThan(HEIGHT);
-            textPaint.setColor(rand.nextBits(24) | 0xFF000000);
+            textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF000000));
             textPaint.setTextSize(rand.nextRangeScalar(0, 300));
             canvas->drawText(str, strlen(str), SkIntToScalar(x),
                              SkIntToScalar(y), textPaint);
index ed4ae6cef3e6a7bd7795796d03ffb3a9e2a708af..5b00b1752ab258a385aa7973e9ba8d5fafb174a1 100644 (file)
@@ -50,7 +50,7 @@ protected:
                 };
                 SkPaint textPaint;
                 textPaint.setAntiAlias(true);
-                sk_tool_utils::set_portable_typeface(&textPaint);
+                sk_tool_utils::set_portable_typeface_always(&textPaint);
                 textPaint.setTextSize(SkIntToScalar(100));
                 int posY = 0;
                 for (unsigned i = 0; i < SK_ARRAY_COUNT(str); i++) {
index 8723824e13707e1ca58d19489ec67ff02dbb3558..9d9ff418cf2b52e215f75391db2b3bdc0d74537f 100644 (file)
@@ -32,7 +32,7 @@ protected:
         const char text[] = "Hamburgefons";
 
         SkPaint paint;
-        sk_tool_utils::set_portable_typeface(&paint);
+        sk_tool_utils::set_portable_typeface_always(&paint);
         paint.setTextSize(256);
         paint.setAntiAlias(true);