OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkMagnifierImageFilter.h" | 9 #include "SkMagnifierImageFilter.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 SkIntToScalar(WIDTH / 2), | 38 SkIntToScalar(WIDTH / 2), |
39 SkIntToScalar(HEIGHT / 2)), | 39 SkIntToScalar(HEIGHT / 2)), |
40 100))->unref(); | 40 100))->unref(); |
41 canvas->saveLayer(NULL, &filterPaint); | 41 canvas->saveLayer(NULL, &filterPaint); |
42 const char* str = "The quick brown fox jumped over the lazy dog."; | 42 const char* str = "The quick brown fox jumped over the lazy dog."; |
43 SkRandom rand; | 43 SkRandom rand; |
44 for (int i = 0; i < 25; ++i) { | 44 for (int i = 0; i < 25; ++i) { |
45 int x = rand.nextULessThan(WIDTH); | 45 int x = rand.nextULessThan(WIDTH); |
46 int y = rand.nextULessThan(HEIGHT); | 46 int y = rand.nextULessThan(HEIGHT); |
47 SkPaint paint; | 47 SkPaint paint; |
48 sk_tool_utils::set_portable_typeface(&paint); | 48 sk_tool_utils::set_portable_typeface_always(&paint); |
49 paint.setColor(rand.nextBits(24) | 0xFF000000); | 49 paint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0xFF0
00000)); |
50 paint.setTextSize(rand.nextRangeScalar(0, 300)); | 50 paint.setTextSize(rand.nextRangeScalar(0, 300)); |
51 paint.setAntiAlias(true); | 51 paint.setAntiAlias(true); |
52 canvas->drawText(str, strlen(str), SkIntToScalar(x), | 52 canvas->drawText(str, strlen(str), SkIntToScalar(x), |
53 SkIntToScalar(y), paint); | 53 SkIntToScalar(y), paint); |
54 } | 54 } |
55 canvas->restore(); | 55 canvas->restore(); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 typedef GM INHERITED; | 59 typedef GM INHERITED; |
60 }; | 60 }; |
61 | 61 |
62 ////////////////////////////////////////////////////////////////////////////// | 62 ////////////////////////////////////////////////////////////////////////////// |
63 | 63 |
64 static GM* MyFactory(void*) { return new ImageMagnifierGM; } | 64 static GM* MyFactory(void*) { return new ImageMagnifierGM; } |
65 static GMRegistry reg(MyFactory); | 65 static GMRegistry reg(MyFactory); |
66 | 66 |
67 } | 67 } |
OLD | NEW |