evas/gl: resolve float compare warnings

Summary: Depends on D11794

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11795
This commit is contained in:
Mike Blumenkrantz 2020-05-12 09:21:00 +02:00 committed by Xavi Artigas
parent 71dcddd648
commit e893d1ab7e
3 changed files with 13 additions and 14 deletions

View File

@ -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;

View File

@ -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. "

View File

@ -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;