#include <compositor_software.h>
Definition at line 17 of file compositor_software.h.
◆ CompositorSoftware()
flutter::CompositorSoftware::CompositorSoftware |
( |
| ) |
|
◆ CollectBackingStore()
bool flutter::CompositorSoftware::CollectBackingStore |
( |
const FlutterBackingStore * |
store | ) |
|
|
overridevirtual |
◆ CreateBackingStore()
bool flutter::CompositorSoftware::CreateBackingStore |
( |
const FlutterBackingStoreConfig & |
config, |
|
|
FlutterBackingStore * |
result |
|
) |
| |
|
overridevirtual |
|Compositor|
Implements flutter::Compositor.
Definition at line 86 of file compositor_software.cc.
89 size_t size = config.size.width * config.size.height * 4;
90 void* allocation = std::calloc(size,
sizeof(uint8_t));
95 result->type = kFlutterBackingStoreTypeSoftware;
96 result->software.allocation = allocation;
97 result->software.height = config.size.height;
98 result->software.row_bytes = config.size.width * 4;
99 result->software.user_data =
nullptr;
100 result->software.destruction_callback = [](
void*
user_data) {
References user_data.
Referenced by flutter::testing::TEST_F().
◆ Present()
bool flutter::CompositorSoftware::Present |
( |
FlutterWindowsView * |
view, |
|
|
const FlutterLayer ** |
layers, |
|
|
size_t |
layers_count |
|
) |
| |
|
overridevirtual |
|Compositor|
Implements flutter::Compositor.
Definition at line 112 of file compositor_software.cc.
115 FML_DCHECK(view !=
nullptr);
118 if (layers_count == 0) {
119 return view->ClearSoftwareBitmap();
123 if (layers_count == 1) {
124 const FlutterLayer* layer = layers[0];
125 FML_DCHECK(layer !=
nullptr);
126 if (layer->type == kFlutterLayerContentTypeBackingStore &&
127 layer->offset.x == 0 && layer->offset.y == 0) {
128 auto& backing_store = *layer->backing_store;
129 FML_DCHECK(backing_store.type == kFlutterBackingStoreTypeSoftware);
130 auto& software = backing_store.software;
131 return view->PresentSoftwareBitmap(software.allocation,
132 software.row_bytes, software.height);
137 FlutterRect bounds = CalculateBounds(layers, layers_count);
139 int x_min =
static_cast<int>(bounds.left);
140 int x_max =
static_cast<int>(bounds.right);
141 int y_min =
static_cast<int>(bounds.top);
142 int y_max =
static_cast<int>(bounds.bottom);
144 int width = x_max - x_min;
145 int height = y_max - y_min;
146 std::vector<uint32_t> allocation(width * height,
kOpaqueBlack);
148 for (
const FlutterLayer** layer = layers; layer < layers + layers_count;
152 if ((*layer)->type == kFlutterLayerContentTypeBackingStore) {
153 BlendLayer(allocation, **layer, x_min, y_min, width, height);
160 return view->PresentSoftwareBitmap(
static_cast<void*
>(allocation.data()),
161 width *
sizeof(uint32_t), height);
References flutter::FlutterWindowsView::ClearSoftwareBitmap(), flutter::kOpaqueBlack, and flutter::FlutterWindowsView::PresentSoftwareBitmap().
Referenced by flutter::testing::TEST_F().
The documentation for this class was generated from the following files: