summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-10-12 07:46:36 +0000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-10-12 07:46:36 +0000
commite573b272bf2b06fb62d0306ddc966f3230ead967 (patch)
tree5457c144d37b94c0fc410cf548e31ee9726c5955 /hw
parent55efb41f6cc064763cbfd3ee2a1239dc46cb109a (diff)
Use proper access size when reading pixel based on bpp of the source pixmap
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/exa/exa_render.c16
-rw-r--r--hw/xfree86/exa/exapict.c16
2 files changed, 26 insertions, 6 deletions
diff --git a/hw/xfree86/exa/exa_render.c b/hw/xfree86/exa/exa_render.c
index 16ffcdcf6..9ca78dba7 100644
--- a/hw/xfree86/exa/exa_render.c
+++ b/hw/xfree86/exa/exa_render.c
@@ -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
* documentation for any purpose is hereby granted without fee, provided that
@@ -261,7 +261,17 @@ exaTryDriverSolidFill(PicturePtr pSrc,
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,
pSrc->format))
{
diff --git a/hw/xfree86/exa/exapict.c b/hw/xfree86/exa/exapict.c
index 16ffcdcf6..9ca78dba7 100644
--- a/hw/xfree86/exa/exapict.c
+++ b/hw/xfree86/exa/exapict.c
@@ -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
* documentation for any purpose is hereby granted without fee, provided that
@@ -261,7 +261,17 @@ exaTryDriverSolidFill(PicturePtr pSrc,
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,
pSrc->format))
{