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

Side by Side Diff: gm/xfermodes.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/pixelxorxfermode.cpp ('k') | gyp/effects.gypi » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
11 #include "SkXfermode.h" 11 #include "SkXfermode.h"
12 #include "SkPM4f.h" 12 #include "SkPM4f.h"
13 13
14 #include "SkArithmeticMode.h" 14 #include "SkArithmeticMode.h"
15 #include "SkPixelXorXfermode.h"
16 #include "SkAvoidXfermode.h"
17 15
18 #define kCustomShift 16 16 #define kCustomShift 16
19 #define kCustomMask (~0xFFFF) 17 #define kCustomMask (~0xFFFF)
20 18
21 enum CustomModes { 19 enum CustomModes {
22 kArithmetic_CustomMode = 1 << kCustomShift, 20 kArithmetic_CustomMode = 1 << kCustomShift,
23 kPixelXor_CustomMode = 2 << kCustomShift,
24 kAvoid_CustomMode = 3 << kCustomShift,
25 }; 21 };
26 22
27 static sk_sp<SkXfermode> make_custom(int customMode) { 23 static sk_sp<SkXfermode> make_custom(int customMode) {
28 switch (customMode) { 24 switch (customMode) {
29 case kArithmetic_CustomMode: { 25 case kArithmetic_CustomMode: {
30 const SkScalar k1 = 0.25; 26 const SkScalar k1 = 0.25;
31 const SkScalar k2 = 0.75; 27 const SkScalar k2 = 0.75;
32 const SkScalar k3 = 0.75; 28 const SkScalar k3 = 0.75;
33 const SkScalar k4 = -0.25; 29 const SkScalar k4 = -0.25;
34 return SkArithmeticMode::Make(k1, k2, k3, k4); 30 return SkArithmeticMode::Make(k1, k2, k3, k4);
35 } 31 }
36 case kPixelXor_CustomMode:
37 return SkPixelXorXfermode::Make(0xFF88CC44);
38 case kAvoid_CustomMode:
39 return SkAvoidXfermode::Make(0xFFFF0000, 0x44, SkAvoidXfermode::kAvo idColor_Mode);
40 default: 32 default:
41 break; 33 break;
42 } 34 }
43 SkASSERT(false); 35 SkASSERT(false);
44 return nullptr; 36 return nullptr;
45 } 37 }
46 38
47 enum SrcType { 39 enum SrcType {
48 //! A WxH image with a rectangle in the lower right. 40 //! A WxH image with a rectangle in the lower right.
49 kRectangleImage_SrcType = 0x01, 41 kRectangleImage_SrcType = 0x01,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 { SkXfermode::kSoftLight_Mode, "SoftLight", kBasic_SrcType }, 93 { SkXfermode::kSoftLight_Mode, "SoftLight", kBasic_SrcType },
102 { SkXfermode::kDifference_Mode, "Difference", kBasic_SrcType }, 94 { SkXfermode::kDifference_Mode, "Difference", kBasic_SrcType },
103 { SkXfermode::kExclusion_Mode, "Exclusion", kBasic_SrcType }, 95 { SkXfermode::kExclusion_Mode, "Exclusion", kBasic_SrcType },
104 { SkXfermode::kMultiply_Mode, "Multiply", kAll_SrcType }, 96 { SkXfermode::kMultiply_Mode, "Multiply", kAll_SrcType },
105 { SkXfermode::kHue_Mode, "Hue", kBasic_SrcType }, 97 { SkXfermode::kHue_Mode, "Hue", kBasic_SrcType },
106 { SkXfermode::kSaturation_Mode, "Saturation", kBasic_SrcType }, 98 { SkXfermode::kSaturation_Mode, "Saturation", kBasic_SrcType },
107 { SkXfermode::kColor_Mode, "Color", kBasic_SrcType }, 99 { SkXfermode::kColor_Mode, "Color", kBasic_SrcType },
108 { SkXfermode::kLuminosity_Mode, "Luminosity", kBasic_SrcType }, 100 { SkXfermode::kLuminosity_Mode, "Luminosity", kBasic_SrcType },
109 101
110 { SkXfermode::Mode(0xFFFF), "Arithmetic", kBasic_SrcType + kArithmet ic_CustomMode }, 102 { SkXfermode::Mode(0xFFFF), "Arithmetic", kBasic_SrcType + kArithmet ic_CustomMode },
111 { SkXfermode::Mode(0xFFFF), "PixelXor", kBasic_SrcType + kPixelXor _CustomMode },
112 { SkXfermode::Mode(0xFFFF), "Avoid", kBasic_SrcType + kAvoid_Cu stomMode },
113 }; 103 };
114 104
115 static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst, 105 static void make_bitmaps(int w, int h, SkBitmap* src, SkBitmap* dst,
116 SkBitmap* transparent) { 106 SkBitmap* transparent) {
117 src->allocN32Pixels(w, h); 107 src->allocN32Pixels(w, h);
118 src->eraseColor(SK_ColorTRANSPARENT); 108 src->eraseColor(SK_ColorTRANSPARENT);
119 109
120 SkPaint p; 110 SkPaint p;
121 p.setAntiAlias(true); 111 p.setAntiAlias(true);
122 112
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 x0 += SkIntToScalar(400); 312 x0 += SkIntToScalar(400);
323 y0 = 0; 313 y0 = 0;
324 } 314 }
325 } 315 }
326 } 316 }
327 317
328 private: 318 private:
329 typedef GM INHERITED; 319 typedef GM INHERITED;
330 }; 320 };
331 DEF_GM( return new XfermodesGM; ) 321 DEF_GM( return new XfermodesGM; )
OLDNEW
« no previous file with comments | « gm/pixelxorxfermode.cpp ('k') | gyp/effects.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698