mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
Turn off background repeats for a full-size image
If we have repeats on for a full-sized image, then if the background is displayed scaled (for example, in a desktop preview mode) then we can get artifacts along the edge of the background where the repeat of the opposite edge is blended in by bilinear scaling. So turn off repeats when the screen and background image sizes match. https://bugzilla.gnome.org/show_bug.cgi?id=634833
This commit is contained in:
parent
07e6c5aac2
commit
6260814285
@ -1081,8 +1081,8 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
|||||||
g_return_if_fail (info);
|
g_return_if_fail (info);
|
||||||
|
|
||||||
clutter_actor_set_size (info->stage, width, height);
|
clutter_actor_set_size (info->stage, width, height);
|
||||||
/* Background actor always requests the screen size */
|
|
||||||
clutter_actor_queue_relayout (info->background_actor);
|
meta_background_actor_screen_size_changed (META_BACKGROUND_ACTOR (info->background_actor));
|
||||||
|
|
||||||
meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
|
meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
|
||||||
meta_screen_get_screen_number (screen),
|
meta_screen_get_screen_number (screen),
|
||||||
|
@ -55,6 +55,26 @@ struct _MetaBackgroundActor
|
|||||||
|
|
||||||
G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR);
|
G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR);
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_wrap_mode (MetaBackgroundActor *self)
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
CoglMaterialWrapMode wrap_mode;
|
||||||
|
|
||||||
|
meta_screen_get_size (self->screen, &width, &height);
|
||||||
|
|
||||||
|
/* We turn off repeating when we have a full-screen pixmap to keep from
|
||||||
|
* getting artifacts from one side of the image sneaking into the other
|
||||||
|
* side of the image via bilinear filtering.
|
||||||
|
*/
|
||||||
|
if (width == self->texture_width && height == self->texture_height)
|
||||||
|
wrap_mode = COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
|
||||||
|
else
|
||||||
|
wrap_mode = COGL_PIPELINE_WRAP_MODE_REPEAT;
|
||||||
|
|
||||||
|
cogl_material_set_layer_wrap_mode (self->material, 0, wrap_mode);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_texture (MetaBackgroundActor *self,
|
set_texture (MetaBackgroundActor *self,
|
||||||
CoglHandle texture)
|
CoglHandle texture)
|
||||||
@ -73,6 +93,8 @@ set_texture (MetaBackgroundActor *self,
|
|||||||
self->texture_width = cogl_texture_get_width (texture);
|
self->texture_width = cogl_texture_get_width (texture);
|
||||||
self->texture_height = cogl_texture_get_height (texture);
|
self->texture_height = cogl_texture_get_height (texture);
|
||||||
|
|
||||||
|
update_wrap_mode (self);
|
||||||
|
|
||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,3 +400,15 @@ meta_background_actor_set_visible_region (MetaBackgroundActor *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_background_actor_screen_size_changed:
|
||||||
|
* @self: a #MetaBackgroundActor
|
||||||
|
*
|
||||||
|
* Called by the compositor when the size of the #MetaScreen changes
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
meta_background_actor_screen_size_changed (MetaBackgroundActor *self)
|
||||||
|
{
|
||||||
|
update_wrap_mode (self);
|
||||||
|
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
|
||||||
|
}
|
||||||
|
@ -50,8 +50,9 @@ GType meta_background_actor_get_type (void);
|
|||||||
|
|
||||||
ClutterActor *meta_background_actor_new (MetaScreen *screen);
|
ClutterActor *meta_background_actor_new (MetaScreen *screen);
|
||||||
|
|
||||||
void meta_background_actor_update (MetaBackgroundActor *actor);
|
void meta_background_actor_update (MetaBackgroundActor *actor);
|
||||||
void meta_background_actor_set_visible_region (MetaBackgroundActor *self,
|
void meta_background_actor_set_visible_region (MetaBackgroundActor *self,
|
||||||
cairo_region_t *visible_region);
|
cairo_region_t *visible_region);
|
||||||
|
void meta_background_actor_screen_size_changed (MetaBackgroundActor *self);
|
||||||
|
|
||||||
#endif /* META_BACKGROUND_ACTOR_H */
|
#endif /* META_BACKGROUND_ACTOR_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user