backends/cursor: Add API to set and get the texture buffer transform

In Wayland clients can commit transformed surfaces, so the compositor
can directly use them on hardware planes. We already support that
for other surfaces, this is the first step to also support it on
cursor sprites.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/526
This commit is contained in:
Robert Mader 2019-04-08 18:12:23 +02:00 committed by Jonas Ådahl
parent b5354fb3cd
commit 1fc7935858
2 changed files with 27 additions and 0 deletions

View File

@ -43,6 +43,7 @@ typedef struct _MetaCursorSpritePrivate
CoglTexture2D *texture; CoglTexture2D *texture;
float texture_scale; float texture_scale;
MetaMonitorTransform texture_transform;
int hot_x, hot_y; int hot_x, hot_y;
} MetaCursorSpritePrivate; } MetaCursorSpritePrivate;
@ -110,6 +111,16 @@ meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite,
priv->texture_scale = scale; priv->texture_scale = scale;
} }
void
meta_cursor_sprite_set_texture_transform (MetaCursorSprite *sprite,
MetaMonitorTransform transform)
{
MetaCursorSpritePrivate *priv =
meta_cursor_sprite_get_instance_private (sprite);
priv->texture_transform = transform;
}
CoglTexture * CoglTexture *
meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite) meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite)
{ {
@ -140,6 +151,15 @@ meta_cursor_sprite_get_texture_scale (MetaCursorSprite *sprite)
return priv->texture_scale; return priv->texture_scale;
} }
MetaMonitorTransform
meta_cursor_sprite_get_texture_transform (MetaCursorSprite *sprite)
{
MetaCursorSpritePrivate *priv =
meta_cursor_sprite_get_instance_private (sprite);
return priv->texture_transform;
}
void void
meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite, meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite,
int x, int x,
@ -164,6 +184,7 @@ meta_cursor_sprite_init (MetaCursorSprite *sprite)
meta_cursor_sprite_get_instance_private (sprite); meta_cursor_sprite_get_instance_private (sprite);
priv->texture_scale = 1.0f; priv->texture_scale = 1.0f;
priv->texture_transform = META_MONITOR_TRANSFORM_NORMAL;
} }
static void static void

View File

@ -22,6 +22,7 @@
#ifndef META_CURSOR_H #ifndef META_CURSOR_H
#define META_CURSOR_H #define META_CURSOR_H
#include "backends/meta-backend-types.h"
#include "meta/common.h" #include "meta/common.h"
#include "meta/boxes.h" #include "meta/boxes.h"
@ -57,6 +58,9 @@ void meta_cursor_sprite_set_texture (MetaCursorSprite *sprite,
void meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite, void meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite,
float scale); float scale);
void meta_cursor_sprite_set_texture_transform (MetaCursorSprite *sprite,
MetaMonitorTransform transform);
CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite); CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite);
void meta_cursor_sprite_get_hotspot (MetaCursorSprite *sprite, void meta_cursor_sprite_get_hotspot (MetaCursorSprite *sprite,
@ -65,6 +69,8 @@ void meta_cursor_sprite_get_hotspot (MetaCursorSprite *sprite,
float meta_cursor_sprite_get_texture_scale (MetaCursorSprite *sprite); float meta_cursor_sprite_get_texture_scale (MetaCursorSprite *sprite);
MetaMonitorTransform meta_cursor_sprite_get_texture_transform (MetaCursorSprite *sprite);
gboolean meta_cursor_sprite_is_animated (MetaCursorSprite *sprite); gboolean meta_cursor_sprite_is_animated (MetaCursorSprite *sprite);
void meta_cursor_sprite_tick_frame (MetaCursorSprite *sprite); void meta_cursor_sprite_tick_frame (MetaCursorSprite *sprite);