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

Side by Side Diff: gm/avoidxfermode2.cpp

Issue 1658623002: Add gpu implementation of SkAvoidXfermode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 10 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/avoidxfermode.cpp ('k') | include/client/android/SkAvoidXfermode.h » ('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 "SkAvoidXfermode.h"
10
11 class AvoidXfermode2GM : public skiagm::GM {
12 public:
13 AvoidXfermode2GM() { }
14
15 protected:
16 SkString onShortName() override {
17 return SkString("avoidxfermode2");
18 }
19
20 SkISize onISize() override { return SkISize::Make(128, 128); }
21
22 void onDraw(SkCanvas* canvas) override {
23 canvas->drawARGB(255, 0, 0, 0);
24
25 SkRect r = SkRect::MakeXYWH(32, 32, 64, 64);
26
27 SkPaint p0;
28 p0.setColor(SK_ColorGREEN);
29 p0.setAntiAlias(false);
30
31 canvas->drawRect(r, p0);
32
33 r = SkRect::MakeIWH(64, 64);
34
35 // UL corner: replace the green with a tight tolerance
36 SkPaint p1;
37 p1.setColor(SK_ColorRED);
38 p1.setXfermode(SkAvoidXfermode::Create(SK_ColorGREEN,
39 55,
40 SkAvoidXfermode::kTargetColor_Mod e))->unref();
41
42 canvas->drawRect(r, p1);
43
44 r.offsetTo(64, 0.0f);
45
46 // UR corner: avoid the green with a tight tolerance
47 SkPaint p2;
48 p2.setColor(SK_ColorRED);
49 p2.setXfermode(SkAvoidXfermode::Create(SK_ColorGREEN,
50 200,
51 SkAvoidXfermode::kAvoidColor_Mode ))->unref();
52
53 canvas->drawRect(r, p2);
54
55 r.offsetTo(0.0f, 64);
56
57 // LL corner: replace the green with a loose tolerance
58 SkPaint p3;
59 p3.setColor(SK_ColorRED);
60 p3.setXfermode(SkAvoidXfermode::Create(SK_ColorGREEN,
61 200,
62 SkAvoidXfermode::kTargetColor_Mod e))->unref();
63
64 canvas->drawRect(r, p3);
65
66 r.offsetTo(64, 64);
67
68 // LR corner: avoid the green with a loose tolerance
69 SkPaint p4;
70 p4.setColor(SK_ColorRED);
71 p4.setXfermode(SkAvoidXfermode::Create(SK_ColorGREEN,
72 55,
73 SkAvoidXfermode::kAvoidColor_Mode ))->unref();
74
75 canvas->drawRect(r, p4);
76 }
77
78 private:
79 typedef GM INHERITED;
80 };
81
82 //////////////////////////////////////////////////////////////////////////////
83
84 DEF_GM(return new AvoidXfermode2GM;)
OLDNEW
« no previous file with comments | « gm/avoidxfermode.cpp ('k') | include/client/android/SkAvoidXfermode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698