[mutter/wip/nielsdg/add-yuv-support: 10/11] WIP: Add a COGL_TEXTURE_COMPONENTS_R
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/nielsdg/add-yuv-support: 10/11] WIP: Add a COGL_TEXTURE_COMPONENTS_R
- Date: Mon, 17 Jun 2019 14:05:32 +0000 (UTC)
commit b5b85876ab2f4166d87f302c64fb1c7b6085fd6e
Author: Niels De Graef <niels degraef barco com>
Date: Thu Jun 13 14:41:07 2019 +0200
WIP: Add a COGL_TEXTURE_COMPONENTS_R
cogl/cogl/cogl-pixel-format.c | 16 ++++++++--------
cogl/cogl/cogl-texture.c | 7 +++++++
cogl/cogl/cogl-texture.h | 1 +
src/compositor/meta-background.c | 1 +
src/compositor/meta-surface-actor.c | 1 +
src/wayland/meta-wayland-buffer.c | 28 ++++++++++++++--------------
6 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/cogl/cogl/cogl-pixel-format.c b/cogl/cogl/cogl-pixel-format.c
index ee03a1c90..1a97135e6 100644
--- a/cogl/cogl/cogl-pixel-format.c
+++ b/cogl/cogl/cogl-pixel-format.c
@@ -823,22 +823,22 @@ cogl_pixel_format_get_cogl_components (CoglPixelFormat format,
switch (format)
{
case COGL_PIXEL_FORMAT_NV12:
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case COGL_PIXEL_FORMAT_NV21:
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case COGL_PIXEL_FORMAT_YUV422:
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
case COGL_PIXEL_FORMAT_YUV444:
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
default:
components_out[0] = COGL_TEXTURE_COMPONENTS_RGBA;
diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c
index a07baf259..3bedb5ac0 100644
--- a/cogl/cogl/cogl-texture.c
+++ b/cogl/cogl/cogl-texture.c
@@ -1109,6 +1109,11 @@ _cogl_texture_set_internal_format (CoglTexture *texture,
texture->components = COGL_TEXTURE_COMPONENTS_A;
return;
}
+ else if (internal_format == COGL_PIXEL_FORMAT_R_8)
+ {
+ texture->components = COGL_TEXTURE_COMPONENTS_R;
+ return;
+ }
else if (internal_format == COGL_PIXEL_FORMAT_RG_88)
{
texture->components = COGL_TEXTURE_COMPONENTS_RG;
@@ -1155,6 +1160,8 @@ _cogl_texture_determine_internal_format (CoglTexture *texture,
}
case COGL_TEXTURE_COMPONENTS_A:
return COGL_PIXEL_FORMAT_A_8;
+ case COGL_TEXTURE_COMPONENTS_R:
+ return COGL_PIXEL_FORMAT_R_8;
case COGL_TEXTURE_COMPONENTS_RG:
return COGL_PIXEL_FORMAT_RG_88;
case COGL_TEXTURE_COMPONENTS_RGB:
diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h
index 87612b810..6785a493f 100644
--- a/cogl/cogl/cogl-texture.h
+++ b/cogl/cogl/cogl-texture.h
@@ -139,6 +139,7 @@ cogl_is_texture (void *object);
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
+ COGL_TEXTURE_COMPONENTS_R,
COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index c033395fe..f43bb9afa 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -632,6 +632,7 @@ texture_has_alpha (CoglTexture *texture)
case COGL_TEXTURE_COMPONENTS_A:
case COGL_TEXTURE_COMPONENTS_RGBA:
return TRUE;
+ case COGL_TEXTURE_COMPONENTS_R:
case COGL_TEXTURE_COMPONENTS_RG:
case COGL_TEXTURE_COMPONENTS_RGB:
case COGL_TEXTURE_COMPONENTS_DEPTH:
diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c
index e50ca06f6..417d30554 100644
--- a/src/compositor/meta-surface-actor.c
+++ b/src/compositor/meta-surface-actor.c
@@ -349,6 +349,7 @@ meta_surface_actor_is_argb32 (MetaSurfaceActor *self)
case COGL_TEXTURE_COMPONENTS_A:
case COGL_TEXTURE_COMPONENTS_RGBA:
return TRUE;
+ case COGL_TEXTURE_COMPONENTS_R:
case COGL_TEXTURE_COMPONENTS_RG:
case COGL_TEXTURE_COMPONENTS_RGB:
case COGL_TEXTURE_COMPONENTS_DEPTH:
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 80e981f43..3de148f7a 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -186,37 +186,37 @@ shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer,
#endif
case WL_SHM_FORMAT_NV12:
format = COGL_PIXEL_FORMAT_NV12;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case WL_SHM_FORMAT_NV21:
format = COGL_PIXEL_FORMAT_NV21;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
components_out[1] = COGL_TEXTURE_COMPONENTS_RG;
break;
case WL_SHM_FORMAT_YUV422:
format = COGL_PIXEL_FORMAT_YUV422;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
case WL_SHM_FORMAT_YVU422:
format = COGL_PIXEL_FORMAT_YVU422;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
case WL_SHM_FORMAT_YUV444:
format = COGL_PIXEL_FORMAT_YUV444;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
case WL_SHM_FORMAT_YVU444:
format = COGL_PIXEL_FORMAT_YVU444;
- components_out[0] = COGL_TEXTURE_COMPONENTS_A;
- components_out[1] = COGL_TEXTURE_COMPONENTS_A;
- components_out[2] = COGL_TEXTURE_COMPONENTS_A;
+ components_out[0] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[1] = COGL_TEXTURE_COMPONENTS_R;
+ components_out[2] = COGL_TEXTURE_COMPONENTS_R;
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]