Use static_cast
This commit is contained in:
@@ -175,7 +175,7 @@ QByteArray MoodbarBuilder::Finish(int width) {
|
||||
|
||||
for (int i = 0; i < width; ++i) {
|
||||
Rgb rgb;
|
||||
const int start = i * frames_.count() / width;
|
||||
const int start = i * static_cast<int>(frames_.count()) / width;
|
||||
const int end = std::max((i + 1) * static_cast<int>(frames_.count()) / width, start + 1);
|
||||
|
||||
for (int j = start; j < end; j++) {
|
||||
@@ -187,9 +187,9 @@ QByteArray MoodbarBuilder::Finish(int width) {
|
||||
|
||||
const int n = end - start;
|
||||
|
||||
*(data++) = rgb.r / n;
|
||||
*(data++) = rgb.g / n;
|
||||
*(data++) = rgb.b / n;
|
||||
*(data++) = char(rgb.r / n);
|
||||
*(data++) = char(rgb.g / n);
|
||||
*(data++) = char(rgb.b / n);
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ const int MoodbarRenderer::kNumHues = 12;
|
||||
|
||||
ColorVector MoodbarRenderer::Colors(const QByteArray &data, const MoodbarStyle style, const QPalette &palette) {
|
||||
|
||||
const int samples = data.size() / 3;
|
||||
const int samples = static_cast<int>(data.size() / 3);
|
||||
|
||||
// Set some parameters based on the moodbar style
|
||||
StyleProperties properties;
|
||||
@@ -119,8 +119,8 @@ void MoodbarRenderer::Render(const ColorVector &colors, QPainter *p, const QRect
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
|
||||
int start = x * colors.size() / rect.width();
|
||||
int end = (x + 1) * colors.size() / rect.width();
|
||||
int start = x * static_cast<int>(colors.size() / rect.width());
|
||||
int end = (x + 1) * static_cast<int>(colors.size() / rect.width());
|
||||
|
||||
if (start == end) end = qMin(start + 1, colors.size() - 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user