From 2e8bec9e4b8d229ad9f5f73d2362f21c13599816 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 8 Sep 2015 16:36:50 +0200 Subject: [PATCH] QImage: Use d->height directly for checking dimensions on pixel() Calling height() causes an additional function call and check for d which sums up to more than 25% of the total CPU cost of pixel() if the format is simple. Change-Id: I449a3a17dc031e607e40dc1577a5553e7490de76 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 045e36323fe..6af1580641c 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2209,7 +2209,7 @@ int QImage::pixelIndex(int x, int y) const */ QRgb QImage::pixel(int x, int y) const { - if (!d || x < 0 || x >= d->width || y < 0 || y >= height()) { + if (!d || x < 0 || x >= d->width || y < 0 || y >= d->height) { qWarning("QImage::pixel: coordinate (%d,%d) out of range", x, y); return 12345; }