| OLD | NEW |
| 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 |
| 11 #define SkXfermode_DEFINED | 11 #define SkXfermode_DEFINED |
| 12 | 12 |
| 13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
| 14 #include "SkColor.h" | 14 #include "SkColor.h" |
| 15 | 15 |
| 16 class GrContext; | 16 class GrContext; |
| 17 class GrEffectRef; | 17 class GrEffectRef; |
| 18 class GrTexture; | 18 class GrTexture; |
| 19 class SkString; | 19 class SkString; |
| 20 | 20 |
| 21 /** \class SkXfermode | 21 /** \class SkXfermode |
| 22 | 22 |
| 23 SkXfermode is the base class for objects that are called to implement custom | 23 SkXfermode is the base class for objects that are called to implement custom |
| 24 "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 24 "transfer-modes" in the drawing pipeline. The static function Create(Modes) |
| 25 can be called to return an instance of any of the predefined subclasses as | 25 can be called to return an instance of any of the predefined subclasses as |
| 26 specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, | 26 specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
| 27 then objects drawn with that paint have the xfermode applied. | 27 then objects drawn with that paint have the xfermode applied. |
| 28 */ | 28 */ |
| 29 class SK_API SkXfermode : public SkFlattenable { | 29 class SK_API SkXfermode : public SkFlattenable { |
| 30 typedef SkFlattenable INHERITED; |
| 31 |
| 30 public: | 32 public: |
| 31 SK_DECLARE_INST_COUNT(SkXfermode) | 33 SK_DECLARE_INST_COUNT(SkXfermode) |
| 32 | 34 |
| 33 SkXfermode() {} | 35 SkXfermode() {} |
| 34 | 36 |
| 35 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 37 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
| 36 const SkAlpha aa[]) const; | 38 const SkAlpha aa[]) const; |
| 37 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 39 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
| 38 const SkAlpha aa[]) const; | 40 const SkAlpha aa[]) const; |
| 39 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 41 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 typedef SkFlattenable INHERITED; | |
| 241 }; | 242 }; |
| 242 | 243 |
| 243 /////////////////////////////////////////////////////////////////////////////// | 244 /////////////////////////////////////////////////////////////////////////////// |
| 244 | 245 |
| 245 /** \class SkProcXfermode | 246 /** \class SkProcXfermode |
| 246 | 247 |
| 247 SkProcXfermode is a xfermode that applies the specified proc to its colors. | 248 SkProcXfermode is a xfermode that applies the specified proc to its colors. |
| 248 This class is not exported to java. | 249 This class is not exported to java. |
| 249 */ | 250 */ |
| 250 class SkProcXfermode : public SkXfermode { | 251 class SkProcXfermode : public SkXfermode { |
| 252 typedef SkXfermode INHERITED; |
| 253 |
| 251 public: | 254 public: |
| 252 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} | 255 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} |
| 253 | 256 |
| 254 // overrides from SkXfermode | 257 // overrides from SkXfermode |
| 255 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 258 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
| 256 const SkAlpha aa[]) const SK_OVERRIDE; | 259 const SkAlpha aa[]) const SK_OVERRIDE; |
| 257 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 260 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
| 258 const SkAlpha aa[]) const SK_OVERRIDE; | 261 const SkAlpha aa[]) const SK_OVERRIDE; |
| 259 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 262 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
| 260 const SkAlpha aa[]) const SK_OVERRIDE; | 263 const SkAlpha aa[]) const SK_OVERRIDE; |
| 261 | 264 |
| 262 SK_DEVELOPER_TO_STRING() | 265 SK_DEVELOPER_TO_STRING() |
| 263 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) | 266 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) |
| 264 | 267 |
| 265 protected: | 268 protected: |
| 266 SkProcXfermode(SkFlattenableReadBuffer&); | 269 SkProcXfermode(SkFlattenableReadBuffer&); |
| 267 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 270 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 268 | 271 |
| 269 // allow subclasses to update this after we unflatten | 272 // allow subclasses to update this after we unflatten |
| 270 void setProc(SkXfermodeProc proc) { | 273 void setProc(SkXfermodeProc proc) { |
| 271 fProc = proc; | 274 fProc = proc; |
| 272 } | 275 } |
| 273 | 276 |
| 274 private: | 277 private: |
| 275 SkXfermodeProc fProc; | 278 SkXfermodeProc fProc; |
| 276 | |
| 277 typedef SkXfermode INHERITED; | |
| 278 }; | 279 }; |
| 279 | 280 |
| 280 #endif | 281 #endif |
| OLD | NEW |