buffer: always set buffer->{cairo,surface} for simplification

This commit is contained in:
tokyo4j 2024-11-27 14:17:28 +09:00 committed by Hiroaki Yamamoto
parent d2a864dfe7
commit c48324975d
5 changed files with 20 additions and 61 deletions

View file

@ -32,10 +32,11 @@
struct lab_data_buffer {
struct wlr_buffer base;
cairo_surface_t *surface; /* optional */
cairo_t *cairo; /* optional */
void *data; /* owned by surface if surface != NULL */
uint32_t format;
bool surface_owns_data;
cairo_surface_t *surface;
cairo_t *cairo;
void *data;
uint32_t format; /* currently always DRM_FORMAT_ARGB8888 */
size_t stride;
/*
* The logical size of the surface in layout pixels.
@ -50,7 +51,7 @@ struct lab_data_buffer {
* CAIRO_FORMAT_ARGB32 image surface.
*
* The logical size is set to the surface size in pixels, ignoring
* device scale. No cairo context is created.
* device scale.
*/
struct lab_data_buffer *buffer_adopt_cairo_surface(cairo_surface_t *surface);
@ -78,7 +79,6 @@ struct lab_data_buffer *buffer_convert_cairo_surface_for_icon(
* in pre-multiplied ARGB32 format.
*
* The logical size is set to the width and height of the pixel data.
* No cairo surface or context is created.
*/
struct lab_data_buffer *buffer_create_from_data(void *pixel_data, uint32_t width,
uint32_t height, uint32_t stride);

View file

@ -49,12 +49,4 @@ void draw_cairo_border(cairo_t *cairo, struct wlr_fbox fbox, double line_width);
struct lab_data_buffer;
struct surface_context {
bool is_duplicate;
cairo_surface_t *surface;
};
struct surface_context get_cairo_surface_from_lab_data_buffer(
struct lab_data_buffer *buffer);
#endif /* LABWC_GRAPHIC_HELPERS_H */