16TEST(FlCompositorSoftwareTest, Render) {
21 g_autoptr(FlCompositorSoftware) compositor =
25 constexpr size_t width = 100;
26 constexpr size_t height = 100;
27 size_t row_bytes =
width * 4;
28 g_autofree
unsigned char* layer_data =
29 static_cast<unsigned char*
>(malloc(
height * row_bytes));
33 .allocation = layer_data, .row_bytes = row_bytes, .height =
height}};
35 .backing_store = &backing_store,
43 size_t frame_width, frame_height;
46 EXPECT_EQ(frame_width,
width);
47 EXPECT_EQ(frame_height,
height);
50 int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,
width);
51 g_autofree
unsigned char* image_data =
52 static_cast<unsigned char*
>(malloc(
height * stride));
53 cairo_surface_t*
surface = cairo_image_surface_create_for_data(
54 image_data, CAIRO_FORMAT_ARGB32,
width,
height, stride);
55 cairo_t* cr = cairo_create(
surface);
61TEST(FlCompositorSoftwareTest, Resize) {
66 g_autoptr(FlCompositorSoftware) compositor =
70 constexpr size_t width1 = 90;
71 constexpr size_t height1 = 90;
72 size_t row_bytes = width1 * 4;
73 g_autofree
unsigned char* layer1_data =
74 static_cast<unsigned char*
>(malloc(height1 * row_bytes));
77 .software = {.allocation = layer1_data,
78 .row_bytes = row_bytes,
81 .backing_store = &backing_store1,
83 .size = {width1, height1}};
90 constexpr size_t width2 = 100;
91 constexpr size_t height2 = 100;
92 row_bytes = width2 * 4;
93 g_autofree
unsigned char* layer2_data =
94 static_cast<unsigned char*
>(malloc(height2 * row_bytes));
97 .software = {.allocation = layer2_data,
98 .row_bytes = row_bytes,
101 .backing_store = &backing_store2,
103 .size = {width2, height2}};
112 int stride2 = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width2);
113 g_autofree
unsigned char* image_data =
114 static_cast<unsigned char*
>(malloc(height2 * stride2));
115 cairo_surface_t*
surface = cairo_image_surface_create_for_data(
116 image_data, CAIRO_FORMAT_ARGB32, width2, height2, stride2);
117 cairo_t* cr = cairo_create(
surface);
119 cairo_surface_destroy(
surface);