Use proper access size when reading pixel based on bpp of the source pixmap

This commit is contained in:
Benjamin Herrenschmidt 2005-10-12 07:46:36 +00:00
parent 55efb41f6c
commit e573b272bf
3 changed files with 39 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/* /*
* Copyright © 2001 Keith Packard * Copyright © 2001 Keith Packard
* *
* Partly based on code that is Copyright © The XFree86 Project Inc. * Partly based on code that is Copyright © The XFree86 Project Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that * documentation for any purpose is hereby granted without fee, provided that
@ -261,7 +261,17 @@ exaTryDriverSolidFill(PicturePtr pSrc,
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); switch (pSrcPix->drawable.bitsPerPixel) {
case 32:
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
break;
case 16:
pixel = *(CARD16 *)(pSrcPix->devPrivate.ptr);
break;
default:
pixel = *(CARD8 *)(pSrcPix->devPrivate.ptr);
break;
}
if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha, if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
pSrc->format)) pSrc->format))
{ {

View File

@ -1,7 +1,7 @@
/* /*
* Copyright © 2001 Keith Packard * Copyright © 2001 Keith Packard
* *
* Partly based on code that is Copyright © The XFree86 Project Inc. * Partly based on code that is Copyright © The XFree86 Project Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that * documentation for any purpose is hereby granted without fee, provided that
@ -261,7 +261,17 @@ exaTryDriverSolidFill(PicturePtr pSrc,
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); switch (pSrcPix->drawable.bitsPerPixel) {
case 32:
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
break;
case 16:
pixel = *(CARD16 *)(pSrcPix->devPrivate.ptr);
break;
default:
pixel = *(CARD8 *)(pSrcPix->devPrivate.ptr);
break;
}
if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha, if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
pSrc->format)) pSrc->format))
{ {

View File

@ -1,7 +1,7 @@
/* /*
* Copyright © 2001 Keith Packard * Copyright © 2001 Keith Packard
* *
* Partly based on code that is Copyright © The XFree86 Project Inc. * Partly based on code that is Copyright © The XFree86 Project Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that * documentation for any purpose is hereby granted without fee, provided that
@ -261,7 +261,17 @@ exaTryDriverSolidFill(PicturePtr pSrc,
exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC); exaPrepareAccess(&pSrcPix->drawable, EXA_PREPARE_SRC);
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); switch (pSrcPix->drawable.bitsPerPixel) {
case 32:
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
break;
case 16:
pixel = *(CARD16 *)(pSrcPix->devPrivate.ptr);
break;
default:
pixel = *(CARD8 *)(pSrcPix->devPrivate.ptr);
break;
}
if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha, if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
pSrc->format)) pSrc->format))
{ {