clutter: Move cairo pixel format to cogl
As Cogl already defines a pixel format enum, it makes sense to move such endian dependant pixel format there Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
This commit is contained in:
parent
b65f333483
commit
98bd2aa2c2
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Clutter.
|
||||
*
|
||||
* An OpenGL based 'interactive canvas' library.
|
||||
*
|
||||
* Copyright (C) 2012 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include "clutter/clutter-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* 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
|
||||
|
||||
G_END_DECLS
|
@ -48,7 +48,6 @@
|
||||
#include "clutter/clutter-canvas.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-backend.h"
|
||||
#include "clutter/clutter-cairo.h"
|
||||
#include "clutter/clutter-color.h"
|
||||
#include "clutter/clutter-content-private.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
@ -369,7 +368,7 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
|
||||
priv->buffer = cogl_bitmap_new_with_size (ctx,
|
||||
real_width,
|
||||
real_height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32);
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT);
|
||||
}
|
||||
|
||||
buffer = COGL_BUFFER (cogl_bitmap_get_buffer (priv->buffer));
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "clutter/clutter-action-private.h"
|
||||
#include "clutter/clutter-actor-private.h"
|
||||
#include "clutter/clutter-backend-private.h"
|
||||
#include "clutter/clutter-cairo.h"
|
||||
#include "clutter/clutter-container.h"
|
||||
#include "clutter/clutter-debug.h"
|
||||
#include "clutter/clutter-enum-types.h"
|
||||
@ -2932,7 +2931,7 @@ clutter_stage_capture_view_into (ClutterStage *stage,
|
||||
context = clutter_backend_get_cogl_context (backend);
|
||||
bitmap = cogl_bitmap_new_for_data (context,
|
||||
texture_width, texture_height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
stride,
|
||||
data);
|
||||
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "clutter/clutter-blur-effect.h"
|
||||
#include "clutter/clutter-box-layout.h"
|
||||
#include "clutter/clutter-brightness-contrast-effect.h"
|
||||
#include "clutter/clutter-cairo.h"
|
||||
#include "clutter/clutter-canvas.h"
|
||||
#include "clutter/clutter-child-meta.h"
|
||||
#include "clutter/clutter-click-action.h"
|
||||
|
@ -16,7 +16,6 @@ clutter_headers = [
|
||||
'clutter-blur-effect.h',
|
||||
'clutter-box-layout.h',
|
||||
'clutter-brightness-contrast-effect.h',
|
||||
'clutter-cairo.h',
|
||||
'clutter-canvas.h',
|
||||
'clutter-child-meta.h',
|
||||
'clutter-click-action.h',
|
||||
|
@ -272,6 +272,17 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
|
||||
COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8 = (3 | COGL_DEPTH_BIT | COGL_STENCIL_BIT)
|
||||
} CoglPixelFormat;
|
||||
|
||||
/**
|
||||
* COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT:
|
||||
*
|
||||
* Architecture dependant format, similar to CAIRO_ARGB32.
|
||||
*/
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
#define COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
|
||||
#else
|
||||
#define COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* COGL_PIXEL_FORMAT_MAX_PLANES:
|
||||
*
|
||||
|
@ -486,7 +486,7 @@ meta_screen_cast_area_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src
|
||||
if (!clutter_stage_paint_to_buffer (stage, area, scale,
|
||||
data,
|
||||
stride,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
paint_flags,
|
||||
error))
|
||||
return FALSE;
|
||||
|
@ -570,7 +570,7 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
|
||||
if (!clutter_stage_paint_to_buffer (stage, &logical_monitor->rect, scale,
|
||||
data,
|
||||
stride,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
paint_flags,
|
||||
error))
|
||||
return FALSE;
|
||||
|
@ -401,7 +401,7 @@ meta_screen_cast_virtual_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
|
||||
scale,
|
||||
data,
|
||||
stride,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
paint_flags,
|
||||
error))
|
||||
return FALSE;
|
||||
|
@ -177,7 +177,7 @@ meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
|
||||
texture = cogl_texture_2d_new_from_data (cogl_context,
|
||||
cursor_image->width,
|
||||
cursor_image->height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
cursor_image->width * 4, /* stride */
|
||||
cursor_data,
|
||||
error);
|
||||
|
@ -1475,7 +1475,7 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
||||
cogl_texture_get_width (texture),
|
||||
cogl_texture_get_height (texture));
|
||||
|
||||
cogl_texture_get_data (texture, CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
cogl_texture_get_data (texture, COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
cairo_image_surface_get_stride (surface),
|
||||
cairo_image_surface_get_data (surface));
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ meta_window_actor_get_image (MetaWindowActor *self,
|
||||
0, 0,
|
||||
framebuffer_clip.width * resource_scale,
|
||||
framebuffer_clip.height * resource_scale,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
cairo_image_surface_get_data (surface));
|
||||
|
||||
g_object_unref (framebuffer);
|
||||
|
@ -245,7 +245,7 @@ capture_view_into (ClutterStageView *view,
|
||||
context = clutter_backend_get_cogl_context (backend);
|
||||
bitmap = cogl_bitmap_new_for_data (context,
|
||||
texture_width, texture_height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
|
||||
stride,
|
||||
buffer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user