- float offset, total_weight;
- if (w1 + w2 < 1e-6) {
- offset = 0.5f;
- total_weight = 0.0f;
- } else {
- offset = w2 / (w1 + w2);
- total_weight = w1 + w2;
- }
- float x = 0.0f, y = 0.0f;
-
- if (direction == HORIZONTAL) {
- x = (base_pos + offset) / (float)width;
- } else if (direction == VERTICAL) {
- y = (base_pos + offset) / (float)height;
- } else {
- assert(false);
- }
+ float pos1 = base_pos / (float)size;
+ float pos, total_weight;
+ combine_two_samples(w1, w2, pos1, 1.0 / (float)size, size, num_subtexels, inv_num_subtexels, &pos, &total_weight, nullptr);