reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "SkBitmapProcShader.h" |
| 9 | #include "SkColorFilter.h" |
| 10 | #include "SkColorFilterShader.h" |
| 11 | #include "SkColorShader.h" |
| 12 | #include "SkComposeShader.h" |
| 13 | #include "SkEmptyShader.h" |
| 14 | #include "SkFlattenable.h" |
| 15 | #include "SkImageShader.h" |
| 16 | #include "SkLocalMatrixShader.h" |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 17 | #include "SkMatrixImageFilter.h" |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 18 | #include "SkOnce.h" |
| 19 | #include "SkPathEffect.h" |
| 20 | #include "SkPictureShader.h" |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 21 | #include "SkRecordedDrawable.h" |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 22 | |
| 23 | /* |
| 24 | * Registers all of the required effects subclasses for picture deserialization. |
| 25 | * |
| 26 | * Optional subclasses (e.g. Blur) should be registered in the ports/ version of this file, |
| 27 | * inside the InitEffects() method. |
| 28 | */ |
| 29 | void SkFlattenable::PrivateInitializer::InitCore() { |
| 30 | // Shader |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 31 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterShader) |
| 32 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader) |
reed | 0ccc62d | 2016-05-04 13:09:39 -0700 | [diff] [blame] | 33 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColor4Shader) |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 34 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader) |
| 35 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader) |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 36 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixShader) |
| 37 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureShader) |
| 38 | |
| 39 | // PathEffect |
| 40 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect) |
| 41 | |
| 42 | // ImageFilter |
| 43 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixImageFilter) |
| 44 | |
| 45 | // ColorFilter |
| 46 | SkColorFilter::InitializeFlattenables(); |
| 47 | |
reed | 320a40d | 2016-08-02 06:12:06 -0700 | [diff] [blame] | 48 | SkShader::InitializeFlattenables(); |
| 49 | |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 50 | // Xfermode |
| 51 | SkXfermode::InitializeFlattenables(); |
| 52 | |
msarett | 95416f4 | 2016-04-27 13:51:20 -0700 | [diff] [blame] | 53 | // Drawable |
| 54 | SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRecordedDrawable) |
| 55 | |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 56 | // Now initialize any optional/additional effects (implemented in src/ports) |
| 57 | InitEffects(); |
| 58 | }; |
| 59 | |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 60 | void SkFlattenable::InitializeFlattenablesIfNeeded() { |
mtklein | d9dd428 | 2016-04-18 08:09:11 -0700 | [diff] [blame] | 61 | static SkOnce once; |
| 62 | once(SkFlattenable::PrivateInitializer::InitCore); |
reed | 6054d68 | 2016-01-13 08:47:54 -0800 | [diff] [blame] | 63 | } |