diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-08 16:36:50 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-09-11 09:12:47 +0000 |
commit | 2e8bec9e4b8d229ad9f5f73d2362f21c13599816 (patch) | |
tree | d4cc9135f017e78d0c5a34700ccff4147f009b93 /src/gui/image | |
parent | 15b42af11123f9d1eb4bbd79870185585103ea8d (diff) |
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 <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 045e36323f..6af1580641 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; } |