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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 canvas->saveLayer(NULL, &paint); | 35 canvas->saveLayer(NULL, &paint); |
36 const char* str = "The quick brown fox jumped over the lazy dog."; | 36 const char* str = "The quick brown fox jumped over the lazy dog."; |
37 | 37 |
38 SkRandom rand; | 38 SkRandom rand; |
39 SkPaint textPaint; | 39 SkPaint textPaint; |
40 textPaint.setAntiAlias(true); | 40 textPaint.setAntiAlias(true); |
41 for (int i = 0; i < 25; ++i) { | 41 for (int i = 0; i < 25; ++i) { |
42 int x = rand.nextULessThan(WIDTH); | 42 int x = rand.nextULessThan(WIDTH); |
43 int y = rand.nextULessThan(HEIGHT); | 43 int y = rand.nextULessThan(HEIGHT); |
44 textPaint.setColor(rand.nextBits(24) | 0xFF000000); | 44 textPaint.setColor(rand.nextBits(24) | 0xFF000000); |
45 textPaint.setTextSize(rand.nextULessThan(300)); | 45 textPaint.setTextSize(rand.nextRangeScalar(0, 300)); |
46 canvas->drawText(str, strlen(str), SkIntToScalar(x), | 46 canvas->drawText(str, strlen(str), SkIntToScalar(x), |
47 SkIntToScalar(y), textPaint); | 47 SkIntToScalar(y), textPaint); |
48 } | 48 } |
49 canvas->restore(); | 49 canvas->restore(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 typedef GM INHERITED; | 53 typedef GM INHERITED; |
54 }; | 54 }; |
55 | 55 |
56 ////////////////////////////////////////////////////////////////////////////// | 56 ////////////////////////////////////////////////////////////////////////////// |
57 | 57 |
58 static GM* MyFactory(void*) { return new ImageBlurGM; } | 58 static GM* MyFactory(void*) { return new ImageBlurGM; } |
59 static GMRegistry reg(MyFactory); | 59 static GMRegistry reg(MyFactory); |
60 | 60 |
61 } | 61 } |
OLD | NEW |