mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 04:38:04 +02:00
New API: Add support for new CAIRO_FORMAT_RGB16_565
This commit is contained in:
parent
36e59ca5f8
commit
c6164d0d2a
4 changed files with 29 additions and 3 deletions
|
|
@ -47,6 +47,12 @@ pixman_format_create (pixman_format_name_t name)
|
|||
case PIXMAN_FORMAT_NAME_A1:
|
||||
return pixman_format_create_masks (1, 0x1,
|
||||
0, 0, 0);
|
||||
case PIXMAN_FORMAT_NAME_RGB16_565:
|
||||
return pixman_format_create_masks (16,
|
||||
0x0,
|
||||
0xf800,
|
||||
0x07e0,
|
||||
0x001f);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -220,7 +220,8 @@ typedef enum pixman_format_name {
|
|||
PIXMAN_FORMAT_NAME_ARGB32,
|
||||
PIXMAN_FORMAT_NAME_RGB24,
|
||||
PIXMAN_FORMAT_NAME_A8,
|
||||
PIXMAN_FORMAT_NAME_A1
|
||||
PIXMAN_FORMAT_NAME_A1,
|
||||
PIXMAN_FORMAT_NAME_RGB16_565
|
||||
} pixman_format_name_t;
|
||||
|
||||
typedef struct pixman_format pixman_format_t;
|
||||
|
|
|
|||
|
|
@ -44,11 +44,15 @@ _cairo_format_bpp (cairo_format_t format)
|
|||
return 1;
|
||||
case CAIRO_FORMAT_A8:
|
||||
return 8;
|
||||
case CAIRO_FORMAT_RGB16_565:
|
||||
return 16;
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
default:
|
||||
return 32;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED;
|
||||
return 32;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
|
|
@ -103,6 +107,13 @@ _cairo_format_from_pixman_format (pixman_format_t *pixman_format)
|
|||
bm == 0x000000ff)
|
||||
return CAIRO_FORMAT_RGB24;
|
||||
break;
|
||||
case 16:
|
||||
if (am == 0x0 &&
|
||||
rm == 0xf800 &&
|
||||
gm == 0x07e0 &&
|
||||
bm == 0x001f)
|
||||
return CAIRO_FORMAT_RGB16_565;
|
||||
break;
|
||||
case 8:
|
||||
if (am == 0xff &&
|
||||
rm == 0x0 &&
|
||||
|
|
@ -185,6 +196,9 @@ _create_pixman_format (cairo_format_t format)
|
|||
case CAIRO_FORMAT_A8:
|
||||
return pixman_format_create (PIXMAN_FORMAT_NAME_A8);
|
||||
break;
|
||||
case CAIRO_FORMAT_RGB16_565:
|
||||
return pixman_format_create (PIXMAN_FORMAT_NAME_RGB16_565);
|
||||
break;
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
return pixman_format_create (PIXMAN_FORMAT_NAME_RGB24);
|
||||
break;
|
||||
|
|
@ -475,6 +489,7 @@ _cairo_content_from_format (cairo_format_t format)
|
|||
case CAIRO_FORMAT_ARGB32:
|
||||
return CAIRO_CONTENT_COLOR_ALPHA;
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
case CAIRO_FORMAT_RGB16_565:
|
||||
return CAIRO_CONTENT_COLOR;
|
||||
case CAIRO_FORMAT_A8:
|
||||
case CAIRO_FORMAT_A1:
|
||||
|
|
|
|||
|
|
@ -1342,6 +1342,9 @@ cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
|
|||
* endianess of the platform. On a big-endian machine, the
|
||||
* first pixel is in the uppermost bit, on a little-endian
|
||||
* machine the first pixel is in the least-significant bit.
|
||||
* @CAIRO_FORMAT_RGB16_565: each pixel is a 16-bit quantity,
|
||||
* with red in the upper 5 bits, then green in the next 6,
|
||||
* then blue in the lowest 5 bits.
|
||||
*
|
||||
* #cairo_format_t is used to identify the memory format of
|
||||
* image data.
|
||||
|
|
@ -1350,7 +1353,8 @@ typedef enum _cairo_format {
|
|||
CAIRO_FORMAT_ARGB32,
|
||||
CAIRO_FORMAT_RGB24,
|
||||
CAIRO_FORMAT_A8,
|
||||
CAIRO_FORMAT_A1
|
||||
CAIRO_FORMAT_A1,
|
||||
CAIRO_FORMAT_RGB16_565
|
||||
} cairo_format_t;
|
||||
|
||||
cairo_public cairo_surface_t *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue