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

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: Fixing comments Created 7 years, 2 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 */ 213 */
214 static bool AsNewEffectOrCoeff(SkXfermode*, 214 static bool AsNewEffectOrCoeff(SkXfermode*,
215 GrContext*, 215 GrContext*,
216 GrEffectRef** effect, 216 GrEffectRef** effect,
217 Coeff* src, 217 Coeff* src,
218 Coeff* dst, 218 Coeff* dst,
219 GrTexture* background = NULL); 219 GrTexture* background = NULL);
220 220
221 SkDEVCODE(virtual void toString(SkString* str) const = 0;) 221 SkDEVCODE(virtual void toString(SkString* str) const = 0;)
222 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 222 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
223 SK_DEFINE_FLATTENABLE_TYPE_CHECKING_PROCS(SkXfermode)
224
223 protected: 225 protected:
224 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} 226 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {}
225 227
226 /** The default implementation of xfer32/xfer16/xferA8 in turn call this 228 /** The default implementation of xfer32/xfer16/xferA8 in turn call this
227 method, 1 color at a time (upscaled to a SkPMColor). The default 229 method, 1 color at a time (upscaled to a SkPMColor). The default
228 implmentation of this method just returns dst. If performance is 230 implmentation of this method just returns dst. If performance is
229 important, your subclass should override xfer32/xfer16/xferA8 directly. 231 important, your subclass should override xfer32/xfer16/xferA8 directly.
230 232
231 This method will not be called directly by the client, so it need not 233 This method will not be called directly by the client, so it need not
232 be implemented if your subclass has overridden xfer32/xfer16/xferA8 234 be implemented if your subclass has overridden xfer32/xfer16/xferA8
233 */ 235 */
234 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; 236 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
235 237
236 private: 238 private:
237 enum { 239 enum {
238 kModeCount = kLastMode + 1 240 kModeCount = kLastMode + 1
239 }; 241 };
240 242
241 friend class SkGraphics; 243 friend class SkGraphics;
242 static void Term(); 244 static void Term();
243
244 typedef SkFlattenable INHERITED; 245 typedef SkFlattenable INHERITED;
245 }; 246 };
246 247
247 /////////////////////////////////////////////////////////////////////////////// 248 ///////////////////////////////////////////////////////////////////////////////
248 249
249 /** \class SkProcXfermode 250 /** \class SkProcXfermode
250 251
251 SkProcXfermode is a xfermode that applies the specified proc to its colors. 252 SkProcXfermode is a xfermode that applies the specified proc to its colors.
252 This class is not exported to java. 253 This class is not exported to java.
253 */ 254 */
254 class SkProcXfermode : public SkXfermode { 255 class SkProcXfermode : public SkXfermode {
255 public: 256 public:
256 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} 257 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {}
257 258
258 // overrides from SkXfermode 259 // overrides from SkXfermode
259 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, 260 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
260 const SkAlpha aa[]) const SK_OVERRIDE; 261 const SkAlpha aa[]) const SK_OVERRIDE;
261 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, 262 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
262 const SkAlpha aa[]) const SK_OVERRIDE; 263 const SkAlpha aa[]) const SK_OVERRIDE;
263 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, 264 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
264 const SkAlpha aa[]) const SK_OVERRIDE; 265 const SkAlpha aa[]) const SK_OVERRIDE;
265 266
266 SK_DEVELOPER_TO_STRING() 267 SK_DEVELOPER_TO_STRING()
267 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) 268 SK_DEFINE_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode)
268 269
269 protected: 270 protected:
270 SkProcXfermode(SkFlattenableReadBuffer&); 271 SkProcXfermode(SkFlattenableReadBuffer&);
271 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 272 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
272 273
273 // allow subclasses to update this after we unflatten 274 // allow subclasses to update this after we unflatten
274 void setProc(SkXfermodeProc proc) { 275 void setProc(SkXfermodeProc proc) {
275 fProc = proc; 276 fProc = proc;
276 } 277 }
277 278
278 private: 279 private:
279 SkXfermodeProc fProc; 280 SkXfermodeProc fProc;
280 281
281 typedef SkXfermode INHERITED; 282 typedef SkXfermode INHERITED;
282 }; 283 };
283 284
284 #endif 285 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698