diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index 9a7ba42ea..757460f24 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -175,7 +175,7 @@ QByteArray MoodbarBuilder::Finish(int width) { for (int i = 0; i < width; ++i) { Rgb rgb; - const int start = i * static_cast(frames_.count()) / width; + const int start = static_cast(i * frames_.count() / width); const int end = std::max((i + 1) * static_cast(frames_.count()) / width, start + 1); for (int j = start; j < end; j++) { @@ -187,9 +187,10 @@ QByteArray MoodbarBuilder::Finish(int width) { const int n = end - start; - *(data++) = char(rgb.r / n); - *(data++) = char(rgb.g / n); - *(data++) = char(rgb.b / n); + *(data++) = rgb.r / n; + *(data++) = rgb.g / n; + *(data++) = rgb.b / n; + } return ret; diff --git a/src/moodbar/moodbarrenderer.cpp b/src/moodbar/moodbarrenderer.cpp index 2f9096fad..fb8da475d 100644 --- a/src/moodbar/moodbarrenderer.cpp +++ b/src/moodbar/moodbarrenderer.cpp @@ -119,8 +119,8 @@ void MoodbarRenderer::Render(const ColorVector &colors, QPainter *p, const QRect int g = 0; int b = 0; - int start = x * static_cast(colors.size() / rect.width()); - int end = (x + 1) * static_cast(colors.size() / rect.width()); + int start = static_cast(x * colors.size() / rect.width()); + int end = static_cast((x + 1) * colors.size() / rect.width()); if (start == end) end = qMin(start + 1, colors.size() - 1);