1999-08-01 11:21:05 +00:00
|
|
|
/*
|
2003-05-18 17:16:18 +00:00
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2005-05-08 02:11:54 +00:00
|
|
|
*
|
1999-08-01 11:21:05 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: GDI Driver Surace Functions
|
|
|
|
* FILE: subsys/win32k/eng/surface.c
|
|
|
|
* PROGRAMER: Jason Filby
|
|
|
|
* REVISION HISTORY:
|
|
|
|
* 3/7/1999: Created
|
2001-03-31 15:35:08 +00:00
|
|
|
* 9/11/2000: Updated to handle real pixel packed bitmaps (UPDATE TO DATE COMPLETED)
|
|
|
|
* TESTING TO BE DONE:
|
|
|
|
* - Create a GDI bitmap with all formats, perform all drawing operations on them, render to VGA surface
|
|
|
|
* refer to \test\microwin\src\engine\devdraw.c for info on correct pixel plotting for various formats
|
1999-08-01 11:21:05 +00:00
|
|
|
*/
|
2004-05-10 17:07:20 +00:00
|
|
|
#include <w32k.h>
|
1999-08-01 11:21:05 +00:00
|
|
|
|
2003-11-18 18:05:40 +00:00
|
|
|
enum Rle_EscapeCodes
|
|
|
|
{
|
|
|
|
RLE_EOL = 0, /* End of line */
|
|
|
|
RLE_END = 1, /* End of bitmap */
|
|
|
|
RLE_DELTA = 2 /* Delta */
|
|
|
|
};
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
INT FASTCALL BitsPerFormat(ULONG Format)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
switch(Format)
|
|
|
|
{
|
|
|
|
case BMF_1BPP: return 1;
|
|
|
|
case BMF_4BPP:
|
|
|
|
case BMF_4RLE: return 4;
|
|
|
|
case BMF_8BPP:
|
|
|
|
case BMF_8RLE: return 8;
|
|
|
|
case BMF_16BPP: return 16;
|
|
|
|
case BMF_24BPP: return 24;
|
|
|
|
case BMF_32BPP: return 32;
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
ULONG FASTCALL BitmapFormat(WORD Bits, DWORD Compression)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
|
|
|
switch(Compression)
|
|
|
|
{
|
|
|
|
case BI_RGB:
|
2004-12-27 16:45:19 +00:00
|
|
|
case BI_BITFIELDS:
|
2001-03-31 15:35:08 +00:00
|
|
|
switch(Bits)
|
|
|
|
{
|
|
|
|
case 1: return BMF_1BPP;
|
|
|
|
case 4: return BMF_4BPP;
|
|
|
|
case 8: return BMF_8BPP;
|
|
|
|
case 16: return BMF_16BPP;
|
|
|
|
case 24: return BMF_24BPP;
|
|
|
|
case 32: return BMF_32BPP;
|
|
|
|
}
|
2004-07-03 13:55:37 +00:00
|
|
|
return 0;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
|
|
|
case BI_RLE4: return BMF_4RLE;
|
|
|
|
case BI_RLE8: return BMF_8RLE;
|
|
|
|
|
|
|
|
default: return 0;
|
|
|
|
}
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
HBITMAP STDCALL
|
|
|
|
EngCreateDeviceBitmap(IN DHSURF dhsurf,
|
|
|
|
IN SIZEL Size,
|
|
|
|
IN ULONG Format)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
HBITMAP NewBitmap;
|
|
|
|
SURFOBJ *SurfObj;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
NewBitmap = EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format)), Format, 0, NULL);
|
2004-07-03 13:55:37 +00:00
|
|
|
SurfObj = EngLockSurface((HSURF)NewBitmap);
|
2003-10-30 08:56:38 +00:00
|
|
|
SurfObj->dhsurf = dhsurf;
|
2004-07-03 13:55:37 +00:00
|
|
|
EngUnlockSurface(SurfObj);
|
2000-10-14 22:42:11 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return NewBitmap;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2005-05-08 02:11:54 +00:00
|
|
|
VOID Decompress4bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta)
|
2003-11-18 18:05:40 +00:00
|
|
|
{
|
|
|
|
int x = 0;
|
|
|
|
int y = Size.cy - 1;
|
|
|
|
int c;
|
|
|
|
int length;
|
|
|
|
int width = ((Size.cx+1)/2);
|
|
|
|
int height = Size.cy - 1;
|
|
|
|
BYTE *begin = CompressedBits;
|
|
|
|
BYTE *bits = CompressedBits;
|
|
|
|
BYTE *temp;
|
|
|
|
while (y >= 0)
|
|
|
|
{
|
|
|
|
length = *bits++ / 2;
|
|
|
|
if (length)
|
|
|
|
{
|
|
|
|
c = *bits++;
|
|
|
|
while (length--)
|
|
|
|
{
|
|
|
|
if (x >= width) break;
|
|
|
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
|
|
|
x++;
|
|
|
|
*temp = c;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
length = *bits++;
|
|
|
|
switch (length)
|
|
|
|
{
|
|
|
|
case RLE_EOL:
|
|
|
|
x = 0;
|
|
|
|
y--;
|
|
|
|
break;
|
|
|
|
case RLE_END:
|
|
|
|
return;
|
|
|
|
case RLE_DELTA:
|
|
|
|
x += (*bits++)/2;
|
|
|
|
y -= (*bits++)/2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
length /= 2;
|
|
|
|
while (length--)
|
|
|
|
{
|
|
|
|
c = *bits++;
|
|
|
|
if (x < width)
|
|
|
|
{
|
|
|
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
|
|
|
x++;
|
|
|
|
*temp = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((bits - begin) & 1)
|
|
|
|
bits++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-08 02:11:54 +00:00
|
|
|
VOID Decompress8bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta)
|
2003-11-18 18:05:40 +00:00
|
|
|
{
|
|
|
|
int x = 0;
|
|
|
|
int y = Size.cy - 1;
|
|
|
|
int c;
|
|
|
|
int length;
|
|
|
|
int width = Size.cx;
|
|
|
|
int height = Size.cy - 1;
|
|
|
|
BYTE *begin = CompressedBits;
|
|
|
|
BYTE *bits = CompressedBits;
|
|
|
|
BYTE *temp;
|
|
|
|
while (y >= 0)
|
|
|
|
{
|
|
|
|
length = *bits++;
|
|
|
|
if (length)
|
|
|
|
{
|
|
|
|
c = *bits++;
|
|
|
|
while (length--)
|
|
|
|
{
|
|
|
|
if (x >= width) break;
|
|
|
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
|
|
|
x++;
|
|
|
|
*temp = c;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
length = *bits++;
|
|
|
|
switch (length)
|
|
|
|
{
|
|
|
|
case RLE_EOL:
|
|
|
|
x = 0;
|
|
|
|
y--;
|
|
|
|
break;
|
|
|
|
case RLE_END:
|
|
|
|
return;
|
|
|
|
case RLE_DELTA:
|
|
|
|
x += *bits++;
|
|
|
|
y -= *bits++;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
while (length--)
|
|
|
|
{
|
|
|
|
c = *bits++;
|
|
|
|
if (x < width)
|
|
|
|
{
|
|
|
|
temp = UncompressedBits + (((height - y) * Delta) + x);
|
|
|
|
x++;
|
|
|
|
*temp = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((bits - begin) & 1)
|
|
|
|
bits++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
HBITMAP FASTCALL
|
|
|
|
IntCreateBitmap(IN SIZEL Size,
|
2002-06-15 21:44:08 +00:00
|
|
|
IN LONG Width,
|
|
|
|
IN ULONG Format,
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN PVOID Bits)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
HBITMAP NewBitmap;
|
|
|
|
SURFOBJ *SurfObj;
|
2004-07-03 13:55:37 +00:00
|
|
|
BITMAPOBJ *BitmapObj;
|
2003-11-18 18:05:40 +00:00
|
|
|
PVOID UncompressedBits;
|
|
|
|
ULONG UncompressedFormat;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2004-07-07 16:33:44 +00:00
|
|
|
if (Format == 0)
|
|
|
|
return 0;
|
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
NewBitmap = BITMAPOBJ_AllocBitmap();
|
|
|
|
if (NewBitmap == NULL)
|
2002-08-04 09:55:11 +00:00
|
|
|
return 0;
|
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
BitmapObj = BITMAPOBJ_LockBitmap(NewBitmap);
|
|
|
|
SurfObj = &BitmapObj->SurfObj;
|
|
|
|
|
2004-06-23 07:31:22 +00:00
|
|
|
if (Format == BMF_4RLE)
|
|
|
|
{
|
|
|
|
SurfObj->lDelta = DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BMF_4BPP));
|
|
|
|
SurfObj->cjBits = SurfObj->lDelta * Size.cy;
|
|
|
|
UncompressedFormat = BMF_4BPP;
|
2003-11-18 18:05:40 +00:00
|
|
|
UncompressedBits = EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, 0);
|
2004-06-23 07:31:22 +00:00
|
|
|
Decompress4bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfObj->lDelta);
|
|
|
|
}
|
|
|
|
else if (Format == BMF_8RLE)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2004-06-23 07:31:22 +00:00
|
|
|
SurfObj->lDelta = DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BMF_8BPP));
|
|
|
|
SurfObj->cjBits = SurfObj->lDelta * Size.cy;
|
|
|
|
UncompressedFormat = BMF_8BPP;
|
|
|
|
UncompressedBits = EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, 0);
|
|
|
|
Decompress8bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfObj->lDelta);
|
2004-02-14 22:24:54 +00:00
|
|
|
}
|
2004-06-23 07:31:22 +00:00
|
|
|
else
|
2004-02-14 22:24:54 +00:00
|
|
|
{
|
2004-07-03 13:55:37 +00:00
|
|
|
SurfObj->lDelta = abs(Width);
|
|
|
|
SurfObj->cjBits = SurfObj->lDelta * Size.cy;
|
2004-06-23 07:31:22 +00:00
|
|
|
UncompressedBits = Bits;
|
|
|
|
UncompressedFormat = Format;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UncompressedBits != NULL)
|
|
|
|
{
|
|
|
|
SurfObj->pvBits = UncompressedBits;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (SurfObj->cjBits == 0)
|
2004-02-14 22:24:54 +00:00
|
|
|
{
|
2004-06-23 07:31:22 +00:00
|
|
|
SurfObj->pvBits = NULL;
|
2004-02-14 22:24:54 +00:00
|
|
|
}
|
2004-06-23 07:31:22 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (0 != (Flags & BMF_USERMEM))
|
|
|
|
{
|
|
|
|
SurfObj->pvBits = EngAllocUserMem(SurfObj->cjBits, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SurfObj->pvBits = EngAllocMem(0 != (Flags & BMF_NOZEROINIT) ? 0 : FL_ZERO_MEMORY,
|
|
|
|
SurfObj->cjBits, 0);
|
2004-07-07 16:33:44 +00:00
|
|
|
}
|
|
|
|
if (SurfObj->pvBits == NULL)
|
|
|
|
{
|
|
|
|
BITMAPOBJ_UnlockBitmap(NewBitmap);
|
|
|
|
BITMAPOBJ_FreeBitmap(NewBitmap);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 07:31:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (0 == (Flags & BMF_TOPDOWN))
|
|
|
|
{
|
2004-07-03 13:55:37 +00:00
|
|
|
SurfObj->pvScan0 = (PVOID) ((ULONG_PTR) SurfObj->pvBits + SurfObj->cjBits - SurfObj->lDelta);
|
2004-06-23 07:31:22 +00:00
|
|
|
SurfObj->lDelta = - SurfObj->lDelta;
|
2001-03-31 15:35:08 +00:00
|
|
|
}
|
2004-07-03 13:55:37 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
SurfObj->pvScan0 = SurfObj->pvBits;
|
|
|
|
}
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2004-06-23 07:31:22 +00:00
|
|
|
SurfObj->dhsurf = 0; /* device managed surface */
|
2004-07-03 13:55:37 +00:00
|
|
|
SurfObj->hsurf = (HSURF)NewBitmap;
|
2004-03-17 16:05:29 +00:00
|
|
|
SurfObj->dhpdev = NULL;
|
|
|
|
SurfObj->hdev = NULL;
|
2001-03-31 15:35:08 +00:00
|
|
|
SurfObj->sizlBitmap = Size;
|
2003-11-18 18:05:40 +00:00
|
|
|
SurfObj->iBitmapFormat = UncompressedFormat;
|
2001-03-31 15:35:08 +00:00
|
|
|
SurfObj->iType = STYPE_BITMAP;
|
2003-03-11 00:21:41 +00:00
|
|
|
SurfObj->fjBitmap = Flags & (BMF_TOPDOWN | BMF_NOZEROINIT);
|
2004-03-17 16:05:29 +00:00
|
|
|
SurfObj->iUniq = 0;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
BitmapObj->flHooks = 0;
|
|
|
|
BitmapObj->flFlags = 0;
|
|
|
|
BitmapObj->dimension.cx = 0;
|
|
|
|
BitmapObj->dimension.cy = 0;
|
|
|
|
BitmapObj->dib = NULL;
|
2003-03-04 10:09:01 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
BITMAPOBJ_UnlockBitmap(NewBitmap);
|
|
|
|
|
|
|
|
return NewBitmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
HBITMAP STDCALL
|
|
|
|
EngCreateBitmap(IN SIZEL Size,
|
|
|
|
IN LONG Width,
|
|
|
|
IN ULONG Format,
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN PVOID Bits)
|
|
|
|
{
|
|
|
|
HBITMAP NewBitmap;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
NewBitmap = IntCreateBitmap(Size, Width, Format, Flags, Bits);
|
2004-12-18 17:12:32 +00:00
|
|
|
if ( !NewBitmap )
|
|
|
|
return 0;
|
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
GDIOBJ_SetOwnership(NewBitmap, NULL);
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return NewBitmap;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
HSURF STDCALL
|
|
|
|
EngCreateDeviceSurface(IN DHSURF dhsurf,
|
|
|
|
IN SIZEL Size,
|
|
|
|
IN ULONG Format)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2004-07-03 13:55:37 +00:00
|
|
|
HSURF NewSurface;
|
2001-03-31 15:35:08 +00:00
|
|
|
SURFOBJ *SurfObj;
|
2004-07-03 13:55:37 +00:00
|
|
|
BITMAPOBJ *BitmapObj;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
NewSurface = (HSURF)BITMAPOBJ_AllocBitmap();
|
|
|
|
if (NewSurface == NULL)
|
2002-08-04 09:55:11 +00:00
|
|
|
return 0;
|
1999-08-01 11:21:05 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
GDIOBJ_SetOwnership(NewSurface, NULL);
|
|
|
|
|
|
|
|
BitmapObj = BITMAPOBJ_LockBitmap(NewSurface);
|
|
|
|
SurfObj = &BitmapObj->SurfObj;
|
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
SurfObj->dhsurf = dhsurf;
|
2004-07-03 13:55:37 +00:00
|
|
|
SurfObj->hsurf = NewSurface;
|
2001-03-31 15:35:08 +00:00
|
|
|
SurfObj->sizlBitmap = Size;
|
|
|
|
SurfObj->iBitmapFormat = Format;
|
|
|
|
SurfObj->lDelta = DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format));
|
|
|
|
SurfObj->iType = STYPE_DEVICE;
|
2004-03-17 16:05:29 +00:00
|
|
|
SurfObj->iUniq = 0;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
BitmapObj->flHooks = 0;
|
|
|
|
|
|
|
|
BITMAPOBJ_UnlockBitmap(NewSurface);
|
2003-03-04 10:09:01 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return NewSurface;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
PFN FASTCALL DriverFunction(DRVENABLEDATA *DED, ULONG DriverFunc)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
for(i=0; i<DED->c; i++)
|
|
|
|
{
|
|
|
|
if(DED->pdrvfn[i].iFunc == DriverFunc)
|
|
|
|
return DED->pdrvfn[i].pfn;
|
|
|
|
}
|
|
|
|
return NULL;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
EngAssociateSurface(IN HSURF Surface,
|
|
|
|
IN HDEV Dev,
|
|
|
|
IN ULONG Hooks)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
2001-03-31 15:35:08 +00:00
|
|
|
SURFOBJ *SurfObj;
|
2004-07-03 13:55:37 +00:00
|
|
|
BITMAPOBJ *BitmapObj;
|
2002-09-18 23:56:48 +00:00
|
|
|
GDIDEVICE* Device;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2002-09-18 23:56:48 +00:00
|
|
|
Device = (GDIDEVICE*)Dev;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
BitmapObj = BITMAPOBJ_LockBitmap(Surface);
|
|
|
|
ASSERT(BitmapObj);
|
|
|
|
SurfObj = &BitmapObj->SurfObj;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
/* Associate the hdev */
|
2001-03-31 15:35:08 +00:00
|
|
|
SurfObj->hdev = Dev;
|
2004-03-17 16:05:29 +00:00
|
|
|
SurfObj->dhpdev = Device->PDev;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2004-07-03 13:55:37 +00:00
|
|
|
/* Hook up specified functions */
|
|
|
|
BitmapObj->flHooks = Hooks;
|
|
|
|
|
|
|
|
BITMAPOBJ_UnlockBitmap(Surface);
|
2004-01-16 19:32:00 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
return TRUE;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
|
|
|
|
2004-03-06 01:22:04 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL STDCALL
|
|
|
|
EngModifySurface(
|
|
|
|
IN HSURF hsurf,
|
|
|
|
IN HDEV hdev,
|
|
|
|
IN FLONG flHooks,
|
|
|
|
IN FLONG flSurface,
|
|
|
|
IN DHSURF dhsurf,
|
|
|
|
OUT VOID *pvScan0,
|
|
|
|
IN LONG lDelta,
|
|
|
|
IN VOID *pvReserved)
|
|
|
|
{
|
|
|
|
SURFOBJ *pso;
|
|
|
|
|
|
|
|
pso = EngLockSurface(hsurf);
|
|
|
|
if (pso == NULL)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!EngAssociateSurface(hsurf, hdev, flHooks))
|
|
|
|
{
|
2004-03-20 17:33:10 +00:00
|
|
|
EngUnlockSurface(pso);
|
|
|
|
|
2004-03-06 01:22:04 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pso->dhsurf = dhsurf;
|
|
|
|
pso->lDelta = lDelta;
|
|
|
|
pso->pvScan0 = pvScan0;
|
|
|
|
|
|
|
|
EngUnlockSurface(pso);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
EngDeleteSurface(IN HSURF Surface)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
2004-07-03 13:55:37 +00:00
|
|
|
GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess());
|
|
|
|
BITMAPOBJ_FreeBitmap(Surface);
|
|
|
|
return TRUE;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
EngEraseSurface(SURFOBJ *Surface,
|
|
|
|
RECTL *Rect,
|
|
|
|
ULONG iColor)
|
|
|
|
{
|
2004-12-14 04:55:43 +00:00
|
|
|
ASSERT(Surface);
|
|
|
|
ASSERT(Rect);
|
2002-06-15 21:44:08 +00:00
|
|
|
return FillSolid(Surface, Rect, iColor);
|
|
|
|
}
|
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
2004-07-03 13:55:37 +00:00
|
|
|
* @implemented
|
2003-07-11 15:59:37 +00:00
|
|
|
*/
|
2002-06-15 21:44:08 +00:00
|
|
|
SURFOBJ * STDCALL
|
|
|
|
EngLockSurface(IN HSURF Surface)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2004-12-12 01:40:39 +00:00
|
|
|
BITMAPOBJ *bmp = (BITMAPOBJ*)BITMAPOBJ_LockBitmap(Surface);
|
|
|
|
if(bmp != NULL)
|
|
|
|
{
|
|
|
|
return &bmp->SurfObj;
|
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2004-12-12 01:40:39 +00:00
|
|
|
return NULL;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
2003-02-15 19:16:34 +00:00
|
|
|
|
2003-07-11 15:59:37 +00:00
|
|
|
/*
|
2004-07-03 13:55:37 +00:00
|
|
|
* @implemented
|
2003-07-11 15:59:37 +00:00
|
|
|
*/
|
2003-02-15 19:16:34 +00:00
|
|
|
VOID STDCALL
|
|
|
|
EngUnlockSurface(IN SURFOBJ *Surface)
|
|
|
|
{
|
2004-12-12 01:40:39 +00:00
|
|
|
ASSERT (Surface);
|
|
|
|
BITMAPOBJ_UnlockBitmap (Surface->hsurf);
|
2003-02-15 19:16:34 +00:00
|
|
|
}
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|