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

Side by Side Diff: gm/avoidxfermode3.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/avoidxfermode2.cpp ('k') | gm/pixelxorxfermode.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
10 #include "SkAvoidXfermode.h"
11
12 // This GM exercises how the avoid xfer mode interacts with partial coverage
13 class AvoidXfermode3GM : public skiagm::GM {
14 public:
15 AvoidXfermode3GM() { }
16
17 protected:
18 SkString onShortName() override {
19 return SkString("avoidxfermode3");
20 }
21
22 SkISize onISize() override { return SkISize::Make(128, 128); }
23
24 void onDraw(SkCanvas* canvas) override {
25 canvas->drawARGB(255, 0, 0, 0);
26
27 SkRect r = SkRect::MakeXYWH(16.5f, 16.5f, 96.0f, 96.0f);
28
29 SkPaint p0;
30 p0.setColor(SK_ColorWHITE);
31 p0.setAntiAlias(true);
32
33 canvas->drawRect(r, p0);
34
35 r = SkRect::MakeXYWH(3.5f, 3.5f, 59.0f, 59.0f);
36
37 // UL corner: replace white with green with a tight tolerance
38 SkPaint p1;
39 p1.setColor(SK_ColorGREEN);
40 p1.setAntiAlias(true);
41 p1.setXfermode(SkAvoidXfermode::Make(SK_ColorWHITE, 5, SkAvoidXfermode:: kTargetColor_Mode));
42
43 canvas->drawRect(r, p1);
44
45 r.offsetTo(65.5f, 3.5f);
46
47 // UR corner: draw red everywhere except white with a tight tolerance
48 SkPaint p2;
49 p2.setColor(SK_ColorRED);
50 p2.setAntiAlias(true);
51 p2.setXfermode(SkAvoidXfermode::Make(SK_ColorWHITE, 250,
52 SkAvoidXfermode::kAvoidColor_Mode)) ;
53
54 canvas->drawRect(r, p2);
55
56 r.offsetTo(3.5f, 65.5f);
57
58 // LL corner: replace white with blue with a loose tolerance
59 SkPaint p3;
60 p3.setColor(SK_ColorBLUE);
61 p3.setAntiAlias(true);
62 p3.setXfermode(SkAvoidXfermode::Make(SK_ColorWHITE, 250,
63 SkAvoidXfermode::kTargetColor_Mode) );
64
65 canvas->drawRect(r, p3);
66
67 r.offsetTo(65.5f, 65.5f);
68
69 // LR corner: draw yellow everywhere except white with a loose tolerance
70 SkPaint p4;
71 p4.setColor(SK_ColorYELLOW);
72 p4.setAntiAlias(true);
73 p4.setXfermode(SkAvoidXfermode::Make(SK_ColorWHITE, 5, SkAvoidXfermode:: kAvoidColor_Mode));
74
75 canvas->drawRect(r, p4);
76 }
77
78 private:
79 typedef GM INHERITED;
80 };
81
82 //////////////////////////////////////////////////////////////////////////////
83
84 DEF_GM(return new AvoidXfermode3GM;)
OLDNEW
« no previous file with comments | « gm/avoidxfermode2.cpp ('k') | gm/pixelxorxfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698