summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-05-12 09:21:00 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2020-05-12 16:10:02 +0200
commite893d1ab7e770b2d1df75a730a3778480c079033 (patch)
tree073db7218eeda9492a8458efdf4cb3eb732bc0d4
parent71dcddd6486956382d2606c3e8e75a2e745d2433 (diff)
evas/gl: resolve float compare warnings
Summary: Depends on D11794 Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11795
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c12
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_gles1.c10
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c5
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)
546 if (ctx->current_sfc->alpha && !rsc->direct.render_op_copy && 546 if (ctx->current_sfc->alpha && !rsc->direct.render_op_copy &&
547 (mask & GL_COLOR_BUFFER_BIT)) 547 (mask & GL_COLOR_BUFFER_BIT))
548 { 548 {
549 if ((rsc->clear_color.a == 0) && 549 if (EINA_DBL_EQ(rsc->clear_color.a, 0) &&
550 (rsc->clear_color.r == 0) && 550 EINA_DBL_EQ(rsc->clear_color.r, 0) &&
551 (rsc->clear_color.g == 0) && 551 EINA_DBL_EQ(rsc->clear_color.g, 0) &&
552 (rsc->clear_color.b == 0)) 552 EINA_DBL_EQ(rsc->clear_color.b, 0))
553 { 553 {
554 // Skip clear color as we don't want to write black 554 // Skip clear color as we don't want to write black
555 mask &= ~GL_COLOR_BUFFER_BIT; 555 mask &= ~GL_COLOR_BUFFER_BIT;
556 } 556 }
557 else if (rsc->clear_color.a != 1.0) 557 else if (!EINA_DBL_EQ(rsc->clear_color.a, 1.0))
558 { 558 {
559 // TODO: Draw a rectangle? This will never be the perfect solution though. 559 // TODO: Draw a rectangle? This will never be the perfect solution though.
560 WRN("glClear() used with a semi-transparent color and direct rendering. " 560 WRN("glClear() used with a semi-transparent color and direct rendering. "
@@ -1115,7 +1115,7 @@ _evgl_glGetFloatv(GLenum pname, GLfloat* params)
1115 if (ctx->current_read_fbo == 0) 1115 if (ctx->current_read_fbo == 0)
1116 { 1116 {
1117 glGetFloatv(pname, params); 1117 glGetFloatv(pname, params);
1118 if (*params == GL_COLOR_ATTACHMENT0) 1118 if (EINA_DBL_EQ(*params, GL_COLOR_ATTACHMENT0))
1119 { 1119 {
1120 *params = (GLfloat)GL_BACK; 1120 *params = (GLfloat)GL_BACK;
1121 return; 1121 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)
544 */ 544 */
545 if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT)) 545 if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT))
546 { 546 {
547 if ((rsc->clear_color.a == 0) && 547 if (EINA_DBL_EQ(rsc->clear_color.a, 0) &&
548 (rsc->clear_color.r == 0) && 548 EINA_DBL_EQ(rsc->clear_color.r, 0) &&
549 (rsc->clear_color.g == 0) && 549 EINA_DBL_EQ(rsc->clear_color.g, 0) &&
550 (rsc->clear_color.b == 0)) 550 EINA_DBL_EQ(rsc->clear_color.b, 0))
551 { 551 {
552 // Skip clear color as we don't want to write black 552 // Skip clear color as we don't want to write black
553 mask &= ~GL_COLOR_BUFFER_BIT; 553 mask &= ~GL_COLOR_BUFFER_BIT;
554 } 554 }
555 else if (rsc->clear_color.a != 1.0) 555 else if (EINA_DBL_EQ(rsc->clear_color.a, 1.0))
556 { 556 {
557 // TODO: Draw a rectangle? This will never be the perfect solution though. 557 // TODO: Draw a rectangle? This will never be the perfect solution though.
558 WRN("glClear() used with a semi-transparent color and direct rendering. " 558 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
1719 int mx, int my, int mw, int mh, Shader_Sampling msam, int nms) 1719 int mx, int my, int mw, int mh, Shader_Sampling msam, int nms)
1720{ 1720{
1721 double glmx, glmy, glmw, glmh, yinv = -1.f; 1721 double glmx, glmy, glmw, glmh, yinv = -1.f;
1722 double gw = gc->w, gh = gc->h; 1722 int gw = gc->w, gh = gc->h, i, cnt = 6;
1723 int i, cnt = 6;
1724 1723
1725 if (!((gc->pipe[0].shader.surface == gc->def_surface) || 1724 if (!((gc->pipe[0].shader.surface == gc->def_surface) ||
1726 (!gc->pipe[0].shader.surface))) 1725 (!gc->pipe[0].shader.surface)))
@@ -2479,7 +2478,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2479 pipe_region_expand(gc, pn, x, y, w, h); 2478 pipe_region_expand(gc, pn, x, y, w, h);
2480 PIPE_GROW(gc, pn, 6); 2479 PIPE_GROW(gc, pn, 6);
2481 2480
2482 if (sw == 0.0) 2481 if (EINA_DBL_EQ(sw, 0.0))
2483 { 2482 {
2484 tx1 = tex->sx1; 2483 tx1 = tex->sx1;
2485 ty1 = tex->sy1; 2484 ty1 = tex->sy1;