xartigas pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e893d1ab7e770b2d1df75a730a3778480c079033

commit e893d1ab7e770b2d1df75a730a3778480c079033
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Tue May 12 09:21:00 2020 +0200

    evas/gl: resolve float compare warnings
    
    Summary: Depends on D11794
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D11795
---
 src/modules/evas/engines/gl_common/evas_gl_api.c       | 12 ++++++------
 src/modules/evas/engines/gl_common/evas_gl_api_gles1.c | 10 +++++-----
 src/modules/evas/engines/gl_common/evas_gl_context.c   |  5 ++---
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c 
b/src/modules/evas/engines/gl_common/evas_gl_api.c
index d66393b1e8..e33613a8bb 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -546,15 +546,15 @@ _evgl_glClear(GLbitfield mask)
              if (ctx->current_sfc->alpha && !rsc->direct.render_op_copy &&
                  (mask & GL_COLOR_BUFFER_BIT))
                {
-                  if ((rsc->clear_color.a == 0) &&
-                      (rsc->clear_color.r == 0) &&
-                      (rsc->clear_color.g == 0) &&
-                      (rsc->clear_color.b == 0))
+                  if (EINA_DBL_EQ(rsc->clear_color.a, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.r, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.g, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.b, 0))
                     {
                        // Skip clear color as we don't want to write black
                        mask &= ~GL_COLOR_BUFFER_BIT;
                     }
-                  else if (rsc->clear_color.a != 1.0)
+                  else if (!EINA_DBL_EQ(rsc->clear_color.a, 1.0))
                     {
                        // TODO: Draw a rectangle? This will never be the 
perfect solution though.
                        WRN("glClear() used with a semi-transparent color and 
direct rendering. "
@@ -1115,7 +1115,7 @@ _evgl_glGetFloatv(GLenum pname, GLfloat* params)
                   if (ctx->current_read_fbo == 0)
                     {
                        glGetFloatv(pname, params);
-                       if (*params == GL_COLOR_ATTACHMENT0)
+                       if (EINA_DBL_EQ(*params, GL_COLOR_ATTACHMENT0))
                          {
                             *params = (GLfloat)GL_BACK;
                             return;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c 
b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
index 3e2188dfbe..c48234f55b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
@@ -544,15 +544,15 @@ _evgl_gles1_glClear(GLbitfield mask)
               */
              if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT))
                {
-                  if ((rsc->clear_color.a == 0) &&
-                      (rsc->clear_color.r == 0) &&
-                      (rsc->clear_color.g == 0) &&
-                      (rsc->clear_color.b == 0))
+                  if (EINA_DBL_EQ(rsc->clear_color.a, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.r, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.g, 0) &&
+                      EINA_DBL_EQ(rsc->clear_color.b, 0))
                     {
                        // Skip clear color as we don't want to write black
                        mask &= ~GL_COLOR_BUFFER_BIT;
                     }
-                  else if (rsc->clear_color.a != 1.0)
+                  else if (EINA_DBL_EQ(rsc->clear_color.a, 1.0))
                     {
                        // TODO: Draw a rectangle? This will never be the 
perfect solution though.
                        WRN("glClear() used with a semi-transparent color and 
direct rendering. "
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c 
b/src/modules/evas/engines/gl_common/evas_gl_context.c
index bf88cbdaf0..40d9f98a22 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1719,8 +1719,7 @@ _push_mask(Evas_Engine_GL_Context *gc, const int pn, int 
nm, Evas_GL_Texture *mt
            int mx, int my, int mw, int mh, Shader_Sampling msam, int nms)
 {
    double glmx, glmy, glmw, glmh, yinv = -1.f;
-   double gw = gc->w, gh = gc->h;
-   int i, cnt = 6;
+   int gw = gc->w, gh = gc->h, i, cnt = 6;
 
    if (!((gc->pipe[0].shader.surface == gc->def_surface) ||
          (!gc->pipe[0].shader.surface)))
@@ -2479,7 +2478,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context 
*gc,
    pipe_region_expand(gc, pn, x, y, w, h);
    PIPE_GROW(gc, pn, 6);
 
-   if (sw == 0.0)
+   if (EINA_DBL_EQ(sw, 0.0))
      {
         tx1 = tex->sx1;
         ty1 = tex->sy1;

-- 


Reply via email to