X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=blur_effect.cpp;h=6e5e843d5ce21b2608b4232716021472e1c65574;hp=027d25b1113ef83e37f472e5dc561b95251a5484;hb=42f0fd5ccbb3560a76d55f3e725416a5e0f93523;hpb=3789397e29df3bade367c8963b050d8add510c0f diff --git a/blur_effect.cpp b/blur_effect.cpp index 027d25b..6e5e843 100644 --- a/blur_effect.cpp +++ b/blur_effect.cpp @@ -187,18 +187,21 @@ void SingleBlurPassEffect::set_gl_state(GLuint glsl_program_num, const string &p unsigned base_pos = i * 2 - 1; float w1 = weight[base_pos]; float w2 = weight[base_pos + 1]; - - float offset, total_weight; - combine_two_samples(w1, w2, &offset, &total_weight, NULL); - + int size; if (direction == HORIZONTAL) { - samples[2 * i + 0] = (base_pos + offset) / (float)width; + size = width; } else if (direction == VERTICAL) { - samples[2 * i + 0] = (base_pos + offset) / (float)height; + size = height; } else { assert(false); } + float pos1 = base_pos / (float)size; + float pos2 = (base_pos + 1) / (float)size; + float pos, total_weight; + combine_two_samples(w1, w2, pos1, pos2, size, COMBINE_DO_NOT_ROUND, &pos, &total_weight, NULL); + + samples[2 * i + 0] = pos; samples[2 * i + 1] = total_weight; }