6 #include "flutter/shell/platform/linux/testing/linux_test.h"
7 #include "gtest/gtest.h"
9 #include "flutter/common/constants.h"
10 #include "flutter/fml/synchronization/waitable_event.h"
15 #include <gdk/gdkwayland.h>
35 constexpr
size_t width = 100;
36 constexpr
size_t height = 100;
37 size_t row_bytes =
width * 4;
38 g_autofree
unsigned char* layer_data =
39 static_cast<unsigned char*
>(malloc(
height * row_bytes));
40 FlutterBackingStore backing_store = {
41 .type = kFlutterBackingStoreTypeSoftware,
43 .allocation = layer_data, .row_bytes = row_bytes, .height =
height}};
44 FlutterLayer layer = {.type = kFlutterLayerContentTypeBackingStore,
45 .backing_store = &backing_store,
48 const FlutterLayer*
layers[1] = {&layer};
53 size_t frame_width, frame_height;
56 EXPECT_EQ(frame_width,
width);
57 EXPECT_EQ(frame_height,
height);
60 int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,
width);
61 g_autofree
unsigned char* image_data =
62 static_cast<unsigned char*
>(malloc(
height * stride));
63 cairo_surface_t* surface = cairo_image_surface_create_for_data(
64 image_data, CAIRO_FORMAT_ARGB32,
width,
height, stride);
65 cairo_t* cr = cairo_create(surface);
67 cairo_surface_destroy(surface);
73 constexpr
size_t width1 = 90;
74 constexpr
size_t height1 = 90;
75 size_t row_bytes = width1 * 4;
76 g_autofree
unsigned char* layer1_data =
77 static_cast<unsigned char*
>(malloc(height1 * row_bytes));
78 FlutterBackingStore backing_store1 = {
79 .type = kFlutterBackingStoreTypeSoftware,
80 .software = {.allocation = layer1_data,
81 .row_bytes = row_bytes,
83 FlutterLayer layer1 = {.type = kFlutterLayerContentTypeBackingStore,
84 .backing_store = &backing_store1,
86 .size = {width1, height1}};
87 const FlutterLayer* layers1[1] = {&layer1};
93 constexpr
size_t width2 = 100;
94 constexpr
size_t height2 = 100;
95 row_bytes = width2 * 4;
96 g_autofree
unsigned char* layer2_data =
97 static_cast<unsigned char*
>(malloc(height2 * row_bytes));
98 FlutterBackingStore backing_store2 = {
99 .type = kFlutterBackingStoreTypeSoftware,
100 .software = {.allocation = layer2_data,
101 .row_bytes = row_bytes,
103 FlutterLayer layer2 = {.type = kFlutterLayerContentTypeBackingStore,
104 .backing_store = &backing_store2,
106 .size = {width2, height2}};
107 const FlutterLayer* layers2[1] = {&layer2};
108 fml::AutoResetWaitableEvent latch;
115 int stride2 = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width2);
116 g_autofree
unsigned char* image_data =
117 static_cast<unsigned char*
>(malloc(height2 * stride2));
118 cairo_surface_t* surface = cairo_image_surface_create_for_data(
119 image_data, CAIRO_FORMAT_ARGB32, width2, height2, stride2);
120 cairo_t* cr = cairo_create(surface);
122 cairo_surface_destroy(surface);
~FlCompositorSoftwareTest()
FlTaskRunner * task_runner
FlCompositorSoftware * compositor
gboolean fl_compositor_render(FlCompositor *self, cairo_t *cr, GdkWindow *window, gboolean wait_for_frame)
void fl_compositor_get_frame_size(FlCompositor *self, size_t *width, size_t *height)
gboolean fl_compositor_present_layers(FlCompositor *self, const FlutterLayer **layers, size_t layers_count)
FlFramebuffer double double int int height
FlFramebuffer double double int width
const FlutterLayer ** layers
FlCompositorSoftware * fl_compositor_software_new(FlTaskRunner *task_runner)
TEST_F(FlCompositorSoftwareTest, Render)
FlTaskRunner * fl_task_runner_new(FlEngine *engine)