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