Guest User

Untitled

a guest
May 27th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. From 14a5bac617e9b29bf4b48b0f877fb6053140b1cf Mon Sep 17 00:00:00 2001
  2. From: Neil Roberts <neil@linux.intel.com>
  3. Date: Wed, 9 Jun 2010 13:53:34 +0100
  4. Subject: [PATCH] cogl-material: Fix the function which sets the enable blend flag
  5.  
  6. This function had two problems. Firstly it would clear the enable
  7. blend flag before calling pre_change_notify so that if blending was
  8. previously enabled the journal would end up being flushed while the
  9. flag was still cleared. Secondly it would call the pre change notify
  10. whenever blending is needed regardless of whether it was already
  11. needed previously.
  12.  
  13. This was causing problems in test-depth.
  14. ---
  15. clutter/cogl/cogl/cogl-material.c | 12 +++++++++---
  16. 1 files changed, 9 insertions(+), 3 deletions(-)
  17.  
  18. diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c
  19. index fce8543..51adcb0 100644
  20. --- a/clutter/cogl/cogl/cogl-material.c
  21. +++ b/clutter/cogl/cogl/cogl-material.c
  22. @@ -359,14 +359,20 @@ _cogl_material_pre_change_notify (CoglMaterial *material,
  23. static void
  24. handle_automatic_blend_enable (CoglMaterial *material)
  25. {
  26. - material->flags &= ~COGL_MATERIAL_FLAG_ENABLE_BLEND;
  27. + gboolean needs_blending_enabled =
  28. + _cogl_material_needs_blending_enabled (material, NULL);
  29.  
  30. - if (_cogl_material_needs_blending_enabled (material, NULL))
  31. + if (needs_blending_enabled !=
  32. + !!(material->flags & COGL_MATERIAL_FLAG_ENABLE_BLEND))
  33. {
  34. _cogl_material_pre_change_notify (material,
  35. COGL_MATERIAL_CHANGE_ENABLE_BLEND,
  36. NULL);
  37. - material->flags |= COGL_MATERIAL_FLAG_ENABLE_BLEND;
  38. +
  39. + if (needs_blending_enabled)
  40. + material->flags |= COGL_MATERIAL_FLAG_ENABLE_BLEND;
  41. + else
  42. + material->flags &= ~COGL_MATERIAL_FLAG_ENABLE_BLEND;
  43. }
  44. }
  45.  
  46. --
  47. 1.7.1.87.g94e70
Add Comment
Please, Sign In to add comment