OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCubicClipper.h" | 9 #include "SkCubicClipper.h" |
10 #include "SkGeometry.h" | 10 #include "SkGeometry.h" |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "Test.h" | 12 #include "Test.h" |
13 | 13 |
14 // Currently the supersampler blitter uses int16_t for its index into an array | 14 // Currently the supersampler blitter uses int16_t for its index into an array |
15 // the width of the clip. Test that we don't crash/assert if we try to draw | 15 // the width of the clip. Test that we don't crash/assert if we try to draw |
16 // with a device/clip that is larger. | 16 // with a device/clip that is larger. |
17 static void test_giantClip() { | 17 static void test_giantClip() { |
18 SkBitmap bm; | 18 SkBitmap bm; |
19 bm.setConfig(SkBitmap::kARGB_8888_Config, 64919, 1); | 19 bm.allocN32Pixels(64919, 1); |
20 bm.allocPixels(); | |
21 SkCanvas canvas(bm); | 20 SkCanvas canvas(bm); |
22 canvas.clear(SK_ColorTRANSPARENT); | 21 canvas.clear(SK_ColorTRANSPARENT); |
23 | 22 |
24 SkPath path; | 23 SkPath path; |
25 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(33, 1); | 24 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(33, 1); |
26 SkPaint paint; | 25 SkPaint paint; |
27 paint.setAntiAlias(true); | 26 paint.setAntiAlias(true); |
28 canvas.drawPath(path, paint); | 27 canvas.drawPath(path, paint); |
29 } | 28 } |
30 | 29 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 REPORTER_ASSERT(reporter, success == true); | 154 REPORTER_ASSERT(reporter, success == true); |
156 REPORTER_ASSERT(reporter, CurvesAreEqual(clipped, SetCurve( | 155 REPORTER_ASSERT(reporter, CurvesAreEqual(clipped, SetCurve( |
157 0, 0, | 156 0, 0, |
158 1.551193237f, 2.326789856f, | 157 1.551193237f, 2.326789856f, |
159 1.297736168f, 7.059780121f, | 158 1.297736168f, 7.059780121f, |
160 2.505550385f, 10, | 159 2.505550385f, 10, |
161 shouldbe), tol)); | 160 shouldbe), tol)); |
162 | 161 |
163 test_giantClip(); | 162 test_giantClip(); |
164 } | 163 } |
OLD | NEW |