[cogl/wip/rib/master-next: 13/36] primitives: make validate_first_layer_cb update override pipeline



commit 47a44d49a7025e100dd7c8e34d6f72a95c5fb5c1
Author: Robert Bragg <robert linux intel com>
Date:   Wed Oct 12 11:53:31 2011 +0100

    primitives: make validate_first_layer_cb update override pipeline
    
    This fixes validate_first_layer_cb so that it update the override
    pipeline not the user's original pipeline. It also makes the check
    for when to override the wrap mode more robust by considering that
    we might add more wrap modes in the future.

 cogl/cogl-primitives.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
index c996b5e..9281306 100644
--- a/cogl/cogl-primitives.c
+++ b/cogl/cogl-primitives.c
@@ -143,23 +143,27 @@ validate_first_layer_cb (CoglPipeline *pipeline,
   /* We can't use hardware repeat so we need to set clamp to edge
    * otherwise it might pull in edge pixels from the other side. By
    * default WRAP_MODE_AUTOMATIC becomes CLAMP_TO_EDGE so we only need
-   * to override if the wrap mode is repeat.
+   * to override if the wrap mode isn't already automatic or
+   * clamp_to_edge.
    */
-  if (cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index) ==
-      COGL_PIPELINE_WRAP_MODE_REPEAT)
+  wrap_s = cogl_pipeline_get_layer_wrap_mode_s (pipeline, layer_index);
+  if (wrap_s != COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE &&
+      wrap_s != COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
     {
       if (!state->override_pipeline)
         state->override_pipeline = cogl_pipeline_copy (pipeline);
-      cogl_pipeline_set_layer_wrap_mode_s (pipeline, layer_index,
-                                           clamp_to_edge);
+      cogl_pipeline_set_layer_wrap_mode_s (state->override_pipeline,
+                                           layer_index, clamp_to_edge);
     }
-  if (cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index) ==
-      COGL_PIPELINE_WRAP_MODE_REPEAT)
+
+  wrap_t = cogl_pipeline_get_layer_wrap_mode_t (pipeline, layer_index);
+  if (wrap_t != COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE &&
+      wrap_t != COGL_PIPELINE_WRAP_MODE_AUTOMATIC)
     {
       if (!state->override_pipeline)
         state->override_pipeline = cogl_pipeline_copy (pipeline);
-      cogl_pipeline_set_layer_wrap_mode_t (pipeline, layer_index,
-                                           clamp_to_edge);
+      cogl_pipeline_set_layer_wrap_mode_t (state->override_pipeline,
+                                           layer_index, clamp_to_edge);
     }
 
   return FALSE;



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