[mutter/gbsneto/content: 111/111] shaped-texture: Update mipmap counters on invalidation



commit ae36f44cf64c3dc18a6515abde03c1dcc4b49204
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Dec 28 02:57:26 2018 -0200

    shaped-texture: Update mipmap counters on invalidation

 src/compositor/meta-shaped-texture.c | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 2d340e0a7..f1cb4616d 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -949,6 +949,24 @@ do_paint_content (MetaShapedTexture *stex,
   g_clear_pointer (&blended_tex_region, cairo_region_destroy);
 }
 
+static void
+update_invalidation_counters (MetaShapedTexture *stex)
+{
+  stex->prev_invalidation = stex->last_invalidation;
+  stex->last_invalidation = g_get_monotonic_time ();
+
+  if (stex->prev_invalidation)
+    {
+      gint64 interval = stex->last_invalidation - stex->prev_invalidation;
+      gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
+
+      if (!fast_update)
+        stex->fast_updates = 0;
+      else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
+        stex->fast_updates++;
+    }
+}
+
 static CoglTexture *
 select_texture_for_paint (MetaShapedTexture *stex)
 {
@@ -1072,6 +1090,8 @@ meta_shaped_texture_invalidate (ClutterContent *content)
 {
   MetaShapedTexture *stex = META_SHAPED_TEXTURE (content);
 
+  update_invalidation_counters (stex);
+
   if (!stex->invalidate_func)
     return;
 
@@ -1083,6 +1103,8 @@ meta_shaped_texture_invalidate_size (ClutterContent *content)
 {
   MetaShapedTexture *stex = META_SHAPED_TEXTURE (content);
 
+  update_invalidation_counters (stex);
+
   if (!stex->invalidate_func)
     return;
 
@@ -1193,20 +1215,6 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
                                   clip.width,
                                   clip.height);
 
-  stex->prev_invalidation = stex->last_invalidation;
-  stex->last_invalidation = g_get_monotonic_time ();
-
-  if (stex->prev_invalidation)
-    {
-      gint64 interval = stex->last_invalidation - stex->prev_invalidation;
-      gboolean fast_update = interval < MIN_MIPMAP_AGE_USEC;
-
-      if (!fast_update)
-        stex->fast_updates = 0;
-      else if (stex->fast_updates < MIN_FAST_UPDATES_BEFORE_UNMIPMAP)
-        stex->fast_updates++;
-    }
-
   unobscured_region = effective_unobscured_region (stex);
   if (unobscured_region)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]