Remove duplicated code

This commit is contained in:
Kovid Goyal 2016-05-09 11:22:21 +05:30
parent b6f3368f03
commit e5c47ffb79

View File

@ -203,8 +203,6 @@ public:
int i; int i;
Node *child; Node *child;
if (this->is_leaf) { if (this->is_leaf) {
#define AVG_COLOR(x) ((unsigned char) ((double)this->sum.x / (double)this->pixel_count))
this->avg.red = AVG_COLOR(red); this->avg.green = AVG_COLOR(green); this->avg.blue = AVG_COLOR(blue);
color_table[*index] = qRgb(this->avg.red, this->avg.green, this->avg.blue); color_table[*index] = qRgb(this->avg.red, this->avg.green, this->avg.blue);
this->index = (*index)++; this->index = (*index)++;
} else { } else {
@ -220,9 +218,7 @@ public:
} }
} }
} }
if (compute_parent_averages) { if (compute_parent_averages) this->update_average();
this->avg.red = AVG_COLOR(red); this->avg.green = AVG_COLOR(green); this->avg.blue = AVG_COLOR(blue);
}
} }
} }