{
float ratio, alpha_ratio, combine_ratio1, combine_ratio2;
segment_size.x = min(size.x - i, 1); // each gradient segment is 1 unit wide except if there is less than 1 unit of gradient remaining
- ratio = (i + gradientOffset) / original_width * (gradientType == STRAFEHUD_GRADIENT_BOTH ? 2 : 1);
+ ratio = (i + segment_size.x/2 + gradientOffset) / original_width * (gradientType == STRAFEHUD_GRADIENT_BOTH ? 2 : 1);
if(ratio > 1) ratio = 2 - ratio;
if(gradientType != STRAFEHUD_GRADIENT_RIGHT) ratio = 1 - ratio;
alpha_ratio = alpha1 - (alpha1 - alpha2) * ratio;