mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
cairo-texture: Make the pixel order macro public
It stands to reason that any piece of code using Cairo and Cogl at the same time, and dealing with texture data, will want to use the same logic Clutter uses to determine the compatible pixel format between the two. https://bugzilla.gnome.org/show_bug.cgi?id=647875
This commit is contained in:
parent
d6fbdf6904
commit
3a071a4787
@ -125,15 +125,6 @@ static guint cairo_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
#define CLUTTER_CAIRO_TEXTURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTexturePrivate))
|
||||
|
||||
/* Cairo stores the data in native byte order as ARGB but Cogl's pixel
|
||||
formats specify the actual byte order. Therefore we need to use a
|
||||
different format depending on the architecture */
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define CLUTTER_CAIRO_TEXTURE_PIXEL_FORMAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
|
||||
#else
|
||||
#define CLUTTER_CAIRO_TEXTURE_PIXEL_FORMAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
|
||||
#endif
|
||||
|
||||
struct _ClutterCairoTexturePrivate
|
||||
{
|
||||
cairo_surface_t *cr_surface;
|
||||
@ -356,7 +347,7 @@ clutter_cairo_texture_create_surface (ClutterCairoTexture *self,
|
||||
/* create a backing Cogl texture */
|
||||
cogl_texture = cogl_texture_new_from_data (width, height,
|
||||
COGL_TEXTURE_NONE,
|
||||
CLUTTER_CAIRO_TEXTURE_PIXEL_FORMAT,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
cairo_stride,
|
||||
cairo_data);
|
||||
@ -560,7 +551,7 @@ clutter_cairo_texture_context_destroy (void *data)
|
||||
ctxt->rect.x, ctxt->rect.y,
|
||||
cairo_width, cairo_height,
|
||||
cairo_width, cairo_height,
|
||||
CLUTTER_CAIRO_TEXTURE_PIXEL_FORMAT,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
cairo_stride,
|
||||
cairo_data);
|
||||
|
||||
|
@ -44,6 +44,26 @@ G_BEGIN_DECLS
|
||||
#define CLUTTER_IS_CAIRO_TEXTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CAIRO_TEXTURE))
|
||||
#define CLUTTER_CAIRO_TEXTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CAIRO_TEXTURE, ClutterCairoTextureClass))
|
||||
|
||||
/**
|
||||
* CLUTTER_CAIRO_FORMAT_ARGB32:
|
||||
*
|
||||
* The #CoglPixelFormat to be used when uploading image data from
|
||||
* and to a Cairo image surface using %CAIRO_FORMAT_ARGB32 and
|
||||
* %CAIRO_FORMAT_RGB24 as #cairo_format_t.
|
||||
*
|
||||
* Since: 1.8
|
||||
*/
|
||||
|
||||
/* Cairo stores the data in native byte order as ARGB but Cogl's pixel
|
||||
* formats specify the actual byte order. Therefore we need to use a
|
||||
* different format depending on the architecture
|
||||
*/
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_BGRA_8888_PRE)
|
||||
#else
|
||||
#define CLUTTER_CAIRO_FORMAT_ARGB32 (COGL_PIXEL_FORMAT_ARGB_8888_PRE)
|
||||
#endif
|
||||
|
||||
typedef struct _ClutterCairoTexture ClutterCairoTexture;
|
||||
typedef struct _ClutterCairoTextureClass ClutterCairoTextureClass;
|
||||
typedef struct _ClutterCairoTexturePrivate ClutterCairoTexturePrivate;
|
||||
|
Loading…
Reference in New Issue
Block a user