Chromium Code Reviews| 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 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 } | 222 } |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 return xfermode->asXPFactory(xpf); | 225 return xfermode->asXPFactory(xpf); |
| 226 } | 226 } |
| 227 | 227 |
| 228 SK_TO_STRING_PUREVIRT() | 228 SK_TO_STRING_PUREVIRT() |
| 229 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 229 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 230 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 230 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
| 231 | 231 |
| 232 enum PM4fFlags { | |
|
mtklein
2016/02/01 22:53:52
We may want to split these up / mark these as requ
reed1
2016/02/02 14:20:54
I combined them just for convenience. Happy to con
| |
| 233 kSrcIsOpaque_PM4fFlag = 1 << 0, | |
| 234 kDstIsSRGB_PM4fFlag = 1 << 1, | |
| 235 }; | |
| 236 struct PM4fState { | |
| 237 const SkXfermode* fXfer; | |
| 238 uint32_t fFlags; | |
| 239 }; | |
| 240 typedef void (*PM4fProc1)(const PM4fState&, uint32_t dst[], const SkPM4f& sr c, | |
| 241 int count, const SkAlpha coverage[]); | |
| 242 typedef void (*PM4fProcN)(const PM4fState&, uint32_t dst[], const SkPM4f src [], | |
| 243 int count, const SkAlpha coverage[]); | |
| 244 static PM4fProc1 GetPM4fProc1(Mode, uint32_t flags); | |
| 245 static PM4fProcN GetPM4fProcN(Mode, uint32_t flags); | |
| 246 virtual PM4fProc1 getPM4fProc1(uint32_t flags) const; | |
| 247 virtual PM4fProcN getPM4fProcN(uint32_t flags) const; | |
| 248 | |
| 232 protected: | 249 protected: |
| 233 SkXfermode() {} | 250 SkXfermode() {} |
| 234 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 251 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
| 235 method, 1 color at a time (upscaled to a SkPMColor). The default | 252 method, 1 color at a time (upscaled to a SkPMColor). The default |
| 236 implementation of this method just returns dst. If performance is | 253 implementation of this method just returns dst. If performance is |
| 237 important, your subclass should override xfer32/xfer16/xferA8 directly. | 254 important, your subclass should override xfer32/xfer16/xferA8 directly. |
| 238 | 255 |
| 239 This method will not be called directly by the client, so it need not | 256 This method will not be called directly by the client, so it need not |
| 240 be implemented if your subclass has overridden xfer32/xfer16/xferA8 | 257 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
| 241 */ | 258 */ |
| 242 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; | 259 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; |
| 243 | 260 |
| 244 private: | 261 private: |
| 245 enum { | 262 enum { |
| 246 kModeCount = kLastMode + 1 | 263 kModeCount = kLastMode + 1 |
| 247 }; | 264 }; |
| 248 | 265 |
| 249 // TODO(benjaminwagner): This is crazy, but it fixes the Google3 Android bui ld. :-( | 266 // TODO(benjaminwagner): This is crazy, but it fixes the Google3 Android bui ld. :-( |
| 250 virtual void doNothing() const; | 267 virtual void doNothing() const; |
| 251 | 268 |
| 252 typedef SkFlattenable INHERITED; | 269 typedef SkFlattenable INHERITED; |
| 253 }; | 270 }; |
| 254 | 271 |
| 255 #endif | 272 #endif |
| OLD | NEW |