Flutter Engine
 
Loading...
Searching...
No Matches
dl_runtime_effect_color_source.cc
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
6
7namespace flutter {
8
10 sk_sp<DlRuntimeEffect> runtime_effect,
11 std::vector<std::shared_ptr<DlColorSource>> samplers,
12 std::shared_ptr<std::vector<uint8_t>> uniform_data)
13 : runtime_effect_(std::move(runtime_effect)),
14 samplers_(std::move(samplers)),
15 uniform_data_(std::move(uniform_data)) {}
16
17std::shared_ptr<DlColorSource> DlRuntimeEffectColorSource::shared() const {
18 return std::make_shared<DlRuntimeEffectColorSource>(runtime_effect_, //
19 samplers_, //
20 uniform_data_);
21}
22
24 for (const auto& sampler : samplers_) {
25 if (!sampler->isUIThreadSafe()) {
26 return false;
27 }
28 }
29 return true;
30}
31
34 auto that = static_cast<DlRuntimeEffectColorSource const*>(&other);
35 if (runtime_effect_ != that->runtime_effect_) {
36 return false;
37 }
38 if (uniform_data_ != that->uniform_data_) {
39 return false;
40 }
41 if (samplers_.size() != that->samplers_.size()) {
42 return false;
43 }
44 for (size_t i = 0; i < samplers_.size(); i++) {
45 if (samplers_[i] != that->samplers_[i]) {
46 return false;
47 }
48 }
49 return true;
50}
51
52} // namespace flutter
virtual T type() const =0
std::shared_ptr< DlColorSource > shared() const override
DlRuntimeEffectColorSource(sk_sp< DlRuntimeEffect > runtime_effect, std::vector< std::shared_ptr< DlColorSource > > samplers, std::shared_ptr< std::vector< uint8_t > > uniform_data)
bool isUIThreadSafe() const override
If the underlying platform data held by this object is held in a way that it can be stored and potent...
bool equals_(DlColorSource const &other) const override
#define FML_DCHECK(condition)
Definition logging.h:122
Definition ref_ptr.h:261