10 #include "impeller/entity/porter_duff_blend.vert.h"
11 #include "impeller/entity/texture_fill.vert.h"
14 #include "third_party/skia/include/core/SkPoint.h"
19 const SkRSXform* xform,
21 const flutter::DlColor* colors,
25 std::optional<Rect> cull_rect)
33 cull_rect_(cull_rect) {}
46 if (cull_rect_.has_value()) {
47 return cull_rect_.value();
49 Rect bounding_box = {};
50 for (
size_t i = 0; i < count_; i++) {
52 auto sample_rect = tex_[i];
54 bounding_box = bounds.
Union(bounding_box);
56 cull_rect_ = bounding_box;
74 using VS = TextureFillVertexShader;
76 constexpr
size_t indices[6] = {0, 1, 2, 1, 2, 3};
79 sizeof(VS::PerVertexData) * count_ * 6,
alignof(VS::PerVertexData),
80 [&](uint8_t* raw_data) {
81 VS::PerVertexData*
data =
82 reinterpret_cast<VS::PerVertexData*
>(raw_data);
84 auto texture_size = atlas_->GetSize();
85 for (
auto i = 0u; i < count_; i++) {
88 auto points = sample_rect.GetPoints();
91 for (
size_t j = 0; j < 6; j++) {
92 data[
offset].position = transformed_points[indices[j]];
93 data[
offset].texture_coords = points[indices[j]] / texture_size;
102 .vertex_count = count_ * 6,
109 using VS = PorterDuffBlendVertexShader;
111 constexpr
size_t indices[6] = {0, 1, 2, 1, 2, 3};
114 sizeof(VS::PerVertexData) * count_ * 6,
alignof(VS::PerVertexData),
115 [&](uint8_t* raw_data) {
116 VS::PerVertexData*
data =
117 reinterpret_cast<VS::PerVertexData*
>(raw_data);
119 auto texture_size = atlas_->GetSize();
120 for (
auto i = 0u; i < count_; i++) {
123 auto points = sample_rect.GetPoints();
126 for (
size_t j = 0; j < 6; j++) {
127 data[
offset].vertices = transformed_points[indices[j]];
128 data[
offset].texture_coords = points[indices[j]] / texture_size;
139 .vertex_count = count_ * 6,