This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch span-gl-clean
in repository efl.
View the commit online.
commit 1b31ea2352d3c58d37b76dc71e769e100bbb2e2c
Author: [email protected] <[email protected]>
AuthorDate: Sun Sep 13 16:38:14 2026 -0600
evas_ector_gl: parenthesize mixed-precedence expressions
Carsten's review pointed out that EFL code does not rely on C's operator
precedence when an _expression_ mixes operators of different priority.
Readers should see the grouping without recalling the table, so EFL
writes
if ((sd->type == LinearGradient) || (sd->type == RadialGradient))
rather than leaving the comparisons bare. The same applies to computed
and returned values, not just if conditions.
Apply that rule to the code this branch added:
- comparisons combined with && or ||;
- arithmetic mixing * or / with + or -, including pointer offsets and
array indices, e.g. buffer + ((size_t)y * stride);
- binary expressions used as the condition or a branch of ?:;
- binary expressions on the right-hand side of compound assignments
such as |= and +=.
Chains of a single operator (a || b || c), plain assignments with one
operator, unary operators, casts, GLSL source held in C strings, and
lines that already existed on master are left unchanged.
Most sites were found from clang's AST so multi-line expressions were
covered. The few whose operands are macros, which that pass skips, were
fixed by hand.
This change only adds parentheses: with every ( and ) removed, each
file is identical to its previous version. The build is clean, and
ector_suite and evas_suite pass.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
src/lib/ector/software/ector_software_rasterizer.c | 2 +-
src/lib/evas/canvas/efl_canvas_vg_container.c | 10 ++--
src/lib/evas/common/evas_common_generic_cache.c | 8 +--
.../evas/engines/gl_common/evas_gl_context.c | 14 ++---
.../engines/gl_generic/evas_ector_gl_grad_atlas.c | 12 ++--
.../evas/engines/gl_generic/evas_ector_gl_span.c | 60 ++++++++++----------
.../engines/gl_generic/evas_ector_gl_span_shader.c | 66 +++++++++++-----------
src/modules/evas/engines/gl_generic/evas_engine.c | 64 ++++++++++-----------
8 files changed, 118 insertions(+), 118 deletions(-)
diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c
index 615a6967c9..99e95762f8 100644
--- a/src/lib/ector/software/ector_software_rasterizer.c
+++ b/src/lib/ector/software/ector_software_rasterizer.c
@@ -978,7 +978,7 @@ ector_software_rasterizer_draw_rle_data(Software_Rasterizer *rasterizer,
/* Select the collector callback based on fill type. */
{
SW_FT_SpanFunc cb;
- if (sd->type == LinearGradient || sd->type == RadialGradient)
+ if ((sd->type == LinearGradient) || (sd->type == RadialGradient))
cb = sd->collector_gradient;
else if (sd->comp)
cb = sd->collector_composite;
diff --git a/src/lib/evas/canvas/efl_canvas_vg_container.c b/src/lib/evas/canvas/efl_canvas_vg_container.c
index db55edc671..1b7920c7a2 100644
--- a/src/lib/evas/canvas/efl_canvas_vg_container.c
+++ b/src/lib/evas/canvas/efl_canvas_vg_container.c
@@ -12,10 +12,10 @@
static inline Eina_Bool
_comp_method_needs_mask(Efl_Gfx_Vg_Composite_Method m)
{
- return (m == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA ||
- m == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE ||
- m == EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT ||
- m == EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT);
+ return ((m == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA) ||
+ (m == EFL_GFX_VG_COMPOSITE_METHOD_MATTE_ALPHA_INVERSE) ||
+ (m == EFL_GFX_VG_COMPOSITE_METHOD_MASK_INTERSECT) ||
+ (m == EFL_GFX_VG_COMPOSITE_METHOD_MASK_SUBSTRACT));
}
static void
@@ -108,7 +108,7 @@ _prepare_comp(Evas_Object_Protected_Data *obj, //vector object
{
int mw = 0, mh = 0;
ENFN->image_size_get(ENC, mask_surface, &mw, &mh);
- if (mw != size.w || mh != size.h)
+ if ((mw != size.w) || (mh != size.h))
{
ENFN->ector_surface_destroy(ENC, mask_surface);
mask_surface = NULL;
diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c
index 1dac897afc..fa39faa5af 100644
--- a/src/lib/evas/common/evas_common_generic_cache.c
+++ b/src/lib/evas/common/evas_common_generic_cache.c
@@ -18,7 +18,7 @@ _generic_cache_budget(void)
const char *e = getenv("EVAS_SURFACE_CACHE_SIZE");
long kb = e ? atol(e) : 0;
- v = (kb > 0) ? (size_t)kb * 1024 : GENERIC_CACHE_DEFAULT_BUDGET;
+ v = (kb > 0) ? ((size_t)kb * 1024) : GENERIC_CACHE_DEFAULT_BUDGET;
}
return v;
}
@@ -33,7 +33,7 @@ _generic_cache_trim(Generic_Cache *cache)
Eina_List *l, *prev;
int count = (int)eina_list_count(cache->lru_list);
- if (!cache->size_func && count <= 50) return;
+ if (!cache->size_func && (count <= 50)) return;
for (l = eina_list_last(cache->lru_list); l; l = prev)
{
@@ -41,7 +41,7 @@ _generic_cache_trim(Generic_Cache *cache)
if (cache->size_func)
{
- if (cache->bytes <= cache->budget &&
+ if ((cache->bytes <= cache->budget) &&
count <= GENERIC_CACHE_MAX_ENTRIES) break;
}
else if (count <= 50) break;
@@ -59,7 +59,7 @@ _generic_cache_trim(Generic_Cache *cache)
if (l == cache->lru_list) break;
prev = eina_list_prev(l);
- if (!entry || entry->ref > 1) continue;
+ if (!entry || (entry->ref > 1)) continue;
eina_hash_del(cache->hash, &entry->key, entry);
cache->lru_list = eina_list_remove_list(cache->lru_list, l);
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 91c812d7ff..9f948fadf8 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -2105,7 +2105,7 @@ evas_gl_common_span_fill_vertices(void *out_buf, Span_Variant variant,
/* Mask inv: 0=normal, 1=invert. Derived from comp_method; methods 2
* and 4 invert the mask, others use the mask alpha directly. */
float mask_inv = 0.0f;
- if (p->comp_method == 2 || p->comp_method == 4) mask_inv = 1.0f;
+ if ((p->comp_method == 2) || (p->comp_method == 4)) mask_inv = 1.0f;
/* Build the common header once; pos is overwritten per vertex in the loop. */
Span_Vertex_Common common;
@@ -2129,15 +2129,15 @@ evas_gl_common_span_fill_vertices(void *out_buf, Span_Variant variant,
for (int v = 0; v < 6; v++)
{
const int corner = idx[v];
- common.pos[0] = ndc_quad[corner * 2 + 0];
- common.pos[1] = ndc_quad[corner * 2 + 1];
+ common.pos[0] = ndc_quad[(corner * 2) + 0];
+ common.pos[1] = ndc_quad[(corner * 2) + 1];
switch (variant)
{
case SPAN_VARIANT_SOLID:
{
Span_Vertex_Solid *o =
- (Span_Vertex_Solid *)((char *)out_buf + v * sizeof(*o));
+ (Span_Vertex_Solid *)((char *)out_buf + (v * sizeof(*o)));
o->c = common;
o->fill_col[0] = (float)((p->fill.col >> 16) & 0xFF) / 255.0f;
o->fill_col[1] = (float)((p->fill.col >> 8) & 0xFF) / 255.0f;
@@ -2152,7 +2152,7 @@ evas_gl_common_span_fill_vertices(void *out_buf, Span_Variant variant,
case SPAN_VARIANT_SOLID_MASK:
{
Span_Vertex_Solid_Mask *o =
- (Span_Vertex_Solid_Mask *)((char *)out_buf + v * sizeof(*o));
+ (Span_Vertex_Solid_Mask *)((char *)out_buf + (v * sizeof(*o)));
o->s.c = common;
o->s.fill_col[0] = (float)((p->fill.col >> 16) & 0xFF) / 255.0f;
o->s.fill_col[1] = (float)((p->fill.col >> 8) & 0xFF) / 255.0f;
@@ -2173,7 +2173,7 @@ evas_gl_common_span_fill_vertices(void *out_buf, Span_Variant variant,
case SPAN_VARIANT_GRADIENT:
{
Span_Vertex_Gradient *o =
- (Span_Vertex_Gradient *)((char *)out_buf + v * sizeof(*o));
+ (Span_Vertex_Gradient *)((char *)out_buf + (v * sizeof(*o)));
o->c = common;
_span_side_grad_set(o->fill_grad_abc_y, o->fill_grad_def,
o->fill_grad_radial, &p->fill);
@@ -2184,7 +2184,7 @@ evas_gl_common_span_fill_vertices(void *out_buf, Span_Variant variant,
case SPAN_VARIANT_GRADIENT_MASK:
{
Span_Vertex_Gradient_Mask *o =
- (Span_Vertex_Gradient_Mask *)((char *)out_buf + v * sizeof(*o));
+ (Span_Vertex_Gradient_Mask *)((char *)out_buf + (v * sizeof(*o)));
o->g.c = common;
_span_side_grad_set(o->g.fill_grad_abc_y, o->g.fill_grad_def,
o->g.fill_grad_radial, &p->fill);
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_grad_atlas.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_grad_atlas.c
index a548d48435..88191832a0 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_grad_atlas.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_grad_atlas.c
@@ -127,8 +127,8 @@ _find_identity(Span_Grad_Atlas *a, void *grad_id, uint32_t version)
{
for (int i = 0; i < SPAN_GRAD_ATLAS_H; i++)
if (a->rows[i].occupied &&
- a->rows[i].grad_id == grad_id &&
- a->rows[i].version == version)
+ (a->rows[i].grad_id == grad_id) &&
+ (a->rows[i].version == version))
return i;
return -1;
}
@@ -142,7 +142,7 @@ _find_by_content(Span_Grad_Atlas *a, uint32_t hash, const uint8_t *bytes)
{
if (!a->rows[i].occupied) continue;
if (a->rows[i].hash != hash) continue;
- if (memcmp(a->cpu_mirror + (size_t)i * SPAN_GRAD_ATLAS_ROW_BYTES,
+ if (memcmp(a->cpu_mirror + ((size_t)i * SPAN_GRAD_ATLAS_ROW_BYTES),
bytes, SPAN_GRAD_ATLAS_ROW_BYTES) == 0)
return i;
}
@@ -174,7 +174,7 @@ _alloc_row(Span_Grad_Atlas *a)
for (int i = 0; i < SPAN_GRAD_ATLAS_H; i++)
{
if (a->rows[i].last_used == a->current_frame) continue; /* pinned */
- if (best < 0 || a->rows[i].last_used < best_age)
+ if ((best < 0) || (a->rows[i].last_used < best_age))
{ best = i; best_age = a->rows[i].last_used; }
}
if (best >= 0) return best;
@@ -194,7 +194,7 @@ _alloc_row(Span_Grad_Atlas *a)
* == 0). Without the guard every row's age would wrap to
* UINT32_MAX and never be beaten again, flattening the LRU for
* the atlas's lifetime. */
- a->rows[i].last_used = a->current_frame ? a->current_frame - 1 : 0;
+ a->rows[i].last_used = a->current_frame ? (a->current_frame - 1) : 0;
best = 0;
best_age = a->rows[0].last_used;
@@ -247,7 +247,7 @@ _upload_row(Span_Grad_Atlas *a, int row, const uint8_t *bytes)
#ifdef SPAN_GRAD_ATLAS_TEST_BUILD
mirror_only:
#endif
- memcpy(a->cpu_mirror + (size_t)row * SPAN_GRAD_ATLAS_ROW_BYTES,
+ memcpy(a->cpu_mirror + ((size_t)row * SPAN_GRAD_ATLAS_ROW_BYTES),
bytes, SPAN_GRAD_ATLAS_ROW_BYTES);
}
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
index 118ac32c78..d8ed15c6fe 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.c
@@ -62,7 +62,7 @@ _span_texture_init(Span_Texture *tex, int h, int stride, int x_min, int x_max)
{
memset(tex, 0, sizeof(*tex));
- if (h <= 0 || h > 16384) return EINA_FALSE;
+ if ((h <= 0) || (h > 16384)) return EINA_FALSE;
tex->buffer = calloc(h, stride);
tex->span_counts = calloc(h, sizeof(int));
@@ -92,7 +92,7 @@ span_collector_new(int h, int max_spans, Span_Data_Type type)
{
Span_Collector *sc;
- if (h <= 0 || max_spans <= 0) return NULL;
+ if ((h <= 0) || (max_spans <= 0)) return NULL;
sc = calloc(1, sizeof(Span_Collector));
if (!sc) return NULL;
@@ -144,7 +144,7 @@ span_collector_resize(Span_Collector *sc, int h)
{
int i;
- if (!sc || h <= 0) return;
+ if (!sc || (h <= 0)) return;
if (sc->h == h) return; /* no change at all */
@@ -189,7 +189,7 @@ span_collector_resize(Span_Collector *sc, int h)
tex->last_x_end = new_last;
/* Zero the newly added rows only. */
- memset(tex->buffer + (size_t)sc->alloc_h * sc->stride,
+ memset(tex->buffer + ((size_t)sc->alloc_h * sc->stride),
0, (size_t)(h - sc->alloc_h) * sc->stride);
memset(tex->span_counts + sc->alloc_h,
0, (size_t)(h - sc->alloc_h) * sizeof(int));
@@ -249,7 +249,7 @@ span_collector_clear(Span_Collector *sc)
* _collect_spans_solid memsets the full tail for rows it touches,
* so this 4-byte-stride write covers only the uncollected rows. */
for (y = 0; y < sc->h; y++)
- tex->buffer[(size_t)y * sc->stride + 1] = 0; /* byte[1] = len = 0 */
+ tex->buffer[((size_t)y * sc->stride) + 1] = 0; /* byte[1] = len = 0 */
tex->dirty = EINA_FALSE;
tex->rolling_hash = 2166136261u; /* seed */
@@ -340,12 +340,12 @@ _find_split_x(Span_Texture *tex, int y, int stride, int bytes_per_span)
abs_x += gap;
/* Skip gap extender entries (cov==0 && len==1): advance position
* but do not count them when computing the midpoint average. */
- if (cov == 0 && len == 1)
+ if ((cov == 0) && (len == 1))
{
abs_x += len;
continue;
}
- sum_x += abs_x + len / 2;
+ sum_x += (abs_x + (len / 2));
real_count++;
abs_x += len;
}
@@ -373,9 +373,9 @@ _emit_gap_extenders(uint8_t *row_buf, int idx, int max_spans,
{
int written = 0;
- while (*gap_ptr > 255 && (idx + written) < max_spans)
+ while ((*gap_ptr > 255) && ((idx + written) < max_spans))
{
- _write_span_entry(row_buf + (size_t)(idx + written) * 4,
+ _write_span_entry(row_buf + ((size_t)(idx + written) * 4),
0, 1, 255);
*gap_ptr -= 256; /* 255 gap + 1 len */
written++;
@@ -430,7 +430,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
split_x = _find_split_x(old_tex, overflow_y, sc->stride, bytes_per_span);
/* Guard against degenerate split points that would produce an empty half. */
- if (split_x <= old_tex->x_min || split_x >= old_tex->x_max)
+ if ((split_x <= old_tex->x_min) || (split_x >= old_tex->x_max))
return EINA_FALSE;
/* Save x_max before realloc potentially moves the textures array. */
@@ -490,12 +490,12 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
int left_last = old_tex->x_min;
int right_last = split_x;
- uint8_t *left_row = old_tex->buffer + (size_t)y * sc->stride;
- uint8_t *right_row = new_tex->buffer + (size_t)y * sc->stride;
+ uint8_t *left_row = old_tex->buffer + ((size_t)y * sc->stride);
+ uint8_t *right_row = new_tex->buffer + ((size_t)y * sc->stride);
for (i = 0; i < src_count; i++)
{
- uint8_t *src_entry = left_row + (size_t)i * bytes_per_span;
+ uint8_t *src_entry = left_row + ((size_t)i * bytes_per_span);
int gap = src_entry[2];
int len = src_entry[1];
int cov = src_entry[0];
@@ -504,7 +504,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
abs_x += gap; /* start of this span in absolute coords */
/* Skip source gap extender entries — just advance position. */
- if (cov == 0 && len == 1)
+ if ((cov == 0) && (len == 1))
{
abs_x += len;
continue;
@@ -522,7 +522,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
sc->stride, &new_gap);
if (left_idx < sc->max_spans)
{
- _write_span_entry(left_row + (size_t)left_idx * 4,
+ _write_span_entry(left_row + ((size_t)left_idx * 4),
cov, len, new_gap);
left_idx++;
left_last = span_end;
@@ -537,7 +537,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
sc->stride, &new_gap);
if (right_idx < sc->max_spans)
{
- _write_span_entry(right_row + (size_t)right_idx * 4,
+ _write_span_entry(right_row + ((size_t)right_idx * 4),
cov, len, new_gap);
right_idx++;
right_last = span_end;
@@ -557,7 +557,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
sc->stride, &new_gap);
if (left_idx < sc->max_spans)
{
- _write_span_entry(left_row + (size_t)left_idx * 4,
+ _write_span_entry(left_row + ((size_t)left_idx * 4),
cov, left_len, new_gap);
left_idx++;
left_last = split_x;
@@ -567,7 +567,7 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
/* Right fragment starts exactly at split_x → gap = 0. */
if (right_idx < sc->max_spans)
{
- _write_span_entry(right_row + (size_t)right_idx * 4,
+ _write_span_entry(right_row + ((size_t)right_idx * 4),
cov, right_len, 0);
right_idx++;
right_last = span_end;
@@ -588,10 +588,10 @@ _do_spatial_split(Span_Collector *sc, int overflow_y)
* The collection callback's row-change memset won't cover these
* since the split happens mid-collection. */
if (left_idx < sc->max_spans)
- memset(left_row + (size_t)left_idx * 4, 0,
+ memset(left_row + ((size_t)left_idx * 4), 0,
(size_t)(sc->max_spans + 1 - left_idx) * 4);
if (right_idx < sc->max_spans)
- memset(right_row + (size_t)right_idx * 4, 0,
+ memset(right_row + ((size_t)right_idx * 4), 0,
(size_t)(sc->max_spans + 1 - right_idx) * 4);
}
@@ -625,7 +625,7 @@ _find_texture_for_x(Span_Collector *sc, int x)
for (i = 0; i < sc->texture_count; i++)
{
- if (x >= sc->textures[i].x_min && x <= sc->textures[i].x_max)
+ if ((x >= sc->textures[i].x_min) && (x <= sc->textures[i].x_max))
return i;
}
return 0;
@@ -722,7 +722,7 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
sx = spans->x + sd->offx;
/* Skip spans outside the canvas. */
- if (y < 0 || y >= sc->h)
+ if ((y < 0) || (y >= sc->h))
{
spans++;
count--;
@@ -740,7 +740,7 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
* memset is nearly free.
*
* Only fires when y actually changes — not once per span. */
- if (y != sc->flush_prev_y && sc->flush_prev_y >= 0 && sc->flush_prev_ti >= 0)
+ if ((y != sc->flush_prev_y) && (sc->flush_prev_y >= 0) && (sc->flush_prev_ti >= 0))
_flush_row_tail(sc, sc->flush_prev_ti, sc->flush_prev_y);
ti = (sc->texture_count == 1) ? 0 : _find_texture_for_x(sc, sx);
@@ -777,7 +777,7 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
/* Compute gap relative to x_min so split textures don't
* overflow the 8-bit gap field. The shader adds x_min to
* its sx accumulator to recover absolute coordinates. */
- int ref = tex->last_x_end[y] > tex->x_min
+ int ref = (tex->last_x_end[y] > tex->x_min)
? tex->last_x_end[y] : tex->x_min;
int gap = sx - ref;
int remaining = spans->len;
@@ -793,19 +793,19 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
* accumulator by 256 per entry without drawing anything.
* This preserves absolute x positioning for wide VG objects
* where spans can be hundreds of pixels apart. */
- while (gap > 255 && idx < sc->max_spans)
+ while ((gap > 255) && (idx < sc->max_spans))
{
entry = tex->buffer + ((size_t)y * sc->stride) + ((size_t)idx * 4);
entry[0] = 0; /* cov = 0 → invisible */
entry[1] = 1; /* len = 1 → advances x by 1 */
entry[2] = 255; /* gap = 255 → advances x by 255 */
entry[3] = 0;
- tex->rolling_hash = tex->rolling_hash * 31 + *((const uint32_t *)entry);
+ tex->rolling_hash = (tex->rolling_hash * 31) + *((const uint32_t *)entry);
gap -= 256; /* 255 gap + 1 len = 256 pixels */
idx++;
}
- while (remaining > 0 && idx < sc->max_spans)
+ while ((remaining > 0) && (idx < sc->max_spans))
{
int chunk = (remaining > 255) ? 255 : remaining;
int g = (cur_x == sx) ? gap : 0;
@@ -824,7 +824,7 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
entry[1] = (uint8_t)chunk; /* byte1 → G in BGRA */
entry[2] = (uint8_t)g; /* byte2 → R in BGRA */
entry[3] = 0; /* byte3 → A in BGRA */
- tex->rolling_hash = tex->rolling_hash * 31 + v;
+ tex->rolling_hash = (tex->rolling_hash * 31) + v;
}
cur_x += chunk;
@@ -850,7 +850,7 @@ _collect_spans_solid(int count, const SW_FT_Span *spans, void *user_data)
* The row-change path above fires only when y changes, so the final
* row (or the only row when the shape spans a single scanline) is
* handled here. */
- if (sc->flush_prev_y >= 0 && sc->flush_prev_ti >= 0)
+ if ((sc->flush_prev_y >= 0) && (sc->flush_prev_ti >= 0))
_flush_row_tail(sc, sc->flush_prev_ti, sc->flush_prev_y);
}
@@ -979,7 +979,7 @@ _collect_spans_composite(int count, const SW_FT_Span *spans, void *user_data)
* does not, so we must set it here unconditionally. */
sc->inv = sd->inv;
- if (sc->type == LinearGradient || sc->type == RadialGradient)
+ if ((sc->type == LinearGradient) || (sc->type == RadialGradient))
_collect_spans_gradient(count, spans, user_data);
else
_collect_spans_solid(count, spans, user_data);
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
index 9154df7768..0890e93dcc 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
@@ -291,7 +291,7 @@ _span_fragment_highp_supported(void)
glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT,
range, &precision);
- _span_fs_highp = (range[0] != 0 || range[1] != 0 || precision != 0) ? 1 : 0;
+ _span_fs_highp = ((range[0] != 0) || (range[1] != 0) || (precision != 0)) ? 1 : 0;
if (!_span_fs_highp)
INF("span shader: fragment highp unsupported, falling back to mediump");
return _span_fs_highp;
@@ -346,7 +346,7 @@ _span_tier_get(void)
varyings /= 4;
#endif
- if (attribs == 0 && varyings == 0)
+ if ((attribs == 0) && (varyings == 0))
{
/* Both queries came back 0: this means glGetIntegerv failed (e.g. no
* current GL context yet), not that the device genuinely reports 0
@@ -357,8 +357,8 @@ _span_tier_get(void)
return SPAN_TIER_OFF;
}
- if (attribs < SPAN_WIDE_MAX_ATTRIBS ||
- varyings < SPAN_WIDE_MAX_VARYINGS)
+ if ((attribs < SPAN_WIDE_MAX_ATTRIBS) ||
+ (varyings < SPAN_WIDE_MAX_VARYINGS))
{
INF("span path disabled: device reports %d vertex attributes and %d "
"varying vectors, the span shaders need %d and %d",
@@ -1350,7 +1350,7 @@ _span_page_ensure(Span_Page *page, Evas_Engine_GL_Context *gc, int w, int h)
/* A texture from a previous context is not ours to free - that context's
* pool already did - but it must not be used either. */
- if (t && page->gc != gc)
+ if (t && (page->gc != gc))
{
t = NULL;
page->evas_tex = NULL;
@@ -1359,7 +1359,7 @@ _span_page_ensure(Span_Page *page, Evas_Engine_GL_Context *gc, int w, int h)
page->prev_hash = 0;
}
- if (t && page->w >= w && page->h >= h) return EINA_TRUE;
+ if (t && (page->w >= w) && (page->h >= h)) return EINA_TRUE;
/* Grow to at least what is asked, never shrink. */
if (w < page->w) w = page->w;
@@ -1457,7 +1457,7 @@ span_page_upload(void *gc_ptr, Span_Page *page,
if (w > page_w) page_w = w;
});
- if (!n || total_h <= 0) goto done;
+ if (!n || (total_h <= 0)) goto done;
/* Widest first. One glTexSubImage2D covers a rectangle, so collectors
* sharing an upload also share its width - putting a 3-column shape in
@@ -1467,9 +1467,9 @@ span_page_upload(void *gc_ptr, Span_Page *page,
for (i = 0; i < n; i++)
{
- hash = hash * 31 + ent[i].tex->rolling_hash;
- hash = hash * 31 + (uint32_t)ent[i].rows;
- hash = hash * 31 + (uint32_t)ent[i].w;
+ hash = (hash * 31) + ent[i].tex->rolling_hash;
+ hash = (hash * 31) + (uint32_t)ent[i].rows;
+ hash = (hash * 31) + (uint32_t)ent[i].w;
}
if (!_span_page_ensure(page, gc, page_w, total_h)) goto done;
@@ -1515,7 +1515,7 @@ span_page_upload(void *gc_ptr, Span_Page *page,
uint8_t *packed;
int j, at;
- while (i < n && ent[i].w * 2 >= g_w)
+ while ((i < n) && ((ent[i].w * 2) >= g_w))
{
g_rows += ent[i].rows;
i++;
@@ -1540,14 +1540,14 @@ span_page_upload(void *gc_ptr, Span_Page *page,
for (y = 0; y < ent[j].rows; y++)
{
int idx = ent[j].counts[y];
- if (idx > 0 && idx < ent[j].max_spans)
+ if ((idx > 0) && (idx < ent[j].max_spans))
tex->buffer[((size_t)y * ent[j].stride) +
((size_t)idx * 4) + 1] = 0;
}
for (y = 0; y < ent[j].rows; y++)
- memcpy(packed + (size_t)(at + y) * row_bytes,
- tex->buffer + (size_t)y * ent[j].stride,
+ memcpy(packed + ((size_t)(at + y) * row_bytes),
+ tex->buffer + ((size_t)y * ent[j].stride),
row_bytes);
at += ent[j].rows;
}
@@ -1588,8 +1588,8 @@ done:
static Span_Variant
_span_variant_of(const Span_Pipe_Params *p)
{
- int grad = ((p->fill.tex && p->fill.type >= SPAN_FILL_TYPE_GRADIENT_MIN) ||
- (p->stroke.tex && p->stroke.type >= SPAN_FILL_TYPE_GRADIENT_MIN));
+ int grad = ((p->fill.tex && (p->fill.type >= SPAN_FILL_TYPE_GRADIENT_MIN)) ||
+ (p->stroke.tex && (p->stroke.type >= SPAN_FILL_TYPE_GRADIENT_MIN)));
if (grad) return (p->mask_tex != 0) ? SPAN_VARIANT_GRADIENT_MASK
: SPAN_VARIANT_GRADIENT;
@@ -1609,10 +1609,10 @@ _span_draw_batch(Evas_Engine_GL_Context *gc, Span_Variant variant,
GLuint vao;
/* Determine kind (0=solid, 1=gradient) and bind set from variant + textures. */
- int kind = (variant == SPAN_VARIANT_GRADIENT ||
- variant == SPAN_VARIANT_GRADIENT_MASK) ? 1 : 0;
- int has_mask = (variant == SPAN_VARIANT_SOLID_MASK ||
- variant == SPAN_VARIANT_GRADIENT_MASK) ? 1 : 0;
+ int kind = ((variant == SPAN_VARIANT_GRADIENT) ||
+ (variant == SPAN_VARIANT_GRADIENT_MASK)) ? 1 : 0;
+ int has_mask = ((variant == SPAN_VARIANT_SOLID_MASK) ||
+ (variant == SPAN_VARIANT_GRADIENT_MASK)) ? 1 : 0;
Span_Bind_Set bind;
if (fill_tex && stroke_tex) bind = SPAN_BIND_FILL_AND_STROKE;
else if (fill_tex) bind = SPAN_BIND_FILL_ONLY;
@@ -1620,7 +1620,7 @@ _span_draw_batch(Evas_Engine_GL_Context *gc, Span_Variant variant,
Span_Shader *ss = _span_shader_pick(kind, bind, has_mask);
- if (!vdata || nverts == 0) return;
+ if (!vdata || (nverts == 0)) return;
/* Ensure all 12 shader programs are compiled. Checking the specific
* variant matters: span_shader_init() aborts at the first failing
@@ -1648,12 +1648,12 @@ _span_draw_batch(Evas_Engine_GL_Context *gc, Span_Variant variant,
glBindTexture(GL_TEXTURE_2D, fill_tex ? fill_tex : stroke_tex);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, stroke_tex ? stroke_tex : fill_tex);
- if (ss->loc_grad_ramp_atlas >= 0 && atlas_tex)
+ if ((ss->loc_grad_ramp_atlas >= 0) && atlas_tex)
{
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, atlas_tex);
}
- if (ss->loc_mask_tex >= 0 && mask_tex)
+ if ((ss->loc_mask_tex >= 0) && mask_tex)
{
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, mask_tex);
@@ -1737,7 +1737,7 @@ _span_pass_restore(Evas_Engine_GL_Context *gc)
{
Evas_GL_Image *s = gc->pipe[0].shader.surface;
- if (!s || s == gc->def_surface)
+ if (!s || (s == gc->def_surface))
{
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
if ((gc->rot == 0) || (gc->rot == 180))
@@ -1759,7 +1759,7 @@ span_pass_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *target,
{
int i, run_start;
- if (!gc || !target || !target->tex || !target->tex->pt || n <= 0) return;
+ if (!gc || !target || !target->tex || !target->tex->pt || (n <= 0)) return;
if (!span_shader_init()) return;
/* Bind directly rather than through evas_gl_common_context_target_surface_set:
@@ -1786,12 +1786,12 @@ span_pass_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *target,
void *buf;
int end = run_start + 1, k;
- while (end < n &&
- _span_variant_of(&quads[end]) == variant &&
- quads[end].fill.tex == quads[run_start].fill.tex &&
- quads[end].stroke.tex == quads[run_start].stroke.tex &&
- quads[end].grad_atlas_tex == quads[run_start].grad_atlas_tex &&
- quads[end].mask_tex == quads[run_start].mask_tex)
+ while ((end < n) &&
+ (_span_variant_of(&quads[end]) == variant) &&
+ (quads[end].fill.tex == quads[run_start].fill.tex) &&
+ (quads[end].stroke.tex == quads[run_start].stroke.tex) &&
+ (quads[end].grad_atlas_tex == quads[run_start].grad_atlas_tex) &&
+ (quads[end].mask_tex == quads[run_start].mask_tex))
end++;
vsize = span_vertex_size(variant);
@@ -1800,8 +1800,8 @@ span_pass_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *target,
if (!buf) break;
for (k = run_start; k < end; k++)
- evas_gl_common_span_fill_vertices((char *)buf + vsize * 6 * (size_t)(k - run_start),
- variant, &quads[k], ndc + k * 8);
+ evas_gl_common_span_fill_vertices((char *)buf + (vsize * 6 * (size_t)(k - run_start)),
+ variant, &quads[k], ndc + (k * 8));
_span_draw_batch(gc, variant, buf, need, 6 * (end - run_start),
quads[run_start].fill.tex, quads[run_start].stroke.tex,
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 7aa655254d..519d6ac0a5 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -166,7 +166,7 @@ _ector_surface_cache_size(void *engine EINA_UNUSED, void *surface)
{
Evas_GL_Image *im = surface;
- if (!im || im->w <= 0 || im->h <= 0) return 0;
+ if (!im || (im->w <= 0) || (im->h <= 0)) return 0;
return (size_t)im->w * (size_t)im->h * 4;
}
@@ -2775,7 +2775,7 @@ _span_collector_alloc(void *data, int h,
/* Grow the pointer array if needed (high-water mark doubling). */
if (idx >= *alloc_ptr)
{
- int new_alloc = *alloc_ptr ? *alloc_ptr * 2 : 4;
+ int new_alloc = *alloc_ptr ? (*alloc_ptr * 2) : 4;
void **new_arr = realloc(*arr_ptr, (size_t)new_alloc * sizeof(void *));
if (!new_arr) return NULL;
memset(new_arr + *alloc_ptr, 0,
@@ -2837,7 +2837,7 @@ eng_ector_begin(void *engine, void *surface,
int w, h;
eng_image_size_get(engine, glim, &w, &h);
- if (w <= 0 || h <= 0) return EINA_FALSE;
+ if ((w <= 0) || (h <= 0)) return EINA_FALSE;
/* Point the ector surface at a scratch buffer big enough for this
* object, for the rasterizer's clipping bounds. */
@@ -2869,9 +2869,9 @@ eng_ector_begin(void *engine, void *surface,
}
/* Hand the buffer in as a pointer so the surface never owns it. */
- if (!bbd || bbd->pixels.u8 != spd->span_pixels ||
+ if (!bbd || (bbd->pixels.u8 != spd->span_pixels) ||
!bbd->generic ||
- bbd->generic->w != (unsigned)w || bbd->generic->h != (unsigned)h)
+ (bbd->generic->w != (unsigned)w) || (bbd->generic->h != (unsigned)h))
ector_buffer_pixels_set(ector, spd->span_pixels, w, h, (int)row,
EFL_GFX_COLORSPACE_ARGB8888, EINA_TRUE);
}
@@ -2902,8 +2902,8 @@ eng_ector_begin(void *engine, void *surface,
* target_surface_set has already flushed, so this is a cheap
* no-op: evas_gl_common_context_flush stops at the first empty
* pipe. */
- if (pd->span_collectors_fill_count > 0 ||
- pd->span_collectors_stroke_count > 0)
+ if ((pd->span_collectors_fill_count > 0) ||
+ (pd->span_collectors_stroke_count > 0))
{
Evas_Engine_GL_Context *fgc =
gl_generic_context_find(engine, EINA_FALSE);
@@ -2990,13 +2990,13 @@ _span_gradient_linear_coeffs(Ector_Renderer_Software_Gradient_Data *gd,
* b = dx*inv.xy + dy*inv.yy
* c = dx*inv.xz + dy*inv.yz + off - a*offx - b*offy
*/
- a = dx * inv->xx + dy * inv->yx;
- b = dx * inv->xy + dy * inv->yy;
+ a = (dx * inv->xx) + (dy * inv->yx);
+ b = (dx * inv->xy) + (dy * inv->yy);
*out_a = (float)a;
*out_b = (float)b;
- *out_c = (float)(dx * inv->xz + dy * inv->yz + off
- - a * (double)offx - b * (double)offy);
+ *out_c = (float)((dx * inv->xz) + (dy * inv->yz) + off
+ - (a * (double)offx) - (b * (double)offy));
}
/**
@@ -3037,12 +3037,12 @@ _span_gradient_radial_coeffs(Ector_Renderer_Software_Gradient_Data *gd,
*out_a = (float)inv->xx;
*out_b = (float)inv->xy;
*out_c = (float)(inv->xz - gd->radial.fx
- - inv->xx * (double)offx - inv->xy * (double)offy);
+ - (inv->xx * (double)offx) - (inv->xy * (double)offy));
*out_d = (float)inv->yx;
*out_e = (float)inv->yy;
*out_f = (float)(inv->yz - gd->radial.fy
- - inv->yx * (double)offx - inv->yy * (double)offy);
+ - (inv->yx * (double)offx) - (inv->yy * (double)offy));
/* Quadratic parameters — pass inv2a instead of a to avoid
* per-fragment division in the shader. */
@@ -3085,7 +3085,7 @@ _compute_gradient_coeffs(Span_Collector *sc,
int shader_type = *inout_shader_type;
if (!sc || !sc->gradient_data) return;
- if (shader_type != (int)LinearGradient && shader_type != (int)RadialGradient) return;
+ if ((shader_type != (int)LinearGradient) && (shader_type != (int)RadialGradient)) return;
gd = (Ector_Renderer_Software_Gradient_Data *)sc->gradient_data;
@@ -3099,7 +3099,7 @@ _compute_gradient_coeffs(Span_Collector *sc,
* color_table pointer and ctable_status are unchanged from the last
* observed READY state. Invalidated if either differs (stop change,
* regen in flight, or pointer realloc). */
- if (!(atlas && gd->color_table && gd->ctable_status == CTABLE_READY_DONE))
+ if (!(atlas && gd->color_table && (gd->ctable_status == CTABLE_READY_DONE)))
{
/* Ramp not ready or atlas unavailable — invalidate gd-side cache so
* that when status returns to READY we recompute the CRC against
@@ -3121,7 +3121,7 @@ _compute_gradient_coeffs(Span_Collector *sc,
const uint8_t *ramp_bytes = (const uint8_t *)gd->color_table;
uint32_t version;
if (gd->cached_ctable_crc_valid &&
- gd->cached_ctable_status == CTABLE_READY_DONE)
+ (gd->cached_ctable_status == CTABLE_READY_DONE))
{
version = gd->cached_ctable_crc;
}
@@ -3153,7 +3153,7 @@ _compute_gradient_coeffs(Span_Collector *sc,
}
else /* RadialGradient */
{
- if (gd->radial.fradius >= 0.00001f || fabsf(gd->radial.a) <= 0.00001f)
+ if ((gd->radial.fradius >= 0.00001f) || (fabsf(gd->radial.a) <= 0.00001f))
{
/* Degenerate radial — fall back to solid using first stop color. */
*inout_shader_type = (int)Solid;
@@ -3215,7 +3215,7 @@ eng_ector_end(void *engine,
void **fill_arr = (espd && fill_count) ? espd->span_collectors_fill : NULL;
void **stroke_arr = (espd && stroke_count) ? espd->span_collectors_stroke : NULL;
- if (glim && (fill_count > 0 || stroke_count > 0))
+ if (glim && ((fill_count > 0) || (stroke_count > 0)))
{
int w, h;
Evas_Engine_GL_Context *gc;
@@ -3229,10 +3229,10 @@ eng_ector_end(void *engine,
/* Check that at least one collector has span data. */
{
int has_data = 0;
- for (ci = 0; !has_data && ci < fill_count; ci++)
- has_data |= ((Span_Collector *)fill_arr[ci])->actual_max_spans > 0;
- for (ci = 0; !has_data && ci < stroke_count; ci++)
- has_data |= ((Span_Collector *)stroke_arr[ci])->actual_max_spans > 0;
+ for (ci = 0; !has_data && (ci < fill_count); ci++)
+ has_data |= (((Span_Collector *)fill_arr[ci])->actual_max_spans > 0);
+ for (ci = 0; !has_data && (ci < stroke_count); ci++)
+ has_data |= (((Span_Collector *)stroke_arr[ci])->actual_max_spans > 0);
if (!has_data) goto span_done;
}
@@ -3298,7 +3298,7 @@ eng_ector_end(void *engine,
*/
Span_Data *_rsd = (espd && espd->rasterizer)
? &espd->rasterizer->fill_data : NULL;
- int max_shapes = fill_count > stroke_count
+ int max_shapes = (fill_count > stroke_count)
? fill_count : stroke_count;
int si;
for (si = 0; si < max_shapes; si++)
@@ -3312,14 +3312,14 @@ eng_ector_end(void *engine,
int fill_tc = sc_fill ? sc_fill->texture_count : 0;
int stroke_tc = sc_stroke ? sc_stroke->texture_count : 0;
- int max_tc = fill_tc > stroke_tc ? fill_tc : stroke_tc;
+ int max_tc = (fill_tc > stroke_tc) ? fill_tc : stroke_tc;
if (max_tc == 0) continue;
/* Per-shape actual_max_spans (used to cap the shader loop). */
int actual_max = 1;
- if (sc_fill && sc_fill->actual_max_spans > actual_max)
+ if (sc_fill && (sc_fill->actual_max_spans > actual_max))
actual_max = sc_fill->actual_max_spans;
- if (sc_stroke && sc_stroke->actual_max_spans > actual_max)
+ if (sc_stroke && (sc_stroke->actual_max_spans > actual_max))
actual_max = sc_stroke->actual_max_spans;
uint32_t fill_col = sc_fill ? sc_fill->color : 0;
@@ -3513,13 +3513,13 @@ eng_ector_end(void *engine,
float _y0 = (float)_spp.y;
float _x1 = _x0 + (float)_spp.w;
float _y1 = _y0 + (float)_spp.h;
- _ndc[0] = _x0 / _gw * 2.0f - 1.0f; _ndc[1] = _y0 / _gh * 2.0f - 1.0f; /* TL */
- _ndc[2] = _x1 / _gw * 2.0f - 1.0f; _ndc[3] = _y0 / _gh * 2.0f - 1.0f; /* TR */
- _ndc[4] = _x1 / _gw * 2.0f - 1.0f; _ndc[5] = _y1 / _gh * 2.0f - 1.0f; /* BR */
- _ndc[6] = _x0 / _gw * 2.0f - 1.0f; _ndc[7] = _y1 / _gh * 2.0f - 1.0f; /* BL */
+ _ndc[0] = (_x0 / _gw * 2.0f) - 1.0f; _ndc[1] = (_y0 / _gh * 2.0f) - 1.0f; /* TL */
+ _ndc[2] = (_x1 / _gw * 2.0f) - 1.0f; _ndc[3] = (_y0 / _gh * 2.0f) - 1.0f; /* TR */
+ _ndc[4] = (_x1 / _gw * 2.0f) - 1.0f; _ndc[5] = (_y1 / _gh * 2.0f) - 1.0f; /* BR */
+ _ndc[6] = (_x0 / _gw * 2.0f) - 1.0f; _ndc[7] = (_y1 / _gh * 2.0f) - 1.0f; /* BL */
if (_pass_n == _pass_alloc)
{
- int na = _pass_alloc ? _pass_alloc * 2 : 8;
+ int na = _pass_alloc ? (_pass_alloc * 2) : 8;
Span_Pipe_Params *nq =
realloc(_pass_q, (size_t)na * sizeof(*nq));
GLfloat *nn =
@@ -3530,7 +3530,7 @@ eng_ector_end(void *engine,
_pass_alloc = na;
}
_pass_q[_pass_n] = _spp;
- memcpy(_pass_ndc + _pass_n * 8, _ndc, sizeof(_ndc));
+ memcpy(_pass_ndc + (_pass_n * 8), _ndc, sizeof(_ndc));
_pass_n++;
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.