1998-10-24 13:08:27 +02:00
|
|
|
|
/*
|
|
|
|
|
* DISPDIB.dll
|
|
|
|
|
*
|
|
|
|
|
* Copyright 1998 Ove K<EFBFBD>ven (with some help from Marcus Meissner)
|
|
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-10-24 13:08:27 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
2000-03-24 22:13:57 +01:00
|
|
|
|
#include "windef.h"
|
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
#include "wine/wingdi16.h"
|
1998-10-24 13:08:27 +02:00
|
|
|
|
#include "dispdib.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
|
#include "wine/debug.h"
|
1998-10-24 13:08:27 +02:00
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
|
2001-12-04 20:54:44 +01:00
|
|
|
|
#if 0
|
|
|
|
|
|
1998-10-24 13:08:27 +02:00
|
|
|
|
static int dispdib_multi = 0;
|
|
|
|
|
|
|
|
|
|
static WORD DISPDIB_Begin(WORD wFlags)
|
|
|
|
|
{
|
|
|
|
|
unsigned Xres,Yres,Depth;
|
|
|
|
|
|
|
|
|
|
switch(wFlags&DISPLAYDIB_MODE) {
|
|
|
|
|
case DISPLAYDIB_MODE_DEFAULT:
|
|
|
|
|
/* FIXME: is this supposed to autodetect? */
|
|
|
|
|
case DISPLAYDIB_MODE_320x200x8:
|
|
|
|
|
Xres=320; Yres=200; Depth=8; break;
|
|
|
|
|
case DISPLAYDIB_MODE_320x240x8:
|
|
|
|
|
Xres=320; Yres=240; Depth=8; break;
|
|
|
|
|
default:
|
|
|
|
|
return DISPLAYDIB_NOTSUPPORTED;
|
|
|
|
|
}
|
1999-01-26 17:57:56 +01:00
|
|
|
|
/* more or less dummy calls to Death/Resurrection, for completeness */
|
|
|
|
|
/* FIXME: what arguments should they get? */
|
1999-02-26 12:11:13 +01:00
|
|
|
|
Death16(0);
|
1999-01-26 17:57:56 +01:00
|
|
|
|
if (VGA_SetMode(Xres,Yres,Depth)) {
|
1999-02-26 12:11:13 +01:00
|
|
|
|
Resurrection16(0,0,0,0,0,0,0);
|
1999-01-26 17:57:56 +01:00
|
|
|
|
return DISPLAYDIB_NOTSUPPORTED;
|
|
|
|
|
}
|
1998-10-24 13:08:27 +02:00
|
|
|
|
return DISPLAYDIB_NOERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void DISPDIB_End(void)
|
|
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
|
Resurrection16(0,0,0,0,0,0,0); /* FIXME: arguments */
|
1998-11-01 13:51:47 +01:00
|
|
|
|
VGA_Exit();
|
1998-10-24 13:08:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void DISPDIB_Palette(LPBITMAPINFO lpbi)
|
|
|
|
|
{
|
1998-11-01 13:51:47 +01:00
|
|
|
|
VGA_SetQuadPalette(lpbi->bmiColors,0,256);
|
1998-10-24 13:08:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void DISPDIB_Show(LPBITMAPINFOHEADER lpbi,LPSTR lpBits,WORD uFlags)
|
|
|
|
|
{
|
|
|
|
|
int Xofs,Yofs,Width=lpbi->biWidth,Height=lpbi->biHeight,Delta;
|
2001-08-11 00:49:35 +02:00
|
|
|
|
int Pitch = (Width + 3) & ~3;
|
|
|
|
|
unsigned int sPitch,sWidth,sHeight;
|
1998-11-01 13:51:47 +01:00
|
|
|
|
LPSTR surf = DOSMEM_MapDosToLinear(0xa0000);
|
1998-10-24 13:08:27 +02:00
|
|
|
|
|
1998-11-01 13:51:47 +01:00
|
|
|
|
if (VGA_GetMode(&sHeight,&sWidth,NULL)) return;
|
|
|
|
|
sPitch=320;
|
1998-10-24 13:08:27 +02:00
|
|
|
|
|
|
|
|
|
Delta=(Height<0)*2-1;
|
|
|
|
|
Height*=-Delta; Pitch*=Delta;
|
|
|
|
|
|
|
|
|
|
if (uFlags&DISPLAYDIB_NOCENTER) {
|
|
|
|
|
Xofs=0; Yofs=0;
|
|
|
|
|
} else {
|
1998-11-01 13:51:47 +01:00
|
|
|
|
Xofs=(sWidth-Width)/2;
|
|
|
|
|
Yofs=(sHeight-Height)/2;
|
1998-10-24 13:08:27 +02:00
|
|
|
|
}
|
1998-11-01 13:51:47 +01:00
|
|
|
|
surf += (Yofs*sPitch)+Xofs;
|
1998-10-24 13:08:27 +02:00
|
|
|
|
if (Pitch<0) lpBits-=Pitch*(Height-1);
|
1998-11-01 13:51:47 +01:00
|
|
|
|
for (; Height; Height--,lpBits+=Pitch,surf+=sPitch) {
|
1998-10-24 13:08:27 +02:00
|
|
|
|
memcpy(surf,lpBits,Width);
|
|
|
|
|
}
|
|
|
|
|
|
1998-12-10 11:47:26 +01:00
|
|
|
|
VGA_Poll(0);
|
1998-10-24 13:08:27 +02:00
|
|
|
|
}
|
2001-12-04 20:54:44 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
1998-10-24 13:08:27 +02:00
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
* DisplayDib (DISPDIB.1)
|
|
|
|
|
*
|
|
|
|
|
* Disables GDI and takes over the VGA screen to show DIBs in full screen.
|
|
|
|
|
*
|
|
|
|
|
* FLAGS
|
|
|
|
|
*
|
|
|
|
|
* DISPLAYDIB_NOPALETTE: don't change palette
|
|
|
|
|
* DISPLAYDIB_NOCENTER: don't center bitmap
|
|
|
|
|
* DISPLAYDIB_NOWAIT: don't wait (for keypress) before returning
|
|
|
|
|
* DISPLAYDIB_BEGIN: start of multiple calls (does not restore the screen)
|
|
|
|
|
* DISPLAYDIB_END: end of multiple calls (restores the screen)
|
|
|
|
|
* DISPLAYDIB_MODE_DEFAULT: default display mode
|
|
|
|
|
* DISPLAYDIB_MODE_320x200x8: Standard VGA 320x200 256 colors
|
|
|
|
|
* DISPLAYDIB_MODE_320x240x8: Tweaked VGA 320x240 256 colors
|
|
|
|
|
*
|
|
|
|
|
* RETURNS
|
|
|
|
|
*
|
|
|
|
|
* DISPLAYDIB_NOERROR: success
|
|
|
|
|
* DISPLAYDIB_NOTSUPPORTED: function not supported
|
|
|
|
|
* DISPLAYDIB_INVALIDDIB: null or invalid DIB header
|
|
|
|
|
* DISPLAYDIB_INVALIDFORMAT: invalid DIB format
|
|
|
|
|
* DISPLAYDIB_INVALIDTASK: not called from current task
|
|
|
|
|
*
|
|
|
|
|
* BUGS
|
|
|
|
|
*
|
|
|
|
|
* Waiting for keypresses is not implemented.
|
|
|
|
|
*/
|
|
|
|
|
WORD WINAPI DisplayDib(
|
2000-12-02 00:58:28 +01:00
|
|
|
|
LPBITMAPINFO lpbi, /* [in] DIB header with resolution and palette */
|
|
|
|
|
LPSTR lpBits, /* [in] Bitmap bits to show */
|
|
|
|
|
WORD wFlags /* [in] */
|
1998-10-24 13:08:27 +02:00
|
|
|
|
)
|
|
|
|
|
{
|
2001-12-04 20:54:44 +01:00
|
|
|
|
#if 0
|
1998-10-24 13:08:27 +02:00
|
|
|
|
WORD ret;
|
|
|
|
|
|
|
|
|
|
if (wFlags&DISPLAYDIB_END) {
|
|
|
|
|
if (dispdib_multi) DISPDIB_End();
|
|
|
|
|
dispdib_multi = 0;
|
|
|
|
|
return DISPLAYDIB_NOERROR;
|
|
|
|
|
}
|
|
|
|
|
if (!dispdib_multi) {
|
|
|
|
|
ret=DISPDIB_Begin(wFlags);
|
|
|
|
|
if (ret) return ret;
|
|
|
|
|
}
|
|
|
|
|
if (wFlags&DISPLAYDIB_BEGIN) dispdib_multi = 1;
|
|
|
|
|
if (!(wFlags&DISPLAYDIB_NOPALETTE)) {
|
|
|
|
|
DISPDIB_Palette(lpbi);
|
|
|
|
|
}
|
|
|
|
|
/* FIXME: not sure if it's valid to draw images in DISPLAYDIB_BEGIN, so... */
|
|
|
|
|
if (lpBits) {
|
|
|
|
|
DISPDIB_Show(&(lpbi->bmiHeader),lpBits,wFlags);
|
|
|
|
|
}
|
|
|
|
|
if (!(wFlags&DISPLAYDIB_NOWAIT)) {
|
1999-06-26 21:09:08 +02:00
|
|
|
|
FIXME("wait not implemented\n");
|
1998-10-24 13:08:27 +02:00
|
|
|
|
}
|
|
|
|
|
if (!dispdib_multi) DISPDIB_End();
|
2001-12-04 20:54:44 +01:00
|
|
|
|
#endif
|
|
|
|
|
FIXME( "broken, should be rewritten using ddraw\n" );
|
1998-10-24 13:08:27 +02:00
|
|
|
|
return DISPLAYDIB_NOERROR;
|
|
|
|
|
}
|