@@ -172,21 +172,16 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
172172 // / GET DOMINANT COLOR
173173 // //////////////////////////////////////////////////////////////////
174174 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);
181176
182177 // 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 ));
185180 }
186181
187182 // 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" );
190185 }
191186
192187 // //////////////////////////////////////////////////////////////////
@@ -208,7 +203,7 @@ void MediaPlayerUtilsWorker::generateImagesReply() {
208203
209204 qCDebug (CLASS_LC ()) << this << " Creating image DONE" ;
210205
211- emit processingDone (m_pixelColor , image);
206+ emit processingDone (pixelColor , image);
212207 }
213208 } else {
214209 qCWarning (CLASS_LC) << this << " NETWORK REPLY ERROR" << m_reply->errorString ();
0 commit comments