Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: gm/pixelsnap.cpp

Issue 1263553002: make pixelsnap textblob* etc gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more 565 compatibility Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/pictureshader.cpp ('k') | gm/poly2poly.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/pixelsnap.cpp
diff --git a/gm/pixelsnap.cpp b/gm/pixelsnap.cpp
index 8a513f3ca5409725def3c39ea2bb0c08a6d62c3a..3358e9d410caffb2683c3bc4c89c62d30c6134a5 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));
« no previous file with comments | « gm/pictureshader.cpp ('k') | gm/poly2poly.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698