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,
44 int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,
width);
45 g_autofree
unsigned char* image_data =
46 static_cast<unsigned char*
>(malloc(
height * stride));
47 cairo_surface_t*
surface = cairo_image_surface_create_for_data(
48 image_data, CAIRO_FORMAT_ARGB32,
width,
height, stride);
49 cairo_t* cr = cairo_create(
surface);
55TEST(FlCompositorSoftwareTest, Resize) {
60 g_autoptr(FlCompositorSoftware) compositor =
64 constexpr size_t width1 = 90;
65 constexpr size_t height1 = 90;
66 size_t row_bytes = width1 * 4;
67 g_autofree
unsigned char* layer1_data =
68 static_cast<unsigned char*
>(malloc(height1 * row_bytes));
71 .software = {.allocation = layer1_data,
72 .row_bytes = row_bytes,
75 .backing_store = &backing_store1,
77 .size = {width1, height1}};
84 constexpr size_t width2 = 100;
85 constexpr size_t height2 = 100;
86 row_bytes = width2 * 4;
87 g_autofree
unsigned char* layer2_data =
88 static_cast<unsigned char*
>(malloc(height2 * row_bytes));
91 .software = {.allocation = layer2_data,
92 .row_bytes = row_bytes,
95 .backing_store = &backing_store2,
97 .size = {width2, height2}};
106 int stride2 = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, width2);
107 g_autofree
unsigned char* image_data =
108 static_cast<unsigned char*
>(malloc(height2 * stride2));
109 cairo_surface_t*
surface = cairo_image_surface_create_for_data(
110 image_data, CAIRO_FORMAT_ARGB32, width2, height2, stride2);
111 cairo_t* cr = cairo_create(
surface);
113 cairo_surface_destroy(
surface);