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

Side by Side Diff: gm/pixelxorxfermode.cpp

Issue 1853103005: remove avoid and pixelxor xfermodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update factory counts 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
« no previous file with comments | « gm/avoidxfermode3.cpp ('k') | gm/xfermodes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm.h"
9 #include "Resources.h"
10
11 #include "SkPixelXorXfermode.h"
12 #include "SkStream.h"
13
14 class PixelXorXfermodeGM : public skiagm::GM {
15 public:
16 PixelXorXfermodeGM() { }
17
18 protected:
19 SkString onShortName() override {
20 return SkString("pixelxorxfermode");
21 }
22
23 SkISize onISize() override { return SkISize::Make(512, 512); }
24
25 void onOnceBeforeDraw() override {
26 if (!GetResourceAsBitmap("mandrill_512.png", &fBM)) {
27 fBM.allocN32Pixels(1, 1);
28 fBM.eraseARGB(255, 255, 0 , 0); // red == bad
29 }
30 }
31
32 void onDraw(SkCanvas* canvas) override {
33 canvas->drawBitmap(fBM, 0, 0);
34
35 SkRect r = SkRect::MakeIWH(256, 256);
36
37 // Negate the red channel of the dst (via the ancillary color) but leave
38 // the green & blue channels alone
39 SkPaint p1;
40 p1.setColor(SK_ColorBLACK); // noop
41 p1.setXfermode(SkPixelXorXfermode::Make(0x7FFF0000));
42
43 canvas->drawRect(r, p1);
44
45 r.offsetTo(256.0f, 0.0f);
46
47 // Negate the dst color via the src color
48 SkPaint p2;
49 p2.setColor(SK_ColorWHITE);
50 p2.setXfermode(SkPixelXorXfermode::Make(SK_ColorBLACK)); // noop
51
52 canvas->drawRect(r, p2);
53
54 r.offsetTo(0.0f, 256.0f);
55
56 // Just return the original color
57 SkPaint p3;
58 p3.setColor(SK_ColorBLACK); // noop
59 p3.setXfermode(SkPixelXorXfermode::Make(SK_ColorBLACK)); // noop
60
61 canvas->drawRect(r, p3);
62
63 r.offsetTo(256.0f, 256.0f);
64
65 // Negate the red & green channels (via the ancillary color) but leave
66 // the blue channel alone
67 SkPaint p4;
68 p4.setColor(SK_ColorBLACK); // noop
69 p4.setXfermode(SkPixelXorXfermode::Make(SK_ColorYELLOW));
70
71 canvas->drawRect(r, p4);
72 }
73
74 private:
75 SkBitmap fBM;
76
77 typedef GM INHERITED;
78 };
79
80 //////////////////////////////////////////////////////////////////////////////
81
82 DEF_GM(return new PixelXorXfermodeGM;)
OLDNEW
« no previous file with comments | « gm/avoidxfermode3.cpp ('k') | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698