mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
Merge pull request #3317 from AndrewMeadows/inertia
fix for crash when computing average image color
This commit is contained in:
commit
12d641ddba
1 changed files with 5 additions and 1 deletions
|
@ -416,8 +416,12 @@ void ImageReader::run() {
|
|||
blueTotal += qBlue(rgb);
|
||||
}
|
||||
}
|
||||
QColor averageColor(EIGHT_BIT_MAXIMUM, EIGHT_BIT_MAXIMUM, EIGHT_BIT_MAXIMUM);
|
||||
if (imageArea > 0) {
|
||||
averageColor.setRgb(redTotal / imageArea, greenTotal / imageArea, blueTotal / imageArea);
|
||||
}
|
||||
QMetaObject::invokeMethod(texture.data(), "setImage", Q_ARG(const QImage&, image), Q_ARG(bool, false),
|
||||
Q_ARG(const QColor&, QColor(redTotal / imageArea, greenTotal / imageArea, blueTotal / imageArea)));
|
||||
Q_ARG(const QColor&, averageColor));
|
||||
return;
|
||||
}
|
||||
if (image.format() != QImage::Format_ARGB32) {
|
||||
|
|
Loading…
Reference in a new issue