Mesa (master): mesa: small optimization of _mesa_expand_bitmap()
Brian Paul
brianp at kemper.freedesktop.org
Fri Feb 19 15:53:49 UTC 2016
Module: Mesa
Branch: master
Commit: 0eb7b5c2a3f17d64e85247c1f4907ce20bc57a73
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eb7b5c2a3f17d64e85247c1f4907ce20bc57a73
Author: Brian Paul <brianp at vmware.com>
Date: Fri Feb 19 08:51:51 2016 -0700
mesa: small optimization of _mesa_expand_bitmap()
Avoid a per-pixel multiply.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/main/image.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 99f253c..4d6ab6f 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -408,9 +408,7 @@ _mesa_expand_bitmap(GLsizei width, GLsizei height,
const GLint srcStride = _mesa_image_row_stride(unpack, width,
GL_COLOR_INDEX, GL_BITMAP);
GLint row, col;
-
-#define SET_PIXEL(COL, ROW) \
- destBuffer[(ROW) * destStride + (COL)] = onValue;
+ GLubyte *dstRow = destBuffer;
for (row = 0; row < height; row++) {
const GLubyte *src = srcRow;
@@ -421,7 +419,7 @@ _mesa_expand_bitmap(GLsizei width, GLsizei height,
for (col = 0; col < width; col++) {
if (*src & mask) {
- SET_PIXEL(col, row);
+ dstRow[col] = onValue;
}
if (mask == 128U) {
@@ -443,7 +441,7 @@ _mesa_expand_bitmap(GLsizei width, GLsizei height,
for (col = 0; col < width; col++) {
if (*src & mask) {
- SET_PIXEL(col, row);
+ dstRow[col] = onValue;
}
if (mask == 1U) {
@@ -461,9 +459,8 @@ _mesa_expand_bitmap(GLsizei width, GLsizei height,
}
srcRow += srcStride;
+ dstRow += destStride;
} /* row */
-
-#undef SET_PIXEL
}
More information about the mesa-commit
mailing list