OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 canvas->scale(3.0f, 6.0f); | 75 canvas->scale(3.0f, 6.0f); |
76 drawTestCase(canvas, 1.0f); | 76 drawTestCase(canvas, 1.0f); |
77 canvas->restore(); | 77 canvas->restore(); |
78 | 78 |
79 // Skew test. | 79 // Skew test. |
80 canvas->translate(0.0f, 80.0f); | 80 canvas->translate(0.0f, 80.0f); |
81 canvas->save(); | 81 canvas->save(); |
82 canvas->scale(3.0f, 3.0f); | 82 canvas->scale(3.0f, 3.0f); |
83 SkMatrix skew; | 83 SkMatrix skew; |
84 skew.setIdentity(); | 84 skew.setIdentity(); |
85 skew.setSkewX(8.0f / 25.0f); | 85 skew.setSkewX(SkScalarDiv(8.0f, |
86 skew.setSkewY(2.0f / 25.0f); | 86 25.0f)); |
| 87 skew.setSkewY(SkScalarDiv(2.0f, |
| 88 25.0f)); |
87 canvas->concat(skew); | 89 canvas->concat(skew); |
88 drawTestCase(canvas, 1.0f); | 90 drawTestCase(canvas, 1.0f); |
89 canvas->restore(); | 91 canvas->restore(); |
90 | 92 |
91 // Perspective test. | 93 // Perspective test. |
92 canvas->translate(0.0f, 80.0f); | 94 canvas->translate(0.0f, 80.0f); |
93 canvas->save(); | 95 canvas->save(); |
94 SkMatrix perspective; | 96 SkMatrix perspective; |
95 perspective.setIdentity(); | 97 perspective.setIdentity(); |
96 perspective.setPerspX(-SkScalarInvert(340)); | 98 perspective.setPerspX(-SkScalarDiv(SK_Scalar1, 340.0f)); |
97 perspective.setSkewX(8.0f / 25.0f); | 99 perspective.setSkewX(SkScalarDiv(8.0f, |
98 perspective.setSkewY(2.0f / 25.0f); | 100 25.0f)); |
| 101 perspective.setSkewY(SkScalarDiv(2.0f, |
| 102 25.0f)); |
99 | 103 |
100 | 104 |
101 canvas->concat(perspective); | 105 canvas->concat(perspective); |
102 drawTestCase(canvas, 1.0f); | 106 drawTestCase(canvas, 1.0f); |
103 canvas->restore(); | 107 canvas->restore(); |
104 } | 108 } |
105 | 109 |
106 void drawTestCase(SkCanvas* canvas, SkScalar textScale) { | 110 void drawTestCase(SkCanvas* canvas, SkScalar textScale) { |
107 SkPaint paint; | 111 SkPaint paint; |
108 paint.setColor(SK_ColorBLACK); | 112 paint.setColor(SK_ColorBLACK); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 192 |
189 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); | 193 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); |
190 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); | 194 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); |
191 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); | 195 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); |
192 static GMRegistry reg4(GlyphPosStrokeFactory); | 196 static GMRegistry reg4(GlyphPosStrokeFactory); |
193 static GMRegistry reg5(GlyphPosHairlineFillFactory); | 197 static GMRegistry reg5(GlyphPosHairlineFillFactory); |
194 static GMRegistry reg6(GlyphPosFillFactory); | 198 static GMRegistry reg6(GlyphPosFillFactory); |
195 | 199 |
196 | 200 |
197 } | 201 } |
OLD | NEW |