From: Mike Blumenkrantz Date: Tue, 12 May 2020 07:21:00 +0000 (+0200) Subject: evas/gl: resolve float compare warnings X-Git-Tag: accepted/tizen/unified/20200604.164556~176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3d58e7652d0916b75c7bf0e00dc374976804a24;p=platform%2Fupstream%2Fefl.git evas/gl: resolve float compare warnings Summary: Depends on D11794 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11795 --- 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 9c62bd0..f9d3b49 100755 --- a/src/modules/evas/engines/gl_common/evas_gl_api.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api.c @@ -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; 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 c9a2c40..23092cd 100755 --- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c @@ -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. " 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 c3f9cbe..a60873b 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_context.c +++ b/src/modules/evas/engines/gl_common/evas_gl_context.c @@ -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;