compositor: Return more details from meta_actor_painting_untransformed
This adds x_scale and y_scale information, as well as simplifying the parameters. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2506>
This commit is contained in:
parent
0c12903352
commit
b29a6c4d0c
@ -69,8 +69,7 @@ gboolean
|
|||||||
meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
||||||
float widthf,
|
float widthf,
|
||||||
float heightf,
|
float heightf,
|
||||||
int *x_origin,
|
MetaTransforms *out_transforms)
|
||||||
int *y_origin)
|
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
|
int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
|
||||||
@ -90,6 +89,14 @@ meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
|||||||
x = v0x >> 8;
|
x = v0x >> 8;
|
||||||
y = v0y >> 8;
|
y = v0y >> 8;
|
||||||
|
|
||||||
|
if (out_transforms)
|
||||||
|
{
|
||||||
|
out_transforms->x_origin = x;
|
||||||
|
out_transforms->y_origin = y;
|
||||||
|
out_transforms->x_scale = (v1x - v0x) / (float) width;
|
||||||
|
out_transforms->y_scale = (v2y - v0y) / (float) height;
|
||||||
|
}
|
||||||
|
|
||||||
/* At integral coordinates? */
|
/* At integral coordinates? */
|
||||||
if (x * 256 != v0x || y * 256 != v0y)
|
if (x * 256 != v0x || y * 256 != v0y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -103,11 +110,6 @@ meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
|||||||
v3x != v1x || v3y != v2y)
|
v3x != v1x || v3y != v2y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (x_origin)
|
|
||||||
*x_origin = x;
|
|
||||||
if (y_origin)
|
|
||||||
*y_origin = y;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,8 +139,7 @@ meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
|||||||
int paint_height,
|
int paint_height,
|
||||||
int sample_width,
|
int sample_width,
|
||||||
int sample_height,
|
int sample_height,
|
||||||
int *x_origin,
|
MetaTransforms *out_transforms)
|
||||||
int *y_origin)
|
|
||||||
{
|
{
|
||||||
graphene_matrix_t modelview, projection, modelview_projection;
|
graphene_matrix_t modelview, projection, modelview_projection;
|
||||||
graphene_point3d_t vertices[4];
|
graphene_point3d_t vertices[4];
|
||||||
@ -183,6 +184,6 @@ meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
|||||||
|
|
||||||
return meta_actor_vertices_are_untransformed (vertices,
|
return meta_actor_vertices_are_untransformed (vertices,
|
||||||
sample_width, sample_height,
|
sample_width, sample_height,
|
||||||
x_origin, y_origin);
|
out_transforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,18 +23,21 @@
|
|||||||
|
|
||||||
#include "clutter/clutter.h"
|
#include "clutter/clutter.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x_origin, y_origin;
|
||||||
|
float x_scale, y_scale;
|
||||||
|
} MetaTransforms;
|
||||||
|
|
||||||
gboolean meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
gboolean meta_actor_vertices_are_untransformed (graphene_point3d_t *verts,
|
||||||
float widthf,
|
float widthf,
|
||||||
float heightf,
|
float heightf,
|
||||||
int *x_origin,
|
MetaTransforms *out_transforms);
|
||||||
int *y_origin);
|
|
||||||
|
|
||||||
gboolean meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
gboolean meta_actor_painting_untransformed (CoglFramebuffer *fb,
|
||||||
int paint_width,
|
int paint_width,
|
||||||
int paint_height,
|
int paint_height,
|
||||||
int sample_widthf,
|
int sample_widthf,
|
||||||
int sample_heightf,
|
int sample_heightf,
|
||||||
int *x_origin,
|
MetaTransforms *out_transforms);
|
||||||
int *y_origin);
|
|
||||||
|
|
||||||
#endif /* __META_CLUTTER_UTILS_H__ */
|
#endif /* __META_CLUTTER_UTILS_H__ */
|
||||||
|
@ -548,7 +548,7 @@ setup_pipeline (MetaBackgroundContent *self,
|
|||||||
actor_pixel_rect->height,
|
actor_pixel_rect->height,
|
||||||
self->texture_width,
|
self->texture_width,
|
||||||
self->texture_height,
|
self->texture_height,
|
||||||
NULL, NULL))
|
NULL))
|
||||||
{
|
{
|
||||||
min_filter = COGL_PIPELINE_FILTER_NEAREST;
|
min_filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||||
mag_filter = COGL_PIPELINE_FILTER_NEAREST;
|
mag_filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||||
|
@ -175,7 +175,7 @@ meta_cullable_default_is_untransformed (MetaCullable *cullable)
|
|||||||
clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (cullable), verts);
|
clutter_actor_get_abs_allocation_vertices (CLUTTER_ACTOR (cullable), verts);
|
||||||
|
|
||||||
return meta_actor_vertices_are_untransformed (verts, width, height,
|
return meta_actor_vertices_are_untransformed (verts, width, height,
|
||||||
NULL, NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -712,7 +712,7 @@ do_paint_content (MetaShapedTexture *stex,
|
|||||||
if (meta_actor_painting_untransformed (framebuffer,
|
if (meta_actor_painting_untransformed (framebuffer,
|
||||||
dst_width, dst_height,
|
dst_width, dst_height,
|
||||||
sample_width, sample_height,
|
sample_width, sample_height,
|
||||||
NULL, NULL))
|
NULL))
|
||||||
filter = COGL_PIPELINE_FILTER_NEAREST;
|
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||||
else
|
else
|
||||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||||
|
@ -331,7 +331,7 @@ meta_surface_actor_is_untransformed (MetaCullable *cullable)
|
|||||||
return meta_actor_vertices_are_untransformed (verts,
|
return meta_actor_vertices_are_untransformed (verts,
|
||||||
width * geometry_scale,
|
width * geometry_scale,
|
||||||
height * geometry_scale,
|
height * geometry_scale,
|
||||||
NULL, NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -92,6 +92,7 @@ meta_window_group_paint (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
CoglFramebuffer *fb;
|
CoglFramebuffer *fb;
|
||||||
ClutterStageView *view;
|
ClutterStageView *view;
|
||||||
|
MetaTransforms trans;
|
||||||
|
|
||||||
fb = clutter_paint_context_get_framebuffer (paint_context);
|
fb = clutter_paint_context_get_framebuffer (paint_context);
|
||||||
view = clutter_paint_context_get_stage_view (paint_context);
|
view = clutter_paint_context_get_stage_view (paint_context);
|
||||||
@ -102,13 +103,15 @@ meta_window_group_paint (ClutterActor *actor,
|
|||||||
screen_height,
|
screen_height,
|
||||||
screen_width,
|
screen_width,
|
||||||
screen_height,
|
screen_height,
|
||||||
&paint_x_origin,
|
&trans) ||
|
||||||
&paint_y_origin) ||
|
|
||||||
!meta_cullable_is_untransformed (META_CULLABLE (actor)))
|
!meta_cullable_is_untransformed (META_CULLABLE (actor)))
|
||||||
{
|
{
|
||||||
parent_actor_class->paint (actor, paint_context);
|
parent_actor_class->paint (actor, paint_context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paint_x_origin = trans.x_origin;
|
||||||
|
paint_y_origin = trans.y_origin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user