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>
This commit is contained in:
parent
15b42af111
commit
2e8bec9e4b
@ -2209,7 +2209,7 @@ int QImage::pixelIndex(int x, int y) const
|
|||||||
*/
|
*/
|
||||||
QRgb QImage::pixel(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);
|
qWarning("QImage::pixel: coordinate (%d,%d) out of range", x, y);
|
||||||
return 12345;
|
return 12345;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user