Flutter Engine
 
Loading...
Searching...
No Matches
dl_runtime_effect_image_filter.h
Go to the documentation of this file.
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_DISPLAY_LIST_EFFECTS_IMAGE_FILTERS_DL_RUNTIME_EFFECT_IMAGE_FILTER_H_
6#define FLUTTER_DISPLAY_LIST_EFFECTS_IMAGE_FILTERS_DL_RUNTIME_EFFECT_IMAGE_FILTER_H_
7
9
12
13namespace flutter {
14
16 public:
18 sk_sp<DlRuntimeEffect> runtime_effect,
19 std::vector<std::shared_ptr<DlColorSource>> samplers,
20 std::shared_ptr<std::vector<uint8_t>> uniform_data)
21 : runtime_effect_(std::move(runtime_effect)),
22 samplers_(std::move(samplers)),
23 uniform_data_(std::move(uniform_data)) {}
24
25 std::shared_ptr<DlImageFilter> shared() const override {
26 return std::make_shared<DlRuntimeEffectImageFilter>(
27 this->runtime_effect_, this->samplers_, this->uniform_data_);
28 }
29
30 static std::shared_ptr<DlImageFilter> Make(
31 sk_sp<DlRuntimeEffect> runtime_effect,
32 std::vector<std::shared_ptr<DlColorSource>> samplers,
33 std::shared_ptr<std::vector<uint8_t>> uniform_data);
34
35 DlImageFilterType type() const override {
37 }
38 size_t size() const override { return sizeof(*this); }
39
40 bool modifies_transparent_black() const override { return false; }
41
42 DlRect* map_local_bounds(const DlRect& input_bounds,
43 DlRect& output_bounds) const override;
44
45 DlIRect* map_device_bounds(const DlIRect& input_bounds,
46 const DlMatrix& ctm,
47 DlIRect& output_bounds) const override;
48
49 DlIRect* get_input_device_bounds(const DlIRect& output_bounds,
50 const DlMatrix& ctm,
51 DlIRect& input_bounds) const override;
52
54 return this;
55 }
56
57 const sk_sp<DlRuntimeEffect> runtime_effect() const {
58 return runtime_effect_;
59 }
60
61 const std::vector<std::shared_ptr<DlColorSource>>& samplers() const {
62 return samplers_;
63 }
64
65 const std::shared_ptr<std::vector<uint8_t>>& uniform_data() const {
66 return uniform_data_;
67 }
68
69 protected:
70 bool equals_(const DlImageFilter& other) const override;
71
72 private:
73 sk_sp<DlRuntimeEffect> runtime_effect_;
74 std::vector<std::shared_ptr<DlColorSource>> samplers_;
75 std::shared_ptr<std::vector<uint8_t>> uniform_data_;
76};
77
78} // namespace flutter
79
80#endif // FLUTTER_DISPLAY_LIST_EFFECTS_IMAGE_FILTERS_DL_RUNTIME_EFFECT_IMAGE_FILTER_H_
std::shared_ptr< DlImageFilter > shared() const override
bool equals_(const DlImageFilter &other) const override
const DlRuntimeEffectImageFilter * asRuntimeEffectFilter() const override
DlIRect * map_device_bounds(const DlIRect &input_bounds, const DlMatrix &ctm, DlIRect &output_bounds) const override
const sk_sp< DlRuntimeEffect > runtime_effect() const
DlRect * map_local_bounds(const DlRect &input_bounds, DlRect &output_bounds) const override
DlRuntimeEffectImageFilter(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
const std::shared_ptr< std::vector< uint8_t > > & uniform_data() const
const std::vector< std::shared_ptr< DlColorSource > > & samplers() const
DlIRect * get_input_device_bounds(const DlIRect &output_bounds, const DlMatrix &ctm, DlIRect &input_bounds) const override
static std::shared_ptr< DlImageFilter > Make(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
Definition ref_ptr.h:261
A 4x4 matrix using column-major storage.
Definition matrix.h:37