Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: gm/lcdoverlap.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/lcdblendmodes.cpp ('k') | gm/patch.cpp » ('j') | include/effects/SkXfermodeImageFilter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698