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

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

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added ImageFilter derived classes safety checks (retry) Created 7 years, 3 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 dstover ida one 72 dstover ida one
73 */ 73 */
74 virtual bool asCoeff(Coeff* src, Coeff* dst) const; 74 virtual bool asCoeff(Coeff* src, Coeff* dst) const;
75 75
76 /** 76 /**
77 * The same as calling xfermode->asCoeff(..), except that this also checks 77 * The same as calling xfermode->asCoeff(..), except that this also checks
78 * if the xfermode is NULL, and if so, treats it as kSrcOver_Mode. 78 * if the xfermode is NULL, and if so, treats it as kSrcOver_Mode.
79 */ 79 */
80 static bool AsCoeff(const SkXfermode*, Coeff* src, Coeff* dst); 80 static bool AsCoeff(const SkXfermode*, Coeff* src, Coeff* dst);
81 81
82 /** Returns true if coeff's value is in the Coeff enum.
83 */
84 static bool IsValidCoeff(Coeff coeff);
reed1 2013/09/03 20:25:21 Move this to some validating helper file?
sugoi1 2013/09/04 18:01:10 Done.
85
82 /** List of predefined xfermodes. 86 /** List of predefined xfermodes.
83 The algebra for the modes uses the following symbols: 87 The algebra for the modes uses the following symbols:
84 Sa, Sc - source alpha and color 88 Sa, Sc - source alpha and color
85 Da, Dc - destination alpha and color (before compositing) 89 Da, Dc - destination alpha and color (before compositing)
86 [a, c] - Resulting (alpha, color) values 90 [a, c] - Resulting (alpha, color) values
87 For these equations, the colors are in premultiplied state. 91 For these equations, the colors are in premultiplied state.
88 If no xfermode is specified, kSrcOver is assumed. 92 If no xfermode is specified, kSrcOver is assumed.
89 The modes are ordered by those that can be expressed as a pair of Coeffs , followed by those 93 The modes are ordered by those that can be expressed as a pair of Coeffs , followed by those
90 that aren't Coeffs but have separable r,g,b computations, and finally 94 that aren't Coeffs but have separable r,g,b computations, and finally
91 those that are not separable. 95 those that are not separable.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 * correctly even if the xfermode is NULL (which equates to kSrcOver.) Thus 157 * correctly even if the xfermode is NULL (which equates to kSrcOver.) Thus
154 * you can say this without checking for a null... 158 * you can say this without checking for a null...
155 * 159 *
156 * If (SkXfermode::IsMode(paint.getXfermode(), 160 * If (SkXfermode::IsMode(paint.getXfermode(),
157 * SkXfermode::kDstOver_Mode)) { 161 * SkXfermode::kDstOver_Mode)) {
158 * ... 162 * ...
159 * } 163 * }
160 */ 164 */
161 static bool IsMode(const SkXfermode* xfer, Mode mode); 165 static bool IsMode(const SkXfermode* xfer, Mode mode);
162 166
167 /** Returns true if mode's value is in the Mode enum.
168 */
169 static bool IsValidMode(Mode mode);
170
163 /** Return an SkXfermode object for the specified mode. 171 /** Return an SkXfermode object for the specified mode.
164 */ 172 */
165 static SkXfermode* Create(Mode mode); 173 static SkXfermode* Create(Mode mode);
166 174
167 /** Return a function pointer to a routine that applies the specified 175 /** Return a function pointer to a routine that applies the specified
168 porter-duff transfer mode. 176 porter-duff transfer mode.
169 */ 177 */
170 static SkXfermodeProc GetProc(Mode mode); 178 static SkXfermodeProc GetProc(Mode mode);
171 179
172 /** Return a function pointer to a routine that applies the specified 180 /** Return a function pointer to a routine that applies the specified
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 fProc = proc; 279 fProc = proc;
272 } 280 }
273 281
274 private: 282 private:
275 SkXfermodeProc fProc; 283 SkXfermodeProc fProc;
276 284
277 typedef SkXfermode INHERITED; 285 typedef SkXfermode INHERITED;
278 }; 286 };
279 287
280 #endif 288 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698