evas/gl: resolve float compare warnings
authorMike Blumenkrantz <zmike@samsung.com>
Tue, 12 May 2020 07:21:00 +0000 (09:21 +0200)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 12 May 2020 21:52:14 +0000 (06:52 +0900)
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
src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
src/modules/evas/engines/gl_common/evas_gl_context.c

index 9c62bd0..f9d3b49 100755 (executable)
@@ -551,15 +551,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. "
@@ -1178,7 +1178,7 @@ _evgl_glGetFloatv(GLenum pname, GLfloat* params)
                   if (ctx->current_read_fbo == 0)
                     {
                        EVGL_TH(glGetFloatv, pname, params);
-                       if (*params == GL_COLOR_ATTACHMENT0)
+                       if (EINA_DBL_EQ(*params, GL_COLOR_ATTACHMENT0))
                          {
                             *params = (GLfloat)GL_BACK;
                             return;
index c9a2c40..23092cd 100755 (executable)
@@ -140,15 +140,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. "
index c3f9cbe..a60873b 100644 (file)
@@ -1841,8 +1841,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)))
@@ -2745,7 +2744,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;