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

Side by Side Diff: gm/pixelxorxfermode.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 2016 Google Inc. 2 * Copyright 2016 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 "Resources.h" 9 #include "Resources.h"
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 void onDraw(SkCanvas* canvas) override { 32 void onDraw(SkCanvas* canvas) override {
33 canvas->drawBitmap(fBM, 0, 0); 33 canvas->drawBitmap(fBM, 0, 0);
34 34
35 SkRect r = SkRect::MakeIWH(256, 256); 35 SkRect r = SkRect::MakeIWH(256, 256);
36 36
37 // Negate the red channel of the dst (via the ancillary color) but leave 37 // Negate the red channel of the dst (via the ancillary color) but leave
38 // the green & blue channels alone 38 // the green & blue channels alone
39 SkPaint p1; 39 SkPaint p1;
40 p1.setColor(SK_ColorBLACK); // noop 40 p1.setColor(SK_ColorBLACK); // noop
41 p1.setXfermode(SkPixelXorXfermode::Create(0x7FFF0000))->unref(); 41 p1.setXfermode(SkPixelXorXfermode::Make(0x7FFF0000));
42 42
43 canvas->drawRect(r, p1); 43 canvas->drawRect(r, p1);
44 44
45 r.offsetTo(256.0f, 0.0f); 45 r.offsetTo(256.0f, 0.0f);
46 46
47 // Negate the dst color via the src color 47 // Negate the dst color via the src color
48 SkPaint p2; 48 SkPaint p2;
49 p2.setColor(SK_ColorWHITE); 49 p2.setColor(SK_ColorWHITE);
50 p2.setXfermode(SkPixelXorXfermode::Create(SK_ColorBLACK))->unref(); // n oop 50 p2.setXfermode(SkPixelXorXfermode::Make(SK_ColorBLACK)); // noop
51 51
52 canvas->drawRect(r, p2); 52 canvas->drawRect(r, p2);
53 53
54 r.offsetTo(0.0f, 256.0f); 54 r.offsetTo(0.0f, 256.0f);
55 55
56 // Just return the original color 56 // Just return the original color
57 SkPaint p3; 57 SkPaint p3;
58 p3.setColor(SK_ColorBLACK); // noop 58 p3.setColor(SK_ColorBLACK); // noop
59 p3.setXfermode(SkPixelXorXfermode::Create(SK_ColorBLACK))->unref(); // n oop 59 p3.setXfermode(SkPixelXorXfermode::Make(SK_ColorBLACK)); // noop
60 60
61 canvas->drawRect(r, p3); 61 canvas->drawRect(r, p3);
62 62
63 r.offsetTo(256.0f, 256.0f); 63 r.offsetTo(256.0f, 256.0f);
64 64
65 // Negate the red & green channels (via the ancillary color) but leave 65 // Negate the red & green channels (via the ancillary color) but leave
66 // the blue channel alone 66 // the blue channel alone
67 SkPaint p4; 67 SkPaint p4;
68 p4.setColor(SK_ColorBLACK); // noop 68 p4.setColor(SK_ColorBLACK); // noop
69 p4.setXfermode(SkPixelXorXfermode::Create(SK_ColorYELLOW))->unref(); 69 p4.setXfermode(SkPixelXorXfermode::Make(SK_ColorYELLOW));
70 70
71 canvas->drawRect(r, p4); 71 canvas->drawRect(r, p4);
72 } 72 }
73 73
74 private: 74 private:
75 SkBitmap fBM; 75 SkBitmap fBM;
76 76
77 typedef GM INHERITED; 77 typedef GM INHERITED;
78 }; 78 };
79 79
80 ////////////////////////////////////////////////////////////////////////////// 80 //////////////////////////////////////////////////////////////////////////////
81 81
82 DEF_GM(return new PixelXorXfermodeGM;) 82 DEF_GM(return new PixelXorXfermodeGM;)
OLDNEW
« no previous file with comments | « gm/patch.cpp ('k') | gm/vertices.cpp » ('j') | include/effects/SkXfermodeImageFilter.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698