OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 static SkRandom gRand; | 33 static SkRandom gRand; |
34 | 34 |
35 static void test_chromium_9005() { | 35 static void test_chromium_9005() { |
36 SkBitmap bm; | 36 SkBitmap bm; |
37 bm.setConfig(SkBitmap::kARGB_8888_Config, 800, 600); | 37 bm.setConfig(SkBitmap::kARGB_8888_Config, 800, 600); |
38 bm.allocPixels(); | 38 bm.allocPixels(); |
39 | 39 |
40 SkCanvas canvas(bm); | 40 SkCanvas canvas(bm); |
41 | 41 |
42 SkPoint pt0 = { SkFloatToScalar(799.33374f), SkFloatToScalar(1.2360189f) }; | 42 SkPoint pt0 = { 799.33374f, 1.2360189f }; |
43 SkPoint pt1 = { SkFloatToScalar(808.49969f), SkFloatToScalar(-7.4338055f) }; | 43 SkPoint pt1 = { 808.49969f, -7.4338055f }; |
44 | 44 |
45 SkPaint paint; | 45 SkPaint paint; |
46 paint.setAntiAlias(true); | 46 paint.setAntiAlias(true); |
47 canvas.drawLine(pt0.fX, pt0.fY, pt1.fX, pt1.fY, paint); | 47 canvas.drawLine(pt0.fX, pt0.fY, pt1.fX, pt1.fY, paint); |
48 } | 48 } |
49 | 49 |
50 static void generate_pts(SkPoint pts[], int count, int w, int h) { | 50 static void generate_pts(SkPoint pts[], int count, int w, int h) { |
51 for (int i = 0; i < count; i++) { | 51 for (int i = 0; i < count; i++) { |
52 pts[i].set(gRand.nextUScalar1() * 3 * w - SkIntToScalar(w), | 52 pts[i].set(gRand.nextUScalar1() * 3 * w - SkIntToScalar(w), |
53 gRand.nextUScalar1() * 3 * h - SkIntToScalar(h)); | 53 gRand.nextUScalar1() * 3 * h - SkIntToScalar(h)); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 | 271 |
272 private: | 272 private: |
273 typedef SampleView INHERITED; | 273 typedef SampleView INHERITED; |
274 }; | 274 }; |
275 | 275 |
276 ////////////////////////////////////////////////////////////////////////////// | 276 ////////////////////////////////////////////////////////////////////////////// |
277 | 277 |
278 static SkView* MyFactory() { return new HairlineView; } | 278 static SkView* MyFactory() { return new HairlineView; } |
279 static SkViewRegister reg(MyFactory); | 279 static SkViewRegister reg(MyFactory); |
OLD | NEW |