From 65efeb6f9d0e447df4e0b5b2e4d64954ddd2fdfa Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 8 Sep 2015 16:53:16 +0200 Subject: [PATCH] QImage: Inline constScanLine call in pixel() Calling constScanLine() is an extra function call, just for doing "data + y * width". Also, we are checking d again, even though we already know it's there. The constScanLine() call is responsible for up to 15% of the total CPU time spent in pixel(). Change-Id: Ia7a8e0a6d62fb257d1b22d91f062b66e9cfd349a Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 6af1580641c..7f2504ddd92 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2214,7 +2214,7 @@ QRgb QImage::pixel(int x, int y) const return 12345; } - const uchar * s = constScanLine(y); + const uchar *s = d->data + y * d->bytes_per_line; switch(d->format) { case Format_Mono: return d->colortable.at((*(s + (x >> 3)) >> (~x & 7)) & 1);