cogl: Remove cogl_wayland_texture_2d_* functions
These are implemented in the Meta namespace these days, where we have better abstractions for wayland-related types. They also weren't used anymore, since we removed the unused ClutterWaylandSurface type in the previous commit. https://gitlab.gnome.org/GNOME/mutter/merge_requests/624
This commit is contained in:
parent
689c7f4107
commit
2ff6beea35
@ -274,183 +274,6 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
|
||||
}
|
||||
#endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */
|
||||
|
||||
#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
|
||||
static void
|
||||
shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer,
|
||||
CoglPixelFormat *format_out,
|
||||
CoglTextureComponents *components_out)
|
||||
{
|
||||
CoglPixelFormat format;
|
||||
CoglTextureComponents components = COGL_TEXTURE_COMPONENTS_RGBA;
|
||||
|
||||
switch (wl_shm_buffer_get_format (shm_buffer))
|
||||
{
|
||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
components = COGL_TEXTURE_COMPONENTS_RGB;
|
||||
break;
|
||||
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
case WL_SHM_FORMAT_ARGB8888:
|
||||
format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
|
||||
break;
|
||||
case WL_SHM_FORMAT_XRGB8888:
|
||||
format = COGL_PIXEL_FORMAT_BGRA_8888;
|
||||
components = COGL_TEXTURE_COMPONENTS_RGB;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_warn_if_reached ();
|
||||
format = COGL_PIXEL_FORMAT_ARGB_8888;
|
||||
}
|
||||
|
||||
if (format_out)
|
||||
*format_out = format;
|
||||
if (components_out)
|
||||
*components_out = components;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int width,
|
||||
int height,
|
||||
struct wl_shm_buffer *
|
||||
shm_buffer,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int level,
|
||||
CoglError **error)
|
||||
{
|
||||
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;
|
||||
|
||||
shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL);
|
||||
bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
|
||||
|
||||
return _cogl_texture_set_region (COGL_TEXTURE (texture),
|
||||
width, height,
|
||||
format,
|
||||
stride,
|
||||
data + src_x * bpp + src_y * stride,
|
||||
dst_x, dst_y,
|
||||
level,
|
||||
error);
|
||||
}
|
||||
|
||||
CoglTexture2D *
|
||||
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
||||
struct wl_resource *buffer,
|
||||
CoglError **error)
|
||||
{
|
||||
struct wl_shm_buffer *shm_buffer;
|
||||
CoglTexture2D *tex = NULL;
|
||||
|
||||
shm_buffer = wl_shm_buffer_get (buffer);
|
||||
|
||||
if (shm_buffer)
|
||||
{
|
||||
int stride = wl_shm_buffer_get_stride (shm_buffer);
|
||||
int width = wl_shm_buffer_get_width (shm_buffer);
|
||||
int height = wl_shm_buffer_get_height (shm_buffer);
|
||||
CoglPixelFormat format;
|
||||
CoglTextureComponents components;
|
||||
CoglBitmap *bmp;
|
||||
|
||||
shm_buffer_get_cogl_pixel_format (shm_buffer, &format, &components);
|
||||
|
||||
bmp = cogl_bitmap_new_for_data (ctx,
|
||||
width, height,
|
||||
format,
|
||||
stride,
|
||||
wl_shm_buffer_get_data (shm_buffer));
|
||||
|
||||
tex = cogl_texture_2d_new_from_bitmap (bmp);
|
||||
|
||||
cogl_texture_set_components (COGL_TEXTURE (tex), components);
|
||||
|
||||
cogl_object_unref (bmp);
|
||||
|
||||
if (!cogl_texture_allocate (COGL_TEXTURE (tex), error))
|
||||
{
|
||||
cogl_object_unref (tex);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return tex;
|
||||
}
|
||||
#ifdef COGL_HAS_EGL_SUPPORT
|
||||
else
|
||||
{
|
||||
int format, width, height;
|
||||
|
||||
if (_cogl_egl_query_wayland_buffer (ctx,
|
||||
buffer,
|
||||
EGL_TEXTURE_FORMAT,
|
||||
&format) &&
|
||||
_cogl_egl_query_wayland_buffer (ctx,
|
||||
buffer,
|
||||
EGL_WIDTH,
|
||||
&width) &&
|
||||
_cogl_egl_query_wayland_buffer (ctx,
|
||||
buffer,
|
||||
EGL_HEIGHT,
|
||||
&height))
|
||||
{
|
||||
EGLImageKHR image;
|
||||
CoglPixelFormat internal_format;
|
||||
|
||||
_COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints &
|
||||
COGL_RENDERER_CONSTRAINT_USES_EGL,
|
||||
NULL);
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case EGL_TEXTURE_RGB:
|
||||
internal_format = COGL_PIXEL_FORMAT_RGB_888;
|
||||
break;
|
||||
case EGL_TEXTURE_RGBA:
|
||||
internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE;
|
||||
break;
|
||||
default:
|
||||
_cogl_set_error (error,
|
||||
COGL_SYSTEM_ERROR,
|
||||
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||
"Can't create texture from unknown "
|
||||
"wayland buffer format %d\n", format);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = _cogl_egl_create_image (ctx,
|
||||
EGL_WAYLAND_BUFFER_WL,
|
||||
buffer,
|
||||
NULL);
|
||||
tex = cogl_egl_texture_2d_new_from_image (ctx,
|
||||
width, height,
|
||||
internal_format,
|
||||
image,
|
||||
error);
|
||||
_cogl_egl_destroy_image (ctx, image);
|
||||
return tex;
|
||||
}
|
||||
}
|
||||
#endif /* COGL_HAS_EGL_SUPPORT */
|
||||
|
||||
_cogl_set_error (error,
|
||||
COGL_SYSTEM_ERROR,
|
||||
COGL_SYSTEM_ERROR_UNSUPPORTED,
|
||||
"Can't create texture from unknown "
|
||||
"wayland buffer type\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif /* COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT */
|
||||
|
||||
void
|
||||
_cogl_texture_2d_externally_modified (CoglTexture *texture)
|
||||
{
|
||||
|
@ -70,81 +70,6 @@ void
|
||||
cogl_wayland_display_set_compositor_display (CoglDisplay *display,
|
||||
struct wl_display *wayland_display);
|
||||
|
||||
/**
|
||||
* cogl_wayland_texture_2d_new_from_buffer:
|
||||
* @ctx: A #CoglContext
|
||||
* @buffer: A Wayland resource for a buffer
|
||||
* @error: A #CoglError for exceptions
|
||||
*
|
||||
* Uploads the @buffer referenced by the given Wayland resource to a
|
||||
* #CoglTexture2D. The buffer resource may refer to a wl_buffer or a
|
||||
* wl_shm_buffer.
|
||||
*
|
||||
* <note>The results are undefined for passing an invalid @buffer
|
||||
* pointer</note>
|
||||
* <note>It is undefined if future updates to @buffer outside the
|
||||
* control of Cogl will affect the allocated #CoglTexture2D. In some
|
||||
* cases the contents of the buffer are copied (such as shm buffers),
|
||||
* and in other cases the underlying storage is re-used directly (such
|
||||
* as drm buffers)</note>
|
||||
*
|
||||
* Returns: A newly allocated #CoglTexture2D, or if Cogl could not
|
||||
* validate the @buffer in some way (perhaps because of
|
||||
* an unsupported format) it will return %NULL and set
|
||||
* @error.
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
CoglTexture2D *
|
||||
cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
|
||||
struct wl_resource *buffer,
|
||||
CoglError **error);
|
||||
|
||||
/**
|
||||
* cogl_wayland_texture_set_region_from_shm_buffer:
|
||||
* @texture: a #CoglTexture
|
||||
* @width: The width of the region to copy
|
||||
* @height: The height of the region to copy
|
||||
* @shm_buffer: The source buffer
|
||||
* @src_x: The X offset within the source bufer to copy from
|
||||
* @src_y: The Y offset within the source bufer to copy from
|
||||
* @dst_x: The X offset within the texture to copy to
|
||||
* @dst_y: The Y offset within the texture to copy to
|
||||
* @level: The mipmap level of the texture to copy to
|
||||
* @error: A #CoglError to return exceptional errors
|
||||
*
|
||||
* Sets the pixels in a rectangular subregion of @texture from a
|
||||
* Wayland SHM buffer. Generally this would be used in response to
|
||||
* wl_surface.damage event in a compositor in order to update the
|
||||
* texture with the damaged region. This is just a convenience wrapper
|
||||
* around getting the SHM buffer pointer and calling
|
||||
* cogl_texture_set_region(). See that function for a description of
|
||||
* the level parameter.
|
||||
*
|
||||
* <note>Since the storage for a #CoglTexture is allocated lazily then
|
||||
* if the given @texture has not previously been allocated then this
|
||||
* api can return %FALSE and throw an exceptional @error if there is
|
||||
* not enough memory to allocate storage for @texture.</note>
|
||||
*
|
||||
* Return value: %TRUE if the subregion upload was successful, and
|
||||
* %FALSE otherwise
|
||||
* Since: 1.18
|
||||
* Stability: unstable
|
||||
*/
|
||||
gboolean
|
||||
cogl_wayland_texture_set_region_from_shm_buffer (CoglTexture *texture,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int width,
|
||||
int height,
|
||||
struct wl_shm_buffer *
|
||||
shm_buffer,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int level,
|
||||
CoglError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* The gobject introspection scanner seems to parse public headers in
|
||||
|
@ -1006,8 +1006,6 @@ cogl_wayland_onscreen_resize
|
||||
cogl_wayland_renderer_get_display
|
||||
cogl_wayland_renderer_set_event_dispatch_enabled
|
||||
cogl_wayland_renderer_set_foreign_display
|
||||
cogl_wayland_texture_set_region_from_shm_buffer
|
||||
cogl_wayland_texture_2d_new_from_buffer
|
||||
#endif
|
||||
|
||||
cogl_winding_get_type
|
||||
|
Loading…
x
Reference in New Issue
Block a user