summaryrefslogtreecommitdiff
path: root/src/nv_cursor.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-02-11 10:53:15 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-02-11 10:53:15 +0000
commit299d62bcf98c7f437f5da1a602593c8565967a93 (patch)
tree7ff8c4a8916d9fc401dd2a10652695ce01390139 /src/nv_cursor.c
parent11f33224f86463f74822922c33f10207df818986 (diff)
Import changes from XORG-6.8.2CYGWIN-6_8_2-MERGECYGWIN
Diffstat (limited to 'src/nv_cursor.c')
-rw-r--r--src/nv_cursor.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/nv_cursor.c b/src/nv_cursor.c
index 577b44d..f22e3d7 100644
--- a/src/nv_cursor.c
+++ b/src/nv_cursor.c
@@ -37,7 +37,7 @@
|* *|
\***************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.11 2002/11/26 23:41:58 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.13 2004/03/13 22:07:05 mvojkovi Exp $ */
#include "nv_include.h"
@@ -239,28 +239,37 @@ NVLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
NVPtr pNv = NVPTR(pScrn);
CARD32 *image = pCurs->bits->argb;
CARD32 *dst = (CARD32*)pNv->CURSOR;
+ CARD32 alpha, tmp;
int x, y, w, h;
w = pCurs->bits->width;
h = pCurs->bits->height;
-#if X_BYTE_ORDER == X_BIG_ENDIAN
- if((pNv->Chipset & 0x0ff0) == 0x0110) {
- CARD32 tmp;
-
+ if((pNv->Chipset & 0x0ff0) == 0x0110) { /* premultiply */
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
- tmp = *image++;
- *dst++ = BYTE_SWAP_32(tmp);
- }
- for(; x < 64; x++)
- *dst++ = 0;
- }
- } else
+ alpha = *image >> 24;
+ if(alpha == 0xff)
+ tmp = *image;
+ else {
+ tmp = (alpha << 24) |
+ (((*image & 0xff) * alpha) / 255) |
+ ((((*image & 0xff00) * alpha) / 255) & 0xff00) |
+ ((((*image & 0xff0000) * alpha) / 255) & 0xff0000);
+ }
+ image++;
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ *dst++ = BYTE_SWAP_32(tmp);
+#else
+ *dst++ = tmp;
#endif
- {
+ }
+ for(; x < 64; x++)
+ *dst++ = 0;
+ }
+ } else {
for(y = 0; y < h; y++) {
- for(x = 0; x < w; x++)
+ for(x = 0; x < w; x++)
*dst++ = *image++;
for(; x < 64; x++)
*dst++ = 0;
@@ -299,9 +308,7 @@ NVCursorInit(ScreenPtr pScreen)
infoPtr->UseHWCursor = NVUseHWCursor;
#ifdef ARGB_CURSOR
- if(pNv->alphaCursor &&
- (((pNv->Chipset & 0x0ff0) != 0x0110) || !pNv->FPDither))
- {
+ if(pNv->alphaCursor) {
infoPtr->UseHWCursorARGB = NVUseHWCursorARGB;
infoPtr->LoadCursorARGB = NVLoadCursorARGB;
}