OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 8 |
9 /* | 9 /* |
10 * Tests overlapping LCD text | 10 * Tests overlapping LCD text |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SkXfermode::Mode mode2) { | 53 SkXfermode::Mode mode2) { |
54 const SkColor colors[] { | 54 const SkColor colors[] { |
55 SK_ColorRED, | 55 SK_ColorRED, |
56 SK_ColorGREEN, | 56 SK_ColorGREEN, |
57 SK_ColorBLUE, | 57 SK_ColorBLUE, |
58 SK_ColorYELLOW, | 58 SK_ColorYELLOW, |
59 SK_ColorCYAN, | 59 SK_ColorCYAN, |
60 SK_ColorMAGENTA, | 60 SK_ColorMAGENTA, |
61 }; | 61 }; |
62 | 62 |
63 SkAutoTUnref<SkXfermode> xfermode(SkXfermode::Create(mode)); | 63 sk_sp<SkXfermode> xfermode(SkXfermode::Make(mode)); |
64 SkAutoTUnref<SkXfermode> xfermode2(SkXfermode::Create(mode2)); | 64 sk_sp<SkXfermode> xfermode2(SkXfermode::Make(mode2)); |
65 for (size_t i = 0; i < SK_ARRAY_COUNT(colors); i++) { | 65 for (size_t i = 0; i < SK_ARRAY_COUNT(colors); i++) { |
66 canvas->save(); | 66 canvas->save(); |
67 canvas->translate(x, y); | 67 canvas->translate(x, y); |
68 canvas->rotate(360.0f / SK_ARRAY_COUNT(colors) * i); | 68 canvas->rotate(360.0f / SK_ARRAY_COUNT(colors) * i); |
69 canvas->translate(-fBlob->bounds().width() / 2.0f + 0.5f, 0); | 69 canvas->translate(-fBlob->bounds().width() / 2.0f + 0.5f, 0); |
70 | 70 |
71 SkPaint textPaint; | 71 SkPaint textPaint; |
72 textPaint.setColor(colors[i]); | 72 textPaint.setColor(colors[i]); |
73 textPaint.setXfermode(i % 2 == 0 ? xfermode : xfermode2); | 73 textPaint.setXfermode(i % 2 == 0 ? xfermode : xfermode2); |
74 canvas->drawTextBlob(fBlob, 0, 0, textPaint); | 74 canvas->drawTextBlob(fBlob, 0, 0, textPaint); |
(...skipping 16 matching lines...) Expand all Loading... |
91 private: | 91 private: |
92 SkScalar fTextHeight; | 92 SkScalar fTextHeight; |
93 SkAutoTUnref<const SkTextBlob> fBlob; | 93 SkAutoTUnref<const SkTextBlob> fBlob; |
94 typedef skiagm::GM INHERITED; | 94 typedef skiagm::GM INHERITED; |
95 }; | 95 }; |
96 | 96 |
97 ////////////////////////////////////////////////////////////////////////////// | 97 ////////////////////////////////////////////////////////////////////////////// |
98 | 98 |
99 DEF_GM( return new LcdOverlapGM; ) | 99 DEF_GM( return new LcdOverlapGM; ) |
100 } | 100 } |
OLD | NEW |