Updated gfx back end to handle photoshop blend modes 47/265047/2
authorDavid Steele <david.steele@samsung.com>
Thu, 7 Oct 2021 16:40:53 +0000 (17:40 +0100)
committerDavid Steele <david.steele@samsung.com>
Thu, 7 Oct 2021 17:17:20 +0000 (18:17 +0100)
Change-Id: I16a5e6d6b9139ed5dec30acddc8ced23302d81db

automated-tests/src/dali-adaptor/dali-test-suite-utils/test-graphics-controller.cpp
dali/internal/graphics/gles-impl/gles-context.cpp
dali/internal/graphics/gles-impl/gles-graphics-types.h

index 08867195432360e2a431ff8c9e8ef6e26dcf6296..d2d8b161b9a14bafb49ee24ed5bd6b667bd26824 100644 (file)
@@ -379,8 +379,81 @@ GLenum GetBlendOp(Graphics::BlendOp blendOp)
     case Graphics::BlendOp::MAX:
       op = GL_MAX;
       break;
-
-      // @todo Add advanced blend equations
+    case Graphics::BlendOp::MULTIPLY:
+    {
+      op = GL_MULTIPLY;
+      break;
+    }
+    case Graphics::BlendOp::SCREEN:
+    {
+      op = GL_SCREEN;
+      break;
+    }
+    case Graphics::BlendOp::OVERLAY:
+    {
+      op = GL_OVERLAY;
+      break;
+    }
+    case Graphics::BlendOp::DARKEN:
+    {
+      op = GL_DARKEN;
+      break;
+    }
+    case Graphics::BlendOp::LIGHTEN:
+    {
+      op = GL_LIGHTEN;
+      break;
+    }
+    case Graphics::BlendOp::COLOR_DODGE:
+    {
+      op = GL_COLORDODGE;
+      break;
+    }
+    case Graphics::BlendOp::COLOR_BURN:
+    {
+      op = GL_COLORBURN;
+      break;
+    }
+    case Graphics::BlendOp::HARD_LIGHT:
+    {
+      op = GL_HARDLIGHT;
+      break;
+    }
+    case Graphics::BlendOp::SOFT_LIGHT:
+    {
+      op = GL_SOFTLIGHT;
+      break;
+    }
+    case Graphics::BlendOp::DIFFERENCE:
+    {
+      op = GL_DIFFERENCE;
+      break;
+    }
+    case Graphics::BlendOp::EXCLUSION:
+    {
+      op = GL_EXCLUSION;
+      break;
+    }
+    case Graphics::BlendOp::HUE:
+    {
+      op = GL_HSL_HUE;
+      break;
+    }
+    case Graphics::BlendOp::SATURATION:
+    {
+      op = GL_HSL_SATURATION;
+      break;
+    }
+    case Graphics::BlendOp::COLOR:
+    {
+      op = GL_HSL_COLOR;
+      break;
+    }
+    case Graphics::BlendOp::LUMINOSITY:
+    {
+      op = GL_HSL_LUMINOSITY;
+      break;
+    }
   }
   return op;
 }
index 13c1bad612c5402ecac4f03200f16782b5b6e73b..de5e058ca0c4d09dd153606ad5c78ceaaa3c4aac 100644 (file)
@@ -517,6 +517,10 @@ void Context::ResolveBlendState()
       if(newBlendState->colorBlendOp == newBlendState->alphaBlendOp)
       {
         gl.BlendEquation(GLBlendOp(newBlendState->colorBlendOp));
+        if(newBlendState->colorBlendOp >= Graphics::ADVANCED_BLEND_OPTIONS_START)
+        {
+          gl.BlendBarrier();
+        }
       }
       else
       {
index 06f95e3a88597678e19eb01de60e36093eb188a5..18069eb26a576d53ee5761a0504344c446b57a41 100644 (file)
@@ -1820,6 +1820,81 @@ struct GLBlendOp
         glBlendOp = GL_MAX;
         break;
       }
+      case Graphics::BlendOp::MULTIPLY:
+      {
+        glBlendOp = GL_MULTIPLY;
+        break;
+      }
+      case Graphics::BlendOp::SCREEN:
+      {
+        glBlendOp = GL_SCREEN;
+        break;
+      }
+      case Graphics::BlendOp::OVERLAY:
+      {
+        glBlendOp = GL_OVERLAY;
+        break;
+      }
+      case Graphics::BlendOp::DARKEN:
+      {
+        glBlendOp = GL_DARKEN;
+        break;
+      }
+      case Graphics::BlendOp::LIGHTEN:
+      {
+        glBlendOp = GL_LIGHTEN;
+        break;
+      }
+      case Graphics::BlendOp::COLOR_DODGE:
+      {
+        glBlendOp = GL_COLORDODGE;
+        break;
+      }
+      case Graphics::BlendOp::COLOR_BURN:
+      {
+        glBlendOp = GL_COLORBURN;
+        break;
+      }
+      case Graphics::BlendOp::HARD_LIGHT:
+      {
+        glBlendOp = GL_HARDLIGHT;
+        break;
+      }
+      case Graphics::BlendOp::SOFT_LIGHT:
+      {
+        glBlendOp = GL_SOFTLIGHT;
+        break;
+      }
+      case Graphics::BlendOp::DIFFERENCE:
+      {
+        glBlendOp = GL_DIFFERENCE;
+        break;
+      }
+      case Graphics::BlendOp::EXCLUSION:
+      {
+        glBlendOp = GL_EXCLUSION;
+        break;
+      }
+      case Graphics::BlendOp::HUE:
+      {
+        glBlendOp = GL_HSL_HUE;
+        break;
+      }
+      case Graphics::BlendOp::SATURATION:
+      {
+        glBlendOp = GL_HSL_SATURATION;
+        break;
+      }
+      case Graphics::BlendOp::COLOR:
+      {
+        glBlendOp = GL_HSL_COLOR;
+        break;
+      }
+      case Graphics::BlendOp::LUMINOSITY:
+      {
+        glBlendOp = GL_HSL_LUMINOSITY;
+        break;
+      }
     }
   }