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

Side by Side Diff: gm/avoidxfermode.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 | « no previous file | gm/avoidxfermode2.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 SkPaint p2; 60 SkPaint p2;
61 p2.setColor(SK_ColorBLACK); 61 p2.setColor(SK_ColorBLACK);
62 p2.setXfermode(SkAvoidXfermode::Create(SK_ColorWHITE, 62 p2.setXfermode(SkAvoidXfermode::Create(SK_ColorWHITE,
63 250, 63 250,
64 SkAvoidXfermode::kAvoidColor_Mode ))->unref(); 64 SkAvoidXfermode::kAvoidColor_Mode ))->unref();
65 65
66 canvas->drawRect(r, p2); 66 canvas->drawRect(r, p2);
67 67
68 r.offsetTo(0.0f, 64); 68 r.offsetTo(0.0f, 64);
69 69
70 // LL corner: replace red with blue with a loose tolerance 70 // LL corner: replace red with transparent blue with a loose tolerance
71 SkPaint p3; 71 SkPaint p3;
72 p3.setColor(SK_ColorBLUE); 72 p3.setColor(0x7F0000FF);
73 p3.setXfermode(SkAvoidXfermode::Create(SK_ColorRED, 73 p3.setXfermode(SkAvoidXfermode::Create(SK_ColorRED,
74 250, 74 250,
75 SkAvoidXfermode::kTargetColor_Mod e))->unref(); 75 SkAvoidXfermode::kTargetColor_Mod e))->unref();
76 76
77 canvas->drawRect(r, p3); 77 canvas->drawRect(r, p3);
78 78
79 r.offsetTo(64, 64); 79 r.offsetTo(64, 64);
80 80
81 // LR corner: draw black everywhere except red with a loose tolerance 81 // LR corner: draw black everywhere except red with a loose tolerance
82 SkPaint p4; 82 SkPaint p4;
83 p4.setColor(SK_ColorBLACK); 83 p4.setColor(SK_ColorBLACK);
84 p4.setXfermode(SkAvoidXfermode::Create(SK_ColorRED, 84 p4.setXfermode(SkAvoidXfermode::Create(SK_ColorRED,
85 5, 85 5,
86 SkAvoidXfermode::kAvoidColor_Mode ))->unref(); 86 SkAvoidXfermode::kAvoidColor_Mode ))->unref();
87 87
88 canvas->drawRect(r, p4); 88 canvas->drawRect(r, p4);
89 } 89 }
90 90
91 private: 91 private:
92 SkBitmap fBM; 92 SkBitmap fBM;
93 93
94 typedef GM INHERITED; 94 typedef GM INHERITED;
95 }; 95 };
96 96
97 ////////////////////////////////////////////////////////////////////////////// 97 //////////////////////////////////////////////////////////////////////////////
98 98
99 DEF_GM(return new AvoidXfermodeGM;) 99 DEF_GM(return new AvoidXfermodeGM;)
OLDNEW
« no previous file with comments | « no previous file | gm/avoidxfermode2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698