summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Schultz <[email protected]>2006-04-03 16:54:25 +0000
committerKarl Schultz <[email protected]>2006-04-03 16:54:25 +0000
commita9cc078b0e4340d36da2fdef08d45987f8e67145 (patch)
tree961b739d4a3811cdac00c3d2964b172730a90286 /src
parentac619f4912c7037e65884a87284d3f88f42b7b51 (diff)
Fix problem reported by Bill Newman in read_rgba_pixels for 16 and 32 bit (GDI driver). Bug would cause the wrong pixel to be read if more than one pixel requested and could cause memory access violations.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/windows/gdi/wmesa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 21292494242..8e861da5081 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -782,7 +782,7 @@ static void read_rgba_pixels_32(const GLcontext *ctx,
for (i=0; i<n; i++) {
GLint y2 = FLIP(y[i]);
lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y2)) + x[i];
- pixel = lpdw[i];
+ pixel = *lpdw;
rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;
rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;
rgba[i][BCOMP] = (pixel & 0x000000ff);
@@ -966,7 +966,7 @@ static void read_rgba_pixels_16(const GLcontext *ctx,
for (i=0; i<n; i++) {
GLint y2 = FLIP(y[i]);
lpw = ((LPWORD)(pwfb->pbPixels + pwfb->ScanWidth * y2)) + x[i];
- pixel = lpw[i];
+ pixel = *lpw;
/* Windows uses 5,5,5 for 16-bit */
rgba[i][RCOMP] = (pixel & 0x7c00) >> 7;
rgba[i][GCOMP] = (pixel & 0x03e0) >> 2;