Use CLUTTER_CAIRO_FORMAT_ARGB32: rather then doing a byte order check
Clutter 1.7.x introduced CLUTTER_CAIRO_FORMAT_ARGB32: which can be used when sharing textures/data with cairo without having to do check the byte order and choose the appropriate format by hand. https://bugzilla.gnome.org/show_bug.cgi?id=654577
This commit is contained in:
parent
a92b7342ba
commit
0f49f36519
@ -64,7 +64,7 @@ fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
|
||||
|
||||
CLUTTER_MIN_VERSION=1.5.15
|
||||
CLUTTER_MIN_VERSION=1.7.5
|
||||
GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
|
||||
GJS_MIN_VERSION=0.7.11
|
||||
MUTTER_MIN_VERSION=3.0.0
|
||||
|
@ -198,7 +198,7 @@ create_recording_icon (void)
|
||||
|
||||
texture = cogl_texture_new_from_data (32, 32,
|
||||
COGL_TEXTURE_NONE,
|
||||
COGL_PIXEL_FORMAT_BGRA_8888,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
cairo_image_surface_get_stride (surface),
|
||||
cairo_image_surface_get_data (surface));
|
||||
@ -529,7 +529,7 @@ recorder_record_frame (ShellRecorder *recorder)
|
||||
cogl_read_pixels (0, 0,
|
||||
recorder->stage_width, recorder->stage_height,
|
||||
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
data);
|
||||
|
||||
recorder_draw_cursor (recorder, buffer);
|
||||
|
@ -232,11 +232,7 @@ xfixes_cursor_reset_image (ShellXFixesCursor *xfixes_cursor)
|
||||
sprite = cogl_texture_new_from_data (cursor_image->width,
|
||||
cursor_image->height,
|
||||
COGL_TEXTURE_NONE,
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||
#else
|
||||
COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
||||
#endif
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
cursor_image->width * 4, /* stride */
|
||||
cursor_data);
|
||||
|
@ -36,15 +36,6 @@
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
/* 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 PIXEL_FORMAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
|
||||
#else
|
||||
#define PIXEL_FORMAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE(StDrawingArea, st_drawing_area, ST_TYPE_WIDGET);
|
||||
|
||||
struct _StDrawingAreaPrivate {
|
||||
@ -122,7 +113,7 @@ st_drawing_area_paint (ClutterActor *self)
|
||||
{
|
||||
priv->texture = cogl_texture_new_with_size (width, height,
|
||||
COGL_TEXTURE_NONE,
|
||||
PIXEL_FORMAT);
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32);
|
||||
priv->needs_repaint = TRUE;
|
||||
}
|
||||
|
||||
@ -142,7 +133,7 @@ st_drawing_area_paint (ClutterActor *self)
|
||||
priv->context = NULL;
|
||||
|
||||
cogl_texture_set_region (priv->texture, 0, 0, 0, 0, width, height, width, height,
|
||||
PIXEL_FORMAT,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
cairo_image_surface_get_stride (surface),
|
||||
cairo_image_surface_get_data (surface));
|
||||
|
||||
|
@ -167,11 +167,7 @@ create_corner_material (StCornerSpec *corner)
|
||||
|
||||
texture = cogl_texture_new_from_data (size, size,
|
||||
COGL_TEXTURE_NONE,
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||
#else
|
||||
COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
||||
#endif
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
rowstride,
|
||||
data);
|
||||
@ -1250,14 +1246,7 @@ st_theme_node_prerender_background (StThemeNode *node)
|
||||
texture = cogl_texture_new_from_data (paint_box.x2 - paint_box.x1,
|
||||
paint_box.y2 - paint_box.y1,
|
||||
COGL_TEXTURE_NONE,
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
COGL_PIXEL_FORMAT_BGRA_8888_PRE,
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
COGL_PIXEL_FORMAT_ARGB_8888_PRE,
|
||||
#else
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
#error unknown endianness type
|
||||
#endif
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_ANY,
|
||||
rowstride,
|
||||
data);
|
||||
|
Loading…
Reference in New Issue
Block a user