| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
|---|---|
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FLUTTER_LIB_UI_PAINTING_SHADER_H_ |
| 6 | #define FLUTTER_LIB_UI_PAINTING_SHADER_H_ |
| 7 | |
| 8 | #include "flutter/flow/skia_gpu_object.h" |
| 9 | #include "flutter/lib/ui/dart_wrapper.h" |
| 10 | #include "flutter/lib/ui/ui_dart_state.h" |
| 11 | #include "third_party/skia/include/core/SkShader.h" |
| 12 | |
| 13 | namespace flutter { |
| 14 | |
| 15 | class Shader : public RefCountedDartWrappable<Shader> { |
| 16 | DEFINE_WRAPPERTYPEINFO(); |
| 17 | FML_FRIEND_MAKE_REF_COUNTED(Shader); |
| 18 | |
| 19 | public: |
| 20 | ~Shader() override; |
| 21 | |
| 22 | sk_sp<SkShader> shader() { return shader_.get(); } |
| 23 | |
| 24 | void set_shader(flutter::SkiaGPUObject<SkShader> shader) { |
| 25 | shader_ = std::move(shader); |
| 26 | } |
| 27 | |
| 28 | protected: |
| 29 | Shader(flutter::SkiaGPUObject<SkShader> shader = {}); |
| 30 | |
| 31 | private: |
| 32 | flutter::SkiaGPUObject<SkShader> shader_; |
| 33 | }; |
| 34 | |
| 35 | } // namespace flutter |
| 36 | |
| 37 | #endif // FLUTTER_LIB_UI_PAINTING_SHADER_H_ |
| 38 |