mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Removed space optimalization of XLATEGDI that caused some problems.
svn path=/trunk/; revision=7133
This commit is contained in:
parent
6594b15c96
commit
705104e713
3 changed files with 400 additions and 87 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: objects.h,v 1.22 2003/12/19 22:58:47 navaraf Exp $
|
||||
/* $Id: objects.h,v 1.23 2003/12/20 14:51:41 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -209,22 +209,22 @@ typedef struct _XLATEGDI {
|
|||
HPALETTE SourcePal;
|
||||
BOOL UseShiftAndMask;
|
||||
|
||||
union {
|
||||
struct { /* For Shift Translations */
|
||||
// union {
|
||||
// struct { /* For Shift Translations */
|
||||
ULONG RedMask;
|
||||
ULONG GreenMask;
|
||||
ULONG BlueMask;
|
||||
INT RedShift;
|
||||
INT GreenShift;
|
||||
INT BlueShift;
|
||||
};
|
||||
struct { /* For Table Translations */
|
||||
// };
|
||||
// struct { /* For Table Translations */
|
||||
ULONG *translationTable;
|
||||
};
|
||||
struct { /* For Color -> Mono Translations */
|
||||
// };
|
||||
// struct { /* For Color -> Mono Translations */
|
||||
ULONG BackgroundColor;
|
||||
};
|
||||
};
|
||||
// };
|
||||
// };
|
||||
} XLATEGDI;
|
||||
|
||||
// List of GDI objects
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: xlate.c,v 1.28 2003/12/20 14:19:47 navaraf Exp $
|
||||
/* $Id: xlate.c,v 1.29 2003/12/20 14:51:41 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -43,16 +43,6 @@
|
|||
|
||||
ULONG CCMLastSourceColor = 0, CCMLastColorMatch = 0;
|
||||
|
||||
ULONG STDCALL RGBtoULONG(BYTE Red, BYTE Green, BYTE Blue)
|
||||
{
|
||||
return ((Red & 0xff) << 16) | ((Green & 0xff) << 8) | (Blue & 0xff);
|
||||
}
|
||||
|
||||
ULONG STDCALL BGRtoULONG(BYTE Blue, BYTE Green, BYTE Red)
|
||||
{
|
||||
return ((Blue & 0xff) << 16) | ((Green & 0xff) << 8) | (Red & 0xff);
|
||||
}
|
||||
|
||||
static ULONG FASTCALL ShiftAndMask(XLATEGDI *XlateGDI, ULONG Color)
|
||||
{
|
||||
ULONG TranslatedColor;
|
||||
|
@ -470,65 +460,65 @@ XLATEOBJ * STDCALL IntEngCreateMonoXlate(
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
ULONG * STDCALL
|
||||
PULONG STDCALL
|
||||
XLATEOBJ_piVector(XLATEOBJ *XlateObj)
|
||||
{
|
||||
XLATEGDI *XlateGDI = (XLATEGDI*)AccessInternalObjectFromUserObject(XlateObj);
|
||||
XLATEGDI *XlateGDI = (XLATEGDI*)AccessInternalObjectFromUserObject(XlateObj);
|
||||
|
||||
if(XlateObj->iSrcType == PAL_INDEXED)
|
||||
{
|
||||
return XlateGDI->translationTable;
|
||||
}
|
||||
if (XlateObj->iSrcType == PAL_INDEXED)
|
||||
{
|
||||
return XlateGDI->translationTable;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
ULONG STDCALL
|
||||
XLATEOBJ_iXlate(XLATEOBJ *XlateObj,
|
||||
ULONG Color)
|
||||
XLATEOBJ_iXlate(XLATEOBJ *XlateObj, ULONG Color)
|
||||
{
|
||||
PALGDI *PalGDI;
|
||||
ULONG Closest;
|
||||
PALGDI *PalGDI;
|
||||
ULONG Closest;
|
||||
|
||||
// Return the original color if there's no color translation object
|
||||
if(!XlateObj) return Color;
|
||||
/* Return the original color if there's no color translation object. */
|
||||
if (!XlateObj)
|
||||
return Color;
|
||||
|
||||
if(XlateObj->flXlate & XO_TRIVIAL)
|
||||
{
|
||||
return Color;
|
||||
} else
|
||||
{
|
||||
XLATEGDI *XlateGDI = (XLATEGDI*)AccessInternalObjectFromUserObject(XlateObj);
|
||||
if (XlateObj->flXlate & XO_TRIVIAL)
|
||||
{
|
||||
return Color;
|
||||
} else
|
||||
{
|
||||
XLATEGDI *XlateGDI = (XLATEGDI *)AccessInternalObjectFromUserObject(XlateObj);
|
||||
|
||||
if(XlateObj->flXlate & XO_TO_MONO)
|
||||
{
|
||||
return Color == XlateGDI->BackgroundColor;
|
||||
} else
|
||||
if(XlateGDI->UseShiftAndMask)
|
||||
{
|
||||
return ShiftAndMask(XlateGDI, Color);
|
||||
} else
|
||||
if (PAL_RGB == XlateObj->iSrcType || PAL_BGR == XlateObj->iSrcType
|
||||
|| PAL_BITFIELDS == XlateObj->iSrcType)
|
||||
{
|
||||
// FIXME: should we cache colors used often?
|
||||
// FIXME: won't work if destination isn't indexed
|
||||
if (XlateObj->flXlate & XO_TO_MONO)
|
||||
{
|
||||
return Color == XlateGDI->BackgroundColor;
|
||||
} else
|
||||
if (XlateGDI->UseShiftAndMask)
|
||||
{
|
||||
return ShiftAndMask(XlateGDI, Color);
|
||||
} else
|
||||
if (XlateObj->iSrcType == PAL_RGB || XlateObj->iSrcType == PAL_BGR ||
|
||||
XlateObj->iSrcType == PAL_BITFIELDS)
|
||||
{
|
||||
/* FIXME: should we cache colors used often? *
|
||||
/* FIXME: won't work if destination isn't indexed */
|
||||
|
||||
// Extract the destination palette
|
||||
PalGDI = PALETTE_LockPalette(XlateGDI->DestPal);
|
||||
/* Extract the destination palette. */
|
||||
PalGDI = PALETTE_LockPalette(XlateGDI->DestPal);
|
||||
|
||||
// Return closest match for the given color
|
||||
Closest = ClosestColorMatch(XlateGDI, Color, PalGDI->IndexedColors, PalGDI->NumColors);
|
||||
PALETTE_UnlockPalette(XlateGDI->DestPal);
|
||||
return Closest;
|
||||
} else
|
||||
if(XlateObj->iSrcType == PAL_INDEXED)
|
||||
{
|
||||
return XlateGDI->translationTable[Color];
|
||||
}
|
||||
/* Return closest match for the given color. */
|
||||
Closest = ClosestColorMatch(XlateGDI, Color, PalGDI->IndexedColors, PalGDI->NumColors);
|
||||
PALETTE_UnlockPalette(XlateGDI->DestPal);
|
||||
return Closest;
|
||||
} else
|
||||
if (XlateObj->iSrcType == PAL_INDEXED)
|
||||
{
|
||||
return XlateGDI->translationTable[Color];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -538,32 +528,27 @@ XLATEOBJ_iXlate(XLATEOBJ *XlateObj,
|
|||
* @implemented
|
||||
*/
|
||||
ULONG STDCALL
|
||||
XLATEOBJ_cGetPalette(XLATEOBJ *XlateObj,
|
||||
ULONG PalOutType,
|
||||
ULONG cPal,
|
||||
ULONG *OutPal)
|
||||
XLATEOBJ_cGetPalette(XLATEOBJ *XlateObj, ULONG PalOutType, ULONG cPal,
|
||||
ULONG *OutPal)
|
||||
{
|
||||
ULONG i;
|
||||
HPALETTE HPal;
|
||||
XLATEGDI *XlateGDI;
|
||||
PALGDI *PalGDI;
|
||||
HPALETTE hPalette;
|
||||
XLATEGDI *XlateGDI;
|
||||
PALGDI *PalGDI;
|
||||
ULONG i;
|
||||
|
||||
XlateGDI = (XLATEGDI*)AccessInternalObjectFromUserObject(XlateObj);
|
||||
XlateGDI = (XLATEGDI*)AccessInternalObjectFromUserObject(XlateObj);
|
||||
if (PalOutType == XO_SRCPALETTE)
|
||||
hPalette = XlateGDI->SourcePal;
|
||||
else if (PalOutType == XO_DESTPALETTE)
|
||||
hPalette = XlateGDI->DestPal;
|
||||
else
|
||||
UNIMPLEMENTED;
|
||||
|
||||
if(PalOutType == XO_SRCPALETTE)
|
||||
{
|
||||
HPal = XlateGDI->SourcePal;
|
||||
} else
|
||||
if(PalOutType == XO_DESTPALETTE)
|
||||
{
|
||||
HPal = XlateGDI->DestPal;
|
||||
}
|
||||
PalGDI = PALETTE_LockPalette(hPalette);
|
||||
RtlCopyMemory(OutPal, PalGDI->IndexedColors, sizeof(ULONG) * cPal);
|
||||
PALETTE_UnlockPalette(hPalette);
|
||||
|
||||
PalGDI = PALETTE_LockPalette(HPal);
|
||||
RtlCopyMemory(OutPal, PalGDI->IndexedColors, sizeof(ULONG)*cPal);
|
||||
PALETTE_UnlockPalette(HPal);
|
||||
|
||||
return i;
|
||||
return cPal;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: dib.c,v 1.38 2003/12/20 10:31:32 navaraf Exp $
|
||||
* $Id: dib.c,v 1.39 2003/12/20 14:51:41 navaraf Exp $
|
||||
*
|
||||
* ReactOS W32 Subsystem
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include <include/inteng.h>
|
||||
#include <include/eng.h>
|
||||
#include <include/dib.h>
|
||||
#include <include/color.h>
|
||||
#include <internal/safe.h>
|
||||
#include <include/surface.h>
|
||||
#include <include/palette.h>
|
||||
|
@ -257,6 +258,7 @@ UINT STDCALL NtGdiGetDIBColorTable(HDC hDC,
|
|||
}
|
||||
|
||||
// Converts a device-dependent bitmap to a DIB
|
||||
#if 0
|
||||
INT STDCALL NtGdiGetDIBits(HDC hDC,
|
||||
HBITMAP hBitmap,
|
||||
UINT StartScan,
|
||||
|
@ -264,7 +266,18 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
|||
LPVOID Bits,
|
||||
LPBITMAPINFO UnsafeInfo,
|
||||
UINT Usage)
|
||||
#else
|
||||
INT STDCALL NtGdiGetDIBits(
|
||||
HDC hdc, /* [in] Handle to device context */
|
||||
HBITMAP hbitmap, /* [in] Handle to bitmap */
|
||||
UINT startscan, /* [in] First scan line to set in dest bitmap */
|
||||
UINT lines, /* [in] Number of scan lines to copy */
|
||||
LPVOID bits, /* [out] Address of array for bitmap bits */
|
||||
BITMAPINFO * info, /* [out] Address of structure with bitmap data */
|
||||
UINT coloruse) /* [in] RGB or palette index */
|
||||
#endif
|
||||
{
|
||||
#if 0
|
||||
BITMAPINFO Info;
|
||||
BITMAPCOREHEADER *Core;
|
||||
PBITMAPOBJ BitmapObj;
|
||||
|
@ -414,6 +427,321 @@ INT STDCALL NtGdiGetDIBits(HDC hDC,
|
|||
BITMAPOBJ_UnlockBitmap(hBitmap);
|
||||
|
||||
return Result;
|
||||
#else
|
||||
PDC dc;
|
||||
PBITMAPOBJ bmp;
|
||||
int i;
|
||||
|
||||
if (!info) return 0;
|
||||
if (!(dc = DC_LockDc( hdc ))) return 0;
|
||||
if (!(bmp = BITMAPOBJ_LockBitmap(hbitmap)))
|
||||
{
|
||||
DC_UnlockDc( hdc );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Transfer color info */
|
||||
|
||||
if (info->bmiHeader.biBitCount <= 8 && info->bmiHeader.biBitCount > 0 ) {
|
||||
|
||||
info->bmiHeader.biClrUsed = 0;
|
||||
|
||||
/* If the bitmap object already has a dib section at the
|
||||
same color depth then get the color map from it */
|
||||
if (bmp->dib && bmp->dib->dsBm.bmBitsPixel == info->bmiHeader.biBitCount) {
|
||||
NtGdiGetDIBColorTable(hdc, 0, 1 << info->bmiHeader.biBitCount, info->bmiColors);
|
||||
}
|
||||
else {
|
||||
if(info->bmiHeader.biBitCount >= bmp->bitmap.bmBitsPixel) {
|
||||
/* Generate the color map from the selected palette */
|
||||
PALETTEENTRY * palEntry;
|
||||
PPALGDI palette;
|
||||
if (!(palette = PALETTE_LockPalette(dc->w.hPalette))) {
|
||||
DC_UnlockDc( hdc );
|
||||
BITMAPOBJ_UnlockBitmap( hbitmap );
|
||||
return 0;
|
||||
}
|
||||
palEntry = palette->IndexedColors;
|
||||
for (i = 0; i < (1 << bmp->bitmap.bmBitsPixel); i++, palEntry++) {
|
||||
if (coloruse == DIB_RGB_COLORS) {
|
||||
info->bmiColors[i].rgbRed = palEntry->peRed;
|
||||
info->bmiColors[i].rgbGreen = palEntry->peGreen;
|
||||
info->bmiColors[i].rgbBlue = palEntry->peBlue;
|
||||
info->bmiColors[i].rgbReserved = 0;
|
||||
}
|
||||
else ((WORD *)info->bmiColors)[i] = (WORD)i;
|
||||
}
|
||||
PALETTE_UnlockPalette( dc->w.hPalette );
|
||||
} else {
|
||||
switch (info->bmiHeader.biBitCount) {
|
||||
case 1:
|
||||
info->bmiColors[0].rgbRed = info->bmiColors[0].rgbGreen =
|
||||
info->bmiColors[0].rgbBlue = 0;
|
||||
info->bmiColors[0].rgbReserved = 0;
|
||||
info->bmiColors[1].rgbRed = info->bmiColors[1].rgbGreen =
|
||||
info->bmiColors[1].rgbBlue = 0xff;
|
||||
info->bmiColors[1].rgbReserved = 0;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
memcpy(info->bmiColors, COLOR_GetSystemPaletteTemplate(), NB_RESERVED_COLORS * sizeof(PALETTEENTRY));
|
||||
break;
|
||||
|
||||
case 8:
|
||||
{
|
||||
INT r, g, b;
|
||||
RGBQUAD *color;
|
||||
|
||||
memcpy(info->bmiColors, COLOR_GetSystemPaletteTemplate(),
|
||||
10 * sizeof(RGBQUAD));
|
||||
memcpy(info->bmiColors + 246, COLOR_GetSystemPaletteTemplate() + 10,
|
||||
10 * sizeof(RGBQUAD));
|
||||
color = info->bmiColors + 10;
|
||||
for(r = 0; r <= 5; r++) /* FIXME */
|
||||
for(g = 0; g <= 5; g++)
|
||||
for(b = 0; b <= 5; b++) {
|
||||
color->rgbRed = (r * 0xff) / 5;
|
||||
color->rgbGreen = (g * 0xff) / 5;
|
||||
color->rgbBlue = (b * 0xff) / 5;
|
||||
color->rgbReserved = 0;
|
||||
color++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bits && lines)
|
||||
{
|
||||
/* If the bitmap object already have a dib section that contains image data, get the bits from it */
|
||||
if(bmp->dib && bmp->dib->dsBm.bmBitsPixel >= 15 && info->bmiHeader.biBitCount >= 15)
|
||||
{
|
||||
/*FIXME: Only RGB dibs supported for now */
|
||||
unsigned int srcwidth = bmp->dib->dsBm.bmWidth, srcwidthb = bmp->dib->dsBm.bmWidthBytes;
|
||||
int dstwidthb = DIB_GetDIBWidthBytes( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
|
||||
LPBYTE dbits = bits, sbits = (LPBYTE) bmp->dib->dsBm.bmBits + (startscan * srcwidthb);
|
||||
unsigned int x, y;
|
||||
|
||||
if ((info->bmiHeader.biHeight < 0) ^ (bmp->dib->dsBmih.biHeight < 0))
|
||||
{
|
||||
dbits = (LPBYTE)bits + (dstwidthb * (lines-1));
|
||||
dstwidthb = -dstwidthb;
|
||||
}
|
||||
|
||||
switch( info->bmiHeader.biBitCount ) {
|
||||
|
||||
case 15:
|
||||
case 16: /* 16 bpp dstDIB */
|
||||
{
|
||||
LPWORD dstbits = (LPWORD)dbits;
|
||||
WORD rmask = 0x7c00, gmask= 0x03e0, bmask = 0x001f;
|
||||
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
|
||||
switch(bmp->dib->dsBm.bmBitsPixel) {
|
||||
|
||||
case 16: /* 16 bpp srcDIB -> 16 bpp dstDIB */
|
||||
{
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
for (y = 0; y < lines; y++, dbits+=dstwidthb, sbits+=srcwidthb)
|
||||
memcpy(dbits, sbits, srcwidthb);
|
||||
}
|
||||
break;
|
||||
|
||||
case 24: /* 24 bpp srcDIB -> 16 bpp dstDIB */
|
||||
{
|
||||
LPBYTE srcbits = sbits;
|
||||
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++, srcbits += 3)
|
||||
*dstbits++ = ((srcbits[0] >> 3) & bmask) |
|
||||
(((WORD)srcbits[1] << 2) & gmask) |
|
||||
(((WORD)srcbits[2] << 7) & rmask);
|
||||
|
||||
dstbits = (LPWORD)(dbits+=dstwidthb);
|
||||
srcbits = (sbits += srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 32: /* 32 bpp srcDIB -> 16 bpp dstDIB */
|
||||
{
|
||||
LPDWORD srcbits = (LPDWORD)sbits;
|
||||
DWORD val;
|
||||
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++ ) {
|
||||
val = *srcbits++;
|
||||
*dstbits++ = (WORD)(((val >> 3) & bmask) | ((val >> 6) & gmask) |
|
||||
((val >> 9) & rmask));
|
||||
}
|
||||
dstbits = (LPWORD)(dbits+=dstwidthb);
|
||||
srcbits = (LPDWORD)(sbits+=srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* ? bit bmp -> 16 bit DIB */
|
||||
DPRINT1("FIXME: 15/16 bit DIB %d bit bitmap\n",
|
||||
bmp->bitmap.bmBitsPixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 24: /* 24 bpp dstDIB */
|
||||
{
|
||||
LPBYTE dstbits = dbits;
|
||||
|
||||
switch(bmp->dib->dsBm.bmBitsPixel) {
|
||||
|
||||
case 16: /* 16 bpp srcDIB -> 24 bpp dstDIB */
|
||||
{
|
||||
LPWORD srcbits = (LPWORD)sbits;
|
||||
WORD val;
|
||||
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++ ) {
|
||||
val = *srcbits++;
|
||||
*dstbits++ = (BYTE)(((val << 3) & 0xf8) | ((val >> 2) & 0x07));
|
||||
*dstbits++ = (BYTE)(((val >> 2) & 0xf8) | ((val >> 7) & 0x07));
|
||||
*dstbits++ = (BYTE)(((val >> 7) & 0xf8) | ((val >> 12) & 0x07));
|
||||
}
|
||||
dstbits = (LPBYTE)(dbits+=dstwidthb);
|
||||
srcbits = (LPWORD)(sbits+=srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 24: /* 24 bpp srcDIB -> 24 bpp dstDIB */
|
||||
{
|
||||
for (y = 0; y < lines; y++, dbits+=dstwidthb, sbits+=srcwidthb)
|
||||
memcpy(dbits, sbits, srcwidthb);
|
||||
}
|
||||
break;
|
||||
|
||||
case 32: /* 32 bpp srcDIB -> 24 bpp dstDIB */
|
||||
{
|
||||
LPBYTE srcbits = (LPBYTE)sbits;
|
||||
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++, srcbits++ ) {
|
||||
*dstbits++ = *srcbits++;
|
||||
*dstbits++ = *srcbits++;
|
||||
*dstbits++ = *srcbits++;
|
||||
}
|
||||
dstbits=(LPBYTE)(dbits+=dstwidthb);
|
||||
srcbits = (LPBYTE)(sbits+=srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* ? bit bmp -> 24 bit DIB */
|
||||
DPRINT1("FIXME: 24 bit DIB %d bit bitmap\n",
|
||||
bmp->bitmap.bmBitsPixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 32: /* 32 bpp dstDIB */
|
||||
{
|
||||
LPDWORD dstbits = (LPDWORD)dbits;
|
||||
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
|
||||
switch(bmp->dib->dsBm.bmBitsPixel) {
|
||||
case 16: /* 16 bpp srcDIB -> 32 bpp dstDIB */
|
||||
{
|
||||
LPWORD srcbits = (LPWORD)sbits;
|
||||
DWORD val;
|
||||
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++ ) {
|
||||
val = (DWORD)*srcbits++;
|
||||
*dstbits++ = ((val << 3) & 0xf8) | ((val >> 2) & 0x07) |
|
||||
((val << 6) & 0xf800) | ((val << 1) & 0x0700) |
|
||||
((val << 9) & 0xf80000) | ((val << 4) & 0x070000);
|
||||
}
|
||||
dstbits=(LPDWORD)(dbits+=dstwidthb);
|
||||
srcbits=(LPWORD)(sbits+=srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 24: /* 24 bpp srcDIB -> 32 bpp dstDIB */
|
||||
{
|
||||
LPBYTE srcbits = sbits;
|
||||
|
||||
for( y = 0; y < lines; y++) {
|
||||
for( x = 0; x < srcwidth; x++, srcbits+=3 )
|
||||
*dstbits++ = ((DWORD)*srcbits) & 0x00ffffff;
|
||||
dstbits=(LPDWORD)(dbits+=dstwidthb);
|
||||
srcbits=(sbits+=srcwidthb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 32: /* 32 bpp srcDIB -> 16 bpp dstDIB */
|
||||
{
|
||||
/* FIXME: BI_BITFIELDS not supported yet */
|
||||
for (y = 0; y < lines; y++, dbits+=dstwidthb, sbits+=srcwidthb)
|
||||
memcpy(dbits, sbits, srcwidthb);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* ? bit bmp -> 32 bit DIB */
|
||||
DPRINT1("FIXME: 32 bit DIB %d bit bitmap\n",
|
||||
bmp->bitmap.bmBitsPixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* ? bit DIB */
|
||||
DPRINT1("FIXME: Unsupported DIB depth %d\n", info->bmiHeader.biBitCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Otherwise, get bits from the XImage */
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
}
|
||||
else if( info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
|
||||
{
|
||||
/* fill in struct members */
|
||||
|
||||
if( info->bmiHeader.biBitCount == 0)
|
||||
{
|
||||
info->bmiHeader.biWidth = bmp->bitmap.bmWidth;
|
||||
info->bmiHeader.biHeight = bmp->bitmap.bmHeight;
|
||||
info->bmiHeader.biPlanes = 1;
|
||||
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
|
||||
info->bmiHeader.biSizeImage =
|
||||
DIB_GetDIBImageBytes( bmp->bitmap.bmWidth,
|
||||
bmp->bitmap.bmHeight,
|
||||
bmp->bitmap.bmBitsPixel );
|
||||
info->bmiHeader.biCompression = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->bmiHeader.biSizeImage = DIB_GetDIBImageBytes(
|
||||
info->bmiHeader.biWidth,
|
||||
info->bmiHeader.biHeight,
|
||||
info->bmiHeader.biBitCount );
|
||||
}
|
||||
}
|
||||
|
||||
DC_UnlockDc( hdc );
|
||||
BITMAPOBJ_UnlockBitmap( hbitmap );
|
||||
|
||||
return lines;
|
||||
#endif
|
||||
}
|
||||
|
||||
INT STDCALL NtGdiStretchDIBits(HDC hDC,
|
||||
|
|
Loading…
Reference in a new issue