OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkOverdrawMode.h" | 9 #include "SkOverdrawMode.h" |
10 #include "SkString.h" | 10 #include "SkString.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 nextIdx = 11 - (SkColorGetG(dst)+22)/45; | 284 nextIdx = 11 - (SkColorGetG(dst)+22)/45; |
285 } | 285 } |
286 SkASSERT(nextIdx < (int)SK_ARRAY_COUNT(gTable)); | 286 SkASSERT(nextIdx < (int)SK_ARRAY_COUNT(gTable)); |
287 | 287 |
288 return gTable[nextIdx]; | 288 return gTable[nextIdx]; |
289 } | 289 } |
290 | 290 |
291 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOverdrawXfermode) | 291 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOverdrawXfermode) |
292 | 292 |
293 #if SK_SUPPORT_GPU | 293 #if SK_SUPPORT_GPU |
294 bool asFragmentProcessor(const GrFragmentProcessor** output, | 294 const GrFragmentProcessor* getFragmentProcessorForImageFilter( |
295 const GrFragmentProcessor* dst) const override { | 295 const GrFragmentProcessor* dst)
const override { |
296 if (output) { | 296 return GrOverdrawFP::Create(dst); |
297 *output = GrOverdrawFP::Create(dst); | |
298 } | |
299 return true; | |
300 } | 297 } |
301 | 298 |
302 bool asXPFactory(GrXPFactory** xpf) const override { | 299 GrXPFactory* asXPFactory() const override { |
303 if (xpf) { | 300 return GrOverdrawXPFactory::Create(); |
304 *xpf = GrOverdrawXPFactory::Create(); | |
305 } | |
306 return true; | |
307 } | 301 } |
308 #endif | 302 #endif |
309 | 303 |
310 #ifndef SK_IGNORE_TO_STRING | 304 #ifndef SK_IGNORE_TO_STRING |
311 void toString(SkString* str) const override { str->set("SkOverdrawXfermode")
; } | 305 void toString(SkString* str) const override { str->set("SkOverdrawXfermode")
; } |
312 #endif | 306 #endif |
313 | 307 |
314 private: | 308 private: |
315 friend class SkOverdrawMode; | 309 friend class SkOverdrawMode; |
316 | 310 |
317 void flatten(SkWriteBuffer& buffer) const override { } | 311 void flatten(SkWriteBuffer& buffer) const override { } |
318 | 312 |
319 typedef SkXfermode INHERITED; | 313 typedef SkXfermode INHERITED; |
320 }; | 314 }; |
321 | 315 |
322 SkFlattenable* SkOverdrawXfermode::CreateProc(SkReadBuffer& buffer) { | 316 SkFlattenable* SkOverdrawXfermode::CreateProc(SkReadBuffer& buffer) { |
323 return Create(); | 317 return Create(); |
324 } | 318 } |
325 | 319 |
326 SkXfermode* SkOverdrawMode::Create() { return new SkOverdrawXfermode; } | 320 SkXfermode* SkOverdrawMode::Create() { return new SkOverdrawXfermode; } |
327 | 321 |
328 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkOverdrawMode) | 322 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkOverdrawMode) |
329 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOverdrawXfermode) | 323 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOverdrawXfermode) |
330 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 324 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |