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

Side by Side Diff: gm/pixelsnap.cpp

Issue 1257773002: rename portable_typeface_always to portable_typeface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unncessary change to path test Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « gm/imageblur2.cpp ('k') | gm/poly2poly.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkShader.h" 10 #include "SkShader.h"
(...skipping 25 matching lines...) Expand all
36 SkPaint bgPaint; 36 SkPaint bgPaint;
37 bgPaint.setShader( 37 bgPaint.setShader(
38 sk_tool_utils::create_checkerboard_shader(0xFFAAAAAA, 0xFF777777, 1) )->unref(); 38 sk_tool_utils::create_checkerboard_shader(0xFFAAAAAA, 0xFF777777, 1) )->unref();
39 canvas->drawPaint(bgPaint); 39 canvas->drawPaint(bgPaint);
40 40
41 SkString offset; 41 SkString offset;
42 SkPaint labelPaint; 42 SkPaint labelPaint;
43 labelPaint.setAntiAlias(true); 43 labelPaint.setAntiAlias(true);
44 labelPaint.setColor(SK_ColorWHITE); 44 labelPaint.setColor(SK_ColorWHITE);
45 labelPaint.setTextSize(SkIntToScalar(kLabelTextSize)); 45 labelPaint.setTextSize(SkIntToScalar(kLabelTextSize));
46 sk_tool_utils::set_portable_typeface(&labelPaint);
46 SkPaint linePaint; 47 SkPaint linePaint;
47 linePaint.setColor(SK_ColorWHITE); 48 linePaint.setColor(SK_ColorWHITE);
48 49
49 // Drawing labels is useful for debugging, but bad for baselining (x-pla tform txt diffs). 50 // Draw row labels
50 if (false) { 51 canvas->save();
51 // Draw row labels 52 canvas->translate(0, SkIntToScalar(kLabelOffsetY));
52 canvas->save(); 53 for (int i = 0; i <= kSubPixelSteps; ++i) {
53 canvas->translate(0, SkIntToScalar(kLabelOffsetY)); 54 offset.printf("%d", i);
54 for (int i = 0; i <= kSubPixelSteps; ++i) { 55 canvas->drawText(offset.c_str(), offset.size(),
55 offset.printf("%d", i); 56 0, i * kTrans + labelPaint.getTextSize(),
56 canvas->drawText(offset.c_str(), offset.size(), 57 labelPaint);
57 0, i * kTrans + labelPaint.getTextSize(), 58 }
58 labelPaint); 59 canvas->restore();
59 }
60 canvas->restore();
61 60
62 // Draw col labels 61 // Draw col labels
63 canvas->save(); 62 canvas->save();
64 canvas->translate(SkIntToScalar(kLabelOffsetX), 0); 63 canvas->translate(SkIntToScalar(kLabelOffsetX), 0);
65 for (int i = 0; i <= kSubPixelSteps; ++i) { 64 for (int i = 0; i <= kSubPixelSteps; ++i) {
66 offset.printf("%d", i); 65 offset.printf("%d", i);
67 canvas->drawText(offset.c_str(), offset.size(), 66 canvas->drawText(offset.c_str(), offset.size(),
68 i * SkIntToScalar(kTrans), labelPaint.getTe xtSize(), 67 i * SkIntToScalar(kTrans), labelPaint.getTex tSize(),
69 labelPaint); 68 labelPaint);
70 } 69 }
71 canvas->restore(); 70 canvas->restore();
72 }
73 71
74 canvas->translate(SkIntToScalar(kLabelOffsetX), SkIntToScalar(kLabelOffs etY)); 72 canvas->translate(SkIntToScalar(kLabelOffsetX), SkIntToScalar(kLabelOffs etY));
75 73
76 // Draw test case grid lines (Draw them all at pixel centers to hopefull y avoid any 74 // Draw test case grid lines (Draw them all at pixel centers to hopefull y avoid any
77 // snapping issues). 75 // snapping issues).
78 for (int i = 0; i <= kSubPixelSteps + 1; ++i) { 76 for (int i = 0; i <= kSubPixelSteps + 1; ++i) {
79 canvas->drawLine(0.5f, 77 canvas->drawLine(0.5f,
80 i * SkIntToScalar(kTrans) + 0.5f, 78 i * SkIntToScalar(kTrans) + 0.5f,
81 SkIntToScalar(kTrans) * (kSubPixelSteps + 1) + 0.5f , 79 SkIntToScalar(kTrans) * (kSubPixelSteps + 1) + 0.5f ,
82 i * SkIntToScalar(kTrans) + 0.5f, 80 i * SkIntToScalar(kTrans) + 0.5f,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 170
173 private: 171 private:
174 typedef PixelSnapGM INHERITED; 172 typedef PixelSnapGM INHERITED;
175 }; 173 };
176 174
177 ////////////////////////////////////////////////////////////////////////////// 175 //////////////////////////////////////////////////////////////////////////////
178 DEF_GM( return SkNEW(PointSnapGM); ) 176 DEF_GM( return SkNEW(PointSnapGM); )
179 DEF_GM( return SkNEW(LineSnapGM); ) 177 DEF_GM( return SkNEW(LineSnapGM); )
180 DEF_GM( return SkNEW(RectSnapGM); ) 178 DEF_GM( return SkNEW(RectSnapGM); )
181 DEF_GM( return SkNEW(ComboSnapGM); ) 179 DEF_GM( return SkNEW(ComboSnapGM); )
OLDNEW
« no previous file with comments | « gm/imageblur2.cpp ('k') | gm/poly2poly.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698