summaryrefslogtreecommitdiff
path: root/src/cairo-image-surface.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2018-12-03 15:13:40 +0100
committerBryce Harrington <bryce@bryceharrington.org>2019-01-07 19:10:44 -0800
commita34cb719cd9cb4f0c5b78be80b80ab0ae22464a6 (patch)
treea74b88eacb6800be9cb055f2b7bc56d667654071 /src/cairo-image-surface.c
parent87c1c19197a6a3cdae955b320386f5449e17b286 (diff)
Add support for RGBA128F and RGB96F formats.
IGT wants to add support for planes with a bit depth >10, which requires a higher precision format than we have currently. I'm using RGBA as format, because of its existence in OpenGL. With the new formats we can directly convert our bytes to half float, or multiply a colro vector with a matrix to go to the Y'CbCr colorspace. This requires pixman 0.36.0, so bump the version requirement. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
Diffstat (limited to 'src/cairo-image-surface.c')
-rw-r--r--src/cairo-image-surface.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 2ee1cad42..0e17f3a16 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -93,6 +93,10 @@ cairo_format_t
_cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
{
switch (pixman_format) {
+ case PIXMAN_rgba_float:
+ return CAIRO_FORMAT_RGBA128F;
+ case PIXMAN_rgb_float:
+ return CAIRO_FORMAT_RGB96F;
case PIXMAN_a8r8g8b8:
return CAIRO_FORMAT_ARGB32;
case PIXMAN_x2r10g10b10:
@@ -322,6 +326,12 @@ _cairo_format_to_pixman_format_code (cairo_format_t format)
case CAIRO_FORMAT_RGB16_565:
ret = PIXMAN_r5g6b5;
break;
+ case CAIRO_FORMAT_RGB96F:
+ ret = PIXMAN_rgb_float;
+ break;
+ case CAIRO_FORMAT_RGBA128F:
+ ret = PIXMAN_rgba_float;
+ break;
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_INVALID:
default:
@@ -693,8 +703,10 @@ _cairo_format_from_content (cairo_content_t content)
_cairo_content_from_format (cairo_format_t format)
{
switch (format) {
+ case CAIRO_FORMAT_RGBA128F:
case CAIRO_FORMAT_ARGB32:
return CAIRO_CONTENT_COLOR_ALPHA;
+ case CAIRO_FORMAT_RGB96F:
case CAIRO_FORMAT_RGB30:
return CAIRO_CONTENT_COLOR;
case CAIRO_FORMAT_RGB24:
@@ -716,6 +728,10 @@ _cairo_content_from_format (cairo_format_t format)
_cairo_format_bits_per_pixel (cairo_format_t format)
{
switch (format) {
+ case CAIRO_FORMAT_RGBA128F:
+ return 128;
+ case CAIRO_FORMAT_RGB96F:
+ return 96;
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB30:
case CAIRO_FORMAT_RGB24: