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

Side by Side Diff: include/core/SkXfermode.h

Issue 14189024: Add all remaining separable xfer modes to GPU backend. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkXfermode.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkXfermode_DEFINED 10 #ifndef SkXfermode_DEFINED
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 */ 80 */
81 static bool AsCoeff(const SkXfermode*, Coeff* src, Coeff* dst); 81 static bool AsCoeff(const SkXfermode*, Coeff* src, Coeff* dst);
82 82
83 /** List of predefined xfermodes. 83 /** List of predefined xfermodes.
84 The algebra for the modes uses the following symbols: 84 The algebra for the modes uses the following symbols:
85 Sa, Sc - source alpha and color 85 Sa, Sc - source alpha and color
86 Da, Dc - destination alpha and color (before compositing) 86 Da, Dc - destination alpha and color (before compositing)
87 [a, c] - Resulting (alpha, color) values 87 [a, c] - Resulting (alpha, color) values
88 For these equations, the colors are in premultiplied state. 88 For these equations, the colors are in premultiplied state.
89 If no xfermode is specified, kSrcOver is assumed. 89 If no xfermode is specified, kSrcOver is assumed.
90 The modes are ordered by those that can be expressed as a pair of Coeffs , followed by those
91 that aren't Coeffs but have separable r,g,b computations, and finally
92 those that are not separable.
90 */ 93 */
91 enum Mode { 94 enum Mode {
92 kClear_Mode, //!< [0, 0] 95 kClear_Mode, //!< [0, 0]
93 kSrc_Mode, //!< [Sa, Sc] 96 kSrc_Mode, //!< [Sa, Sc]
94 kDst_Mode, //!< [Da, Dc] 97 kDst_Mode, //!< [Da, Dc]
95 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] 98 kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
96 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] 99 kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
97 kSrcIn_Mode, //!< [Sa * Da, Sc * Da] 100 kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
98 kDstIn_Mode, //!< [Sa * Da, Sa * Dc] 101 kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
99 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)] 102 kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
100 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)] 103 kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
101 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc] 104 kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
102 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)] 105 kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
103 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] 106 kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
104 kPlus_Mode, //!< [Sa + Da, Sc + Dc] 107 kPlus_Mode, //!< [Sa + Da, Sc + Dc]
105 kModulate_Mode, // multiplies all components (= alpha and color) 108 kModulate_Mode, // multiplies all components (= alpha and color)
106 109
107 // Following blend modes are defined in the CSS Compositing standard: 110 // Following blend modes are defined in the CSS Compositing standard:
108 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blendi ng 111 // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blendi ng
109 kScreen_Mode, 112 kScreen_Mode,
110 // all above modes can be expressed as pair of src/dst Coeffs 113 kLastCoeffMode = kScreen_Mode,
111 kCoeffModesCnt, 114
112 kOverlay_Mode = kCoeffModesCnt, 115 kOverlay_Mode,
113 kDarken_Mode, 116 kDarken_Mode,
114 kLighten_Mode, 117 kLighten_Mode,
115 kColorDodge_Mode, 118 kColorDodge_Mode,
116 kColorBurn_Mode, 119 kColorBurn_Mode,
117 kHardLight_Mode, 120 kHardLight_Mode,
118 kSoftLight_Mode, 121 kSoftLight_Mode,
119 kDifference_Mode, 122 kDifference_Mode,
120 kExclusion_Mode, 123 kExclusion_Mode,
121 kMultiply_Mode, 124 kMultiply_Mode,
125 kLastSeparableMode = kMultiply_Mode,
122 126
123 kHue_Mode, 127 kHue_Mode,
124 kSaturation_Mode, 128 kSaturation_Mode,
125 kColor_Mode, 129 kColor_Mode,
126 kLuminosity_Mode, 130 kLuminosity_Mode,
127
128 kLastMode = kLuminosity_Mode 131 kLastMode = kLuminosity_Mode
129 }; 132 };
130 133
131 /** 134 /**
132 * Gets the name of the Mode as a string. 135 * Gets the name of the Mode as a string.
133 */ 136 */
134 static const char* ModeName(Mode); 137 static const char* ModeName(Mode);
135 138
136 /** 139 /**
137 * If the xfermode is one of the modes in the Mode enum, then asMode() 140 * If the xfermode is one of the modes in the Mode enum, then asMode()
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 fProc = proc; 269 fProc = proc;
267 } 270 }
268 271
269 private: 272 private:
270 SkXfermodeProc fProc; 273 SkXfermodeProc fProc;
271 274
272 typedef SkXfermode INHERITED; 275 typedef SkXfermode INHERITED;
273 }; 276 };
274 277
275 #endif 278 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698