cogl: Add a notion of pixel format planes
As we will start adding support for more pixel formats, we will need to define a notion of planes. This commit doesn't make any functional change, but starts adding the idea of pixel formats and how they (at this point only theoretically) can have multple planes. Since a lot of code in Mutter assumes we only get to deal with single plane pixel formats, this commit also adds assertions and if-checks to make sure we don't accidentally try something that doesn't make sense. https://gitlab.gnome.org/GNOME/mutter/merge_requests/858
This commit is contained in:

committed by
Jonas Ådahl

parent
553211dd81
commit
8e204e036a
@ -477,22 +477,25 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer,
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
int i, n_rectangles;
|
||||
gboolean set_texture_failed = FALSE;
|
||||
CoglPixelFormat format;
|
||||
|
||||
n_rectangles = cairo_region_num_rectangles (region);
|
||||
|
||||
shm_buffer = wl_shm_buffer_get (buffer->resource);
|
||||
|
||||
shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL);
|
||||
g_return_val_if_fail (cogl_pixel_format_get_n_planes (format) == 1, FALSE);
|
||||
|
||||
wl_shm_buffer_begin_access (shm_buffer);
|
||||
|
||||
for (i = 0; i < n_rectangles; i++)
|
||||
{
|
||||
const uint8_t *data = wl_shm_buffer_get_data (shm_buffer);
|
||||
int32_t stride = wl_shm_buffer_get_stride (shm_buffer);
|
||||
CoglPixelFormat format;
|
||||
int bpp;
|
||||
cairo_rectangle_int_t rect;
|
||||
int bpp;
|
||||
|
||||
shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL);
|
||||
bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
||||
bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0);
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
|
||||
if (!_cogl_texture_set_region (texture,
|
||||
|
Reference in New Issue
Block a user