From 15ecd0337e4e4d9d33449bdff014a634e368c7d6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 23 Dec 2009 14:43:53 -0800 Subject: st/vega: Move declaration outside for loop. --- src/gallium/state_trackers/vega/arc.c | 6 ++++-- src/gallium/state_trackers/vega/bezier.c | 7 +++++-- src/gallium/state_trackers/vega/vg_context.c | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c index e74c7f0334..36cde7ab03 100644 --- a/src/gallium/state_trackers/vega/arc.c +++ b/src/gallium/state_trackers/vega/arc.c @@ -537,8 +537,9 @@ static INLINE int num_beziers_needed(struct arc *arc) double d_eta = (max_eta - min_eta) / n; if (d_eta <= 0.5 * M_PI) { double eta_b = min_eta; + int i; found = VG_TRUE; - for (int i = 0; found && (i < n); ++i) { + for (i = 0; found && (i < n); ++i) { double etaA = eta_b; eta_b += d_eta; found = (estimate_error(arc, etaA, eta_b) <= threshold); @@ -559,6 +560,7 @@ static void arc_to_beziers(struct arc *arc, sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b, b_cos_eta_b, x_b, y_b, x_b_dot, y_b_dot, lx, ly; double t, alpha; + int i; { /* always move to the start of the arc */ VGfloat x = arc->x1; @@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc, t = tan(0.5 * d_eta); alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3; - for (int i = 0; i < n; ++i) { + for (i = 0; i < n; ++i) { struct bezier bezier; double xA = x_b; double yA = y_b; diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c index 39a7ade016..d1ee41ac33 100644 --- a/src/gallium/state_trackers/vega/bezier.c +++ b/src/gallium/state_trackers/vega/bezier.c @@ -255,7 +255,8 @@ static enum shift_result good_offset(const struct bezier *b1, const float max_dist_line = threshold*offset*offset; const float max_dist_normal = threshold*offset; const float spacing = 0.25; - for (float i = spacing; i < 0.99; i += spacing) { + float i; + for (i = spacing; i < 0.99; i += spacing) { float p1[2],p2[2], d, l; float normal[2]; bezier_point_at(b1, i, p1); @@ -341,6 +342,8 @@ static enum shift_result shift(const struct bezier *orig, float points_shifted[4][2]; float prev_normal[2]; + int i; + points[np][0] = orig->x1; points[np][1] = orig->y1; map[0] = 0; @@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig, points_shifted[0][0] = points[0][0] + offset * prev_normal[0]; points_shifted[0][1] = points[0][1] + offset * prev_normal[1]; - for (int i = 1; i < np - 1; ++i) { + for (i = 1; i < np - 1; ++i) { float normal_sum[2], r; float next_normal[2]; compute_pt_normal(points[i], points[i + 1], next_normal); diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index e0ff02f3a9..1572c9f379 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -231,6 +231,7 @@ static void update_clip_state(struct vg_context *ctx) if (state->scissoring) { struct pipe_blend_state *blend = &ctx->state.g3d.blend; struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + int i; dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/ dsa->depth.func = PIPE_FUNC_ALWAYS; dsa->depth.enabled = 1; @@ -254,7 +255,7 @@ static void update_clip_state(struct vg_context *ctx) cso_set_blend(ctx->cso_context, blend); /* enable scissoring */ - for (int i = 0; i < state->scissor_rects_num; ++i) { + for (i = 0; i < state->scissor_rects_num; ++i) { const float x = state->scissor_rects[i * 4 + 0].f; const float y = state->scissor_rects[i * 4 + 1].f; const float width = state->scissor_rects[i * 4 + 2].f; -- cgit v1.2.3