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>
This commit is contained in:
parent
6272e88296
commit
65efeb6f9d
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user