@@ -172,21 +172,16 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
172
172
// / GET DOMINANT COLOR
173
173
// //////////////////////////////////////////////////////////////////
174
174
qCDebug (CLASS_LC ()) << this << " Getting dominant color" ;
175
- // QColor m_pixelColor = dominantColor(image);
176
-
177
- // shrink down image to 1x1 pixel and measure the color
178
- QImage onePixel = image;
179
- onePixel.scaled (1 , 1 , Qt::IgnoreAspectRatio);
180
- QColor m_pixelColor = onePixel.pixel (1 , 1 );
175
+ QColor pixelColor = dominantColor (image);
181
176
182
177
// change the brightness of the color if it's too bright
183
- if (m_pixelColor .lightness () > 150 ) {
184
- m_pixelColor .setHsv (m_pixelColor .hue (), m_pixelColor .saturation (), (m_pixelColor .value () - 80 ));
178
+ if (pixelColor .lightness () > 150 ) {
179
+ pixelColor .setHsv (pixelColor .hue (), pixelColor .saturation (), (pixelColor .value () - 80 ));
185
180
}
186
181
187
182
// if the color is close to white, return black instead
188
- if (m_pixelColor .lightness () > 210 ) {
189
- m_pixelColor = QColor (" black" );
183
+ if (pixelColor .lightness () > 210 ) {
184
+ pixelColor = QColor (" black" );
190
185
}
191
186
192
187
// //////////////////////////////////////////////////////////////////
@@ -208,7 +203,7 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
208
203
209
204
qCDebug (CLASS_LC ()) << this << " Creating image DONE" ;
210
205
211
- emit processingDone (m_pixelColor , image);
206
+ emit processingDone (pixelColor , image);
212
207
}
213
208
} else {
214
209
qCWarning (CLASS_LC) << this << " NETWORK REPLY ERROR" << m_reply->errorString ();
0 commit comments