GDK_MEMORY_N_FORMATS
} GdkMemoryFormat;
+/**
+ * GDK_MEMORY_DEFAULT:
+ *
+ * This is the default memory format used by GTK and is the format
+ * provided by gdk_texture_download(). It is equal to
+ * %CAIRO_FORMAT_ARGB32.
+ *
+ * Be aware that unlike the #GdkMemoryFormat values, this format is
+ * different for different endianness.
+ */
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define GDK_MEMORY_DEFAULT GDK_MEMORY_B8G8R8A8_PREMULTIPLIED
+#elif G_BYTE_ORDER == G_BIG_ENDIAN
+#define GDK_MEMORY_DEFAULT GDK_MEMORY_A8R8G8B8_PREMULTIPLIED
+#else
+#error "Unknown byte order for GDK_MEMORY_DEFAULT"
+#endif
+
GDK_AVAILABLE_IN_ALL
GdkTexture * gdk_memory_texture_new (int width,
int height,
/* maximum bytes per pixel */
#define MAX_BPP 4
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define GDK_MEMORY_CAIRO_FORMAT_ARGB32 GDK_MEMORY_B8G8R8A8_PREMULTIPLIED
-#elif G_BYTE_ORDER == G_BIG_ENDIAN
-#define GDK_MEMORY_CAIRO_FORMAT_ARGB32 GDK_MEMORY_A8R8G8B8_PREMULTIPLIED
-#endif
-
typedef enum {
BLUE,
GREEN,
const TestData *test_data = data;
GdkTexture *expected, *test;
- expected = create_texture (GDK_MEMORY_CAIRO_FORMAT_ARGB32, test_data->color, 1, 1, tests[test_data->format].bytes_per_pixel);
+ expected = create_texture (GDK_MEMORY_DEFAULT, test_data->color, 1, 1, tests[test_data->format].bytes_per_pixel);
test = create_texture (test_data->format, test_data->color, 1, 1, tests[test_data->format].bytes_per_pixel);
compare_textures (expected, test, tests[test_data->format].opaque);
const TestData *test_data = data;
GdkTexture *expected, *test;
- expected = create_texture (GDK_MEMORY_CAIRO_FORMAT_ARGB32, test_data->color, 1, 1, 4);
+ expected = create_texture (GDK_MEMORY_DEFAULT, test_data->color, 1, 1, 4);
test = create_texture (test_data->format, test_data->color, 1, 1, 2 * MAX_BPP);
compare_textures (expected, test, tests[test_data->format].opaque);
const TestData *test_data = data;
GdkTexture *expected, *test;
- expected = create_texture (GDK_MEMORY_CAIRO_FORMAT_ARGB32, test_data->color, 4, 4, 16);
+ expected = create_texture (GDK_MEMORY_DEFAULT, test_data->color, 4, 4, 16);
test = create_texture (test_data->format, test_data->color, 4, 4, 4 * tests[test_data->format].bytes_per_pixel);
compare_textures (expected, test, tests[test_data->format].opaque);
const TestData *test_data = data;
GdkTexture *expected, *test;
- expected = create_texture (GDK_MEMORY_CAIRO_FORMAT_ARGB32, test_data->color, 4, 4, 16);
+ expected = create_texture (GDK_MEMORY_DEFAULT, test_data->color, 4, 4, 16);
test = create_texture (test_data->format, test_data->color, 4, 4, 4 * MAX_BPP);
compare_textures (expected, test, tests[test_data->format].opaque);