Flutter Engine
 
Loading...
Searching...
No Matches
dl_gradient_color_source_base.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_COLOR_SOURCES_DL_GRADIENT_COLOR_SOURCE_BASE_H_
6#define FLUTTER_DISPLAY_LIST_EFFECTS_COLOR_SOURCES_DL_GRADIENT_COLOR_SOURCE_BASE_H_
7
9
10namespace flutter {
11
12// Utility base class common to all gradient DlColorSource implementations
14 public:
15 bool is_opaque() const override;
16
17 bool isGradient() const override { return true; }
18
19 DlTileMode tile_mode() const { return mode_; }
20 int stop_count() const { return stop_count_; }
21 const DlColor* colors() const {
22 return reinterpret_cast<const DlColor*>(pod());
23 }
24 const float* stops() const {
25 return reinterpret_cast<const float*>(colors() + stop_count());
26 }
27
28 protected:
31 const DlMatrix* matrix = nullptr);
32
33 size_t vector_sizes() const {
34 return stop_count_ * (sizeof(DlColor) + sizeof(float));
35 }
36
37 virtual const void* pod() const = 0;
38
39 bool base_equals_(DlGradientColorSourceBase const* other_base) const;
40
41 void store_color_stops(void* pod,
42 const DlColor* color_data,
43 const float* stop_data);
44
45 void store_color_stops(void* pod,
46 const DlScalar* color_data_argb,
47 const float* stop_data);
48
49 private:
50 DlTileMode mode_;
51 uint32_t stop_count_;
52
54};
55
56} // namespace flutter
57
58#endif // FLUTTER_DISPLAY_LIST_EFFECTS_COLOR_SOURCES_DL_GRADIENT_COLOR_SOURCE_BASE_H_
void store_color_stops(void *pod, const DlColor *color_data, const float *stop_data)
bool isGradient() const override
If the underlying platform data represents a gradient.
bool base_equals_(DlGradientColorSourceBase const *other_base) const
virtual const void * pod() const =0
#define FML_DISALLOW_COPY_ASSIGN_AND_MOVE(TypeName)
Definition macros.h:31
impeller::Scalar DlScalar
A 4x4 matrix using column-major storage.
Definition matrix.h:37