Index: modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp =================================================================== --- modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp (revision 601730) +++ modules/awt/src/main/native/gl/shared/SurfaceDataStructure.cpp (working copy) @@ -99,17 +99,17 @@ case INT_ARGB: { - unsigned char *src, *s, *dst, *d, sa; + if(alphaPre){ + unsigned char *src, *s, *dst, *d, sa; - src_stride = srcSurf->scanline_stride_byte; - dst_stride = srcSurf->width << 2; + src_stride = srcSurf->scanline_stride_byte; + dst_stride = srcSurf->width << 2; - src_offset = y * src_stride + ((x + w) << 2) - 1; - dst_offset = y * dst_stride + ((x + w) << 2) - 1; - src = (unsigned char *)srcDataPtr + src_offset; - dst = (unsigned char *)bmpDataPtr + dst_offset; + src_offset = y * src_stride + ((x + w) << 2) - 1; + dst_offset = y * dst_stride + ((x + w) << 2) - 1; + src = (unsigned char *)srcDataPtr + src_offset; + dst = (unsigned char *)bmpDataPtr + dst_offset; - if(alphaPre){ for(int _y = h; _y > 0; _y--, src += src_stride, dst += dst_stride){ s = src; d = dst; @@ -129,28 +129,23 @@ } } } + srcSurf->isAlphaPre = true; }else{ - for(int _y = h; _y > 0; _y--, src += src_stride, dst += dst_stride){ - s = src; - d = dst; + unsigned int *src, *dst; - for(int _x = w; _x > 0; _x--){ - sa = *s--; - if(sa == 0){ - *d-- = 0; - *d-- = 0; - *d-- = 0; - *d-- = 0; - s -= 3; - }else{ - *d-- = sa; - *d-- = MUL(sa, *s--); - *d-- = MUL(sa, *s--); - *d-- = MUL(sa, *s--); - } - } + src_stride = srcSurf->scanline_stride; + dst_stride = srcSurf->width; + + src_offset = y * src_stride + x; + dst_offset = y * dst_stride + x; + src = (unsigned int *)srcDataPtr + src_offset; + dst = (unsigned int *)bmpDataPtr + dst_offset; + + for(int _y = 0; _y < h; _y++, src += src_stride, dst += dst_stride){ + memcpy(dst, src, w * sizeof(int)); } + srcSurf->isAlphaPre = false; } } @@ -303,17 +298,10 @@ g = *s--; b = *s--; a = *s--; - if(a == 0){ - *d-- = 0; - *d-- = 0; - *d-- = 0; - *d-- = 0; - }else{ - *d-- = a; - *d-- = r; - *d-- = g; - *d-- = b; - } + *d-- = a; + *d-- = r; + *d-- = g; + *d-- = b; } } srcSurf->isAlphaPre = false; Index: modules/awt/src/main/native/gl/shared/blitter.cpp =================================================================== --- modules/awt/src/main/native/gl/shared/blitter.cpp (revision 601730) +++ modules/awt/src/main/native/gl/shared/blitter.cpp (working copy) @@ -819,10 +819,10 @@ r = (unsigned char)((xorcolor >> 16) & 0xff); g = (unsigned char)((xorcolor >> 8) & 0xff); b = (unsigned char)(xorcolor & 0xff); - for(int _sy = srcY, _dy = dstY, maxY = srcY + height; _sy < maxY; _sy++, _dy++){ for(int _sx = srcX, _dx = dstX, maxX = srcX + width; _sx < maxX; _sx++, _dx++){ getRGB(_sx, _sy, srcStruct, srcData, sr, sg, sb, sa, false); + if(sa < 128) continue; getRGB(_dx, _dy, dstStruct, dstData, dr, dg, db, da, false); dr ^= (r ^ sr); dg ^= (g ^ sg); Index: modules/awt/src/main/native/gl/windows/GDIBlitter.cpp =================================================================== --- modules/awt/src/main/native/gl/windows/GDIBlitter.cpp (revision 602806) +++ modules/awt/src/main/native/gl/windows/GDIBlitter.cpp (working copy) @@ -417,7 +417,7 @@ regions = (int *)malloc(regCount * sizeof(int)); env->GetIntArrayRegion(dirtyRegions, 1, regCount, regions); } - if(!initBitmap(srcSurf, env, srcData, true, regions, regCount)) return; + if(!initBitmap(srcSurf, env, srcData, false, regions, regCount)) return; BYTE r = (BYTE)((xorcolor >> 16) & 0xff); BYTE g = (BYTE)((xorcolor >> 8) & 0xff); @@ -450,9 +450,39 @@ HGDIOBJ oldBrush = SelectObject(dstSurf->gi->hdc, brush); - BitBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC, - srcX, srcY, 0x960169); + if(srcSurf->has_alpha){ + int scanline_word = srcSurf->width / 16; + if(srcSurf->width % 16 != 0) scanline_word++; + + BYTE *pm = (BYTE *)calloc(scanline_word * srcSurf->height * 2, 1); + + int byteIdx = 0; + unsigned int *p = (unsigned int *)srcSurf->bmpData; + for(int y = 0; y < srcSurf->height; y++){ + for(int x = 0, shift = 7; x < srcSurf->width; x++, shift--, p++){ + if(shift < 0 ){ + shift = 7; + byteIdx++; + } + unsigned int pixel = (*p >> 24) & 0xff; + if(pixel > 127) pm[byteIdx] |= 1 << shift; + } + if(byteIdx % 2 != 0) byteIdx++; + else byteIdx += 2; + } + + HBITMAP mask = CreateBitmap(srcSurf->width, srcSurf->height, 1, 1, pm); + free(pm); + MaskBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC, + srcX, srcY, mask, srcX, srcY, MAKEROP4(0x960169, 0xAA0029)); + DeleteObject(mask); + }else{ + + BitBlt(dstSurf->gi->hdc, dstX, dstY, width, height, srcSurf->srcDC, + srcX, srcY, 0x960169); + } + SelectObject(dstSurf->gi->hdc, oldBrush);