• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 
16 #ifndef RENDER_SERVICE_BASE_RENDER_RENDER_RS_COMPLEX_SHADER_H
17 #define RENDER_SERVICE_BASE_RENDER_RENDER_RS_COMPLEX_SHADER_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "common/rs_macros.h"
24 #include "animation/rs_interpolator.h"
25 #include "effect/runtime_effect.h"
26 #include "ext/gex_complex_shader.h"
27 #include "platform/common/rs_log.h"
28 #include "rs_shader.h"
29 
30 namespace OHOS {
31 namespace Rosen {
32 
33 class RSB_EXPORT RSComplexShader : public RSShader {
34 public:
35     RSComplexShader();
36     RSComplexShader(GexComplexShaderType type);
37     ~RSComplexShader() = default;
38 
39     void MakeDrawingShader(const RectF& rect, const std::vector<float>& params) override;
40     const std::shared_ptr<Drawing::ShaderEffect>& GetDrawingShader() const override;
41 
42     bool Marshalling(Parcel& parcel) override;
43     bool Unmarshalling(Parcel& parcel, bool& needReset) override;
44 
45 private:
46     std::shared_ptr<Drawing::ShaderEffect> GetShaderEffect(
47         const std::vector<float> &effectParam, const Drawing::RectF &rect);
48     GexComplexShaderType GetShaderType() const;
49     GexComplexShaderType shaderType_ = GexComplexShaderType::NONE;
50     std::shared_ptr<Drawing::ShaderEffect> shaderEffect_;
51 };
52 }  // namespace Rosen
53 }  // namespace OHOS
54 
55 #endif  // RENDER_SERVICE_BASE_RENDER_RENDER_RS_COMPLEX_SHADER_H
56