| 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 #ifndef SkColorFilterShader_DEFINED | 8 #ifndef SkColorFilterShader_DEFINED |
| 9 #define SkColorFilterShader_DEFINED | 9 #define SkColorFilterShader_DEFINED |
| 10 | 10 |
| 11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
| 12 #include "SkShader.h" | 12 #include "SkShader.h" |
| 13 | 13 |
| 14 class SkColorFilterShader : public SkShader { | 14 class SkColorFilterShader : public SkShader { |
| 15 public: | 15 public: |
| 16 SkColorFilterShader(SkShader* shader, SkColorFilter* filter); | 16 SkColorFilterShader(SkShader* shader, SkColorFilter* filter); |
| 17 | 17 |
| 18 size_t contextSize(const ContextRec&) const override; |
| 19 |
| 18 #if SK_SUPPORT_GPU | 20 #if SK_SUPPORT_GPU |
| 19 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 21 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
| 20 const SkMatrix& viewM, | 22 const SkMatrix& viewM, |
| 21 const SkMatrix* localMatrix, | 23 const SkMatrix* localMatrix, |
| 22 SkFilterQuality) const overri
de; | 24 SkFilterQuality) const overri
de; |
| 23 #endif | 25 #endif |
| 24 | 26 |
| 25 class FilterShaderContext : public SkShader::Context { | 27 class FilterShaderContext : public SkShader::Context { |
| 26 public: | 28 public: |
| 27 // Takes ownership of shaderContext and calls its destructor. | 29 // Takes ownership of shaderContext and calls its destructor. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 SkShader::Context* fShaderContext; | 44 SkShader::Context* fShaderContext; |
| 43 | 45 |
| 44 typedef SkShader::Context INHERITED; | 46 typedef SkShader::Context INHERITED; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 SK_TO_STRING_OVERRIDE() | 49 SK_TO_STRING_OVERRIDE() |
| 48 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterShader) | 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterShader) |
| 49 | 51 |
| 50 protected: | 52 protected: |
| 51 void flatten(SkWriteBuffer&) const override; | 53 void flatten(SkWriteBuffer&) const override; |
| 52 size_t onContextSize(const ContextRec&) const override; | |
| 53 Context* onCreateContext(const ContextRec&, void* storage) const override; | 54 Context* onCreateContext(const ContextRec&, void* storage) const override; |
| 54 | 55 |
| 56 |
| 55 private: | 57 private: |
| 56 SkAutoTUnref<SkShader> fShader; | 58 SkAutoTUnref<SkShader> fShader; |
| 57 SkAutoTUnref<SkColorFilter> fFilter; | 59 SkAutoTUnref<SkColorFilter> fFilter; |
| 58 | 60 |
| 59 typedef SkShader INHERITED; | 61 typedef SkShader INHERITED; |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 #endif | 64 #endif |
| OLD | NEW |