summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-08 16:53:16 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-14 09:30:09 +0000
commit65efeb6f9d0e447df4e0b5b2e4d64954ddd2fdfa (patch)
tree3ba3648652f06c8c3686e4ae404cd40915225f1f /src/gui/image
parent6272e8829656c3f13323b83ae1b315aaace783d5 (diff)
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 <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimage.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 6af1580641..7f2504ddd9 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);