From e5c47ffb79f8398a467111a9e01b7a7d29c8f02b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 9 May 2016 11:22:21 +0530 Subject: [PATCH] Remove duplicated code --- src/calibre/utils/imageops/quantize.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/calibre/utils/imageops/quantize.cpp b/src/calibre/utils/imageops/quantize.cpp index b722b481e6..8f041f5010 100644 --- a/src/calibre/utils/imageops/quantize.cpp +++ b/src/calibre/utils/imageops/quantize.cpp @@ -203,8 +203,6 @@ public: int i; Node *child; 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); this->index = (*index)++; } else { @@ -220,9 +218,7 @@ public: } } } - if (compute_parent_averages) { - this->avg.red = AVG_COLOR(red); this->avg.green = AVG_COLOR(green); this->avg.blue = AVG_COLOR(blue); - } + if (compute_parent_averages) this->update_average(); } }