clutter/offscreen-effect: Unscale first, then translate the FBO texture

We had been doing it backwards as far back as e3966882e8 which meant
that we were translating by `fbo_offset / resource_scale` stage units
instead of just `fbo_offset`.

Because `fbo_offset` is in stage units already, it's not scaled and so
needs to be applied after the unscaling from texels to stage units.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1053>
This commit is contained in:
Daniel van Vugt 2020-12-15 16:41:30 +08:00 committed by Marge Bot
parent 2373ad2a19
commit f887b02714

View File

@ -436,19 +436,14 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
graphene_matrix_t transform;
float resource_scale;
float unscale;
graphene_matrix_init_translate (&transform,
&GRAPHENE_POINT3D_INIT (priv->fbo_offset_x,
priv->fbo_offset_y,
0.0f));
resource_scale = clutter_actor_get_resource_scale (priv->actor);
if (resource_scale != 1.0f)
{
float paint_scale = 1.0f / resource_scale;
graphene_matrix_scale (&transform, paint_scale, paint_scale, 1.f);
}
unscale = 1.0 / clutter_actor_get_resource_scale (priv->actor);
graphene_matrix_init_scale (&transform, unscale, unscale, 1.0);
graphene_matrix_translate (&transform,
&GRAPHENE_POINT3D_INIT (priv->fbo_offset_x,
priv->fbo_offset_y,
0.0));
if (!graphene_matrix_is_identity (&transform))
{