A small speedup

This commit is contained in:
Kovid Goyal 2016-05-09 17:47:41 +05:30
parent 73a872b237
commit 2a67a0698b

View File

@ -7,7 +7,6 @@
#include <stdexcept> #include <stdexcept>
#include "imageops.h" #include "imageops.h"
#include <QColor>
#include <QVector> #include <QVector>
#include <cmath> #include <cmath>
@ -140,7 +139,7 @@ QImage grayscale(const QImage &image) { // {{{
row = reinterpret_cast<QRgb*>(img.scanLine(r)); row = reinterpret_cast<QRgb*>(img.scanLine(r));
for (pixel = row; pixel < row + width; pixel++) { for (pixel = row; pixel < row + width; pixel++) {
gray = qGray(*pixel); gray = qGray(*pixel);
*pixel = QColor(gray, gray, gray).rgba(); *pixel = qRgb(gray, gray, gray);
} }
} }
return img; return img;