Author: tkreuzer
Date: Wed Mar 19 09:53:15 2008
New Revision: 32723
URL:
http://svn.reactos.org/svn/reactos?rev=3D32723&view=3Drev
Log:
[FORMATTING] Apply consistent indentation of 4 spaces
Modified:
trunk/reactos/subsystems/win32/win32k/eng/surface.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3=
2k/eng/surface.c?rev=3D32723&r1=3D32722&r2=3D32723&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/subsystems/win32/win32k/eng/surface.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/surface.c Wed Mar 19 09:53:15=
2008
@@ -38,74 +38,100 @@
=
enum Rle_EscapeCodes
{
- RLE_EOL =3D 0, /* End of line */
- RLE_END =3D 1, /* End of bitmap */
- RLE_DELTA =3D 2 /* Delta */
+ RLE_EOL =3D 0, /* End of line */
+ RLE_END =3D 1, /* End of bitmap */
+ RLE_DELTA =3D 2 /* Delta */
};
=
INT FASTCALL BitsPerFormat(ULONG Format)
{
- 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;
- }
+ switch (Format)
+ {
+ case BMF_1BPP:
+ return 1;
+
+ case BMF_4BPP:
+ /* Fall through */
+ case BMF_4RLE:
+ return 4;
+
+ case BMF_8BPP:
+ /* Fall through */
+ case BMF_8RLE:
+ return 8;
+
+ case BMF_16BPP:
+ return 16;
+
+ case BMF_24BPP:
+ return 24;
+
+ case BMF_32BPP:
+ return 32;
+
+ default:
+ return 0;
+ }
}
=
ULONG FASTCALL BitmapFormat(WORD Bits, DWORD Compression)
{
- switch(Compression)
- {
- case BI_RGB:
- case BI_BITFIELDS:
- 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;
- }
- return 0;
-
- case BI_RLE4: return BMF_4RLE;
- case BI_RLE8: return BMF_8RLE;
-
- default: return 0;
- }
+ switch (Compression)
+ {
+ case BI_RGB:
+ /* Fall through */
+ case BI_BITFIELDS:
+ 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;
+ }
+ return 0;
+
+ case BI_RLE4:
+ return BMF_4RLE;
+
+ case BI_RLE8:
+ return BMF_8RLE;
+
+ default:
+ return 0;
+ }
}
=
BOOL INTERNAL_CALL
BITMAPOBJ_InitBitsLock(BITMAPOBJ *BitmapObj)
{
- BitmapObj->BitsLock =3D ExAllocatePoolWithTag(NonPagedPool,
- sizeof(FAST_MUTEX),
- TAG_BITMAPOBJ);
- if (NULL =3D=3D BitmapObj->BitsLock)
- {
- return FALSE;
- }
-
- ExInitializeFastMutex(BitmapObj->BitsLock);
-
- return TRUE;
+ BitmapObj->BitsLock =3D ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(FAST_MUTEX),
+ TAG_BITMAPOBJ);
+ if (NULL =3D=3D BitmapObj->BitsLock)
+ {
+ return FALSE;
+ }
+
+ ExInitializeFastMutex(BitmapObj->BitsLock);
+
+ return TRUE;
}
=
void INTERNAL_CALL
BITMAPOBJ_CleanupBitsLock(BITMAPOBJ *BitmapObj)
{
- if (NULL !=3D BitmapObj->BitsLock)
- {
- ExFreePoolWithTag(BitmapObj->BitsLock, TAG_BITMAPOBJ);
- BitmapObj->BitsLock =3D NULL;
+ if (NULL !=3D BitmapObj->BitsLock)
+ {
+ ExFreePoolWithTag(BitmapObj->BitsLock, TAG_BITMAPOBJ);
+ BitmapObj->BitsLock =3D NULL;
}
}
=
@@ -115,252 +141,260 @@
*/
HBITMAP STDCALL
EngCreateDeviceBitmap(IN DHSURF dhsurf,
- IN SIZEL Size,
- IN ULONG Format)
-{
- HBITMAP NewBitmap;
- SURFOBJ *SurfObj;
-
- NewBitmap =3D EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, BitsPe=
rFormat(Format)), Format, 0, NULL);
- if(!NewBitmap)
- {
- DPRINT1("EngCreateBitmap failed\n");
- return 0;
- }
-
- SurfObj =3D EngLockSurface((HSURF)NewBitmap);
- SurfObj->dhsurf =3D dhsurf;
- EngUnlockSurface(SurfObj);
-
- return NewBitmap;
+ IN SIZEL Size,
+ IN ULONG Format)
+{
+ HBITMAP NewBitmap;
+ SURFOBJ *SurfObj;
+
+ NewBitmap =3D EngCreateBitmap(Size, DIB_GetDIBWidthBytes(Size.cx, Bits=
PerFormat(Format)), Format, 0, NULL);
+ if (!NewBitmap)
+ {
+ DPRINT1("EngCreateBitmap failed\n");
+ return 0;
+ }
+
+ SurfObj =3D EngLockSurface((HSURF)NewBitmap);
+ SurfObj->dhsurf =3D dhsurf;
+ EngUnlockSurface(SurfObj);
+
+ return NewBitmap;
}
=
VOID Decompress4bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBi=
ts, LONG Delta)
{
- int x =3D 0;
- int y =3D Size.cy - 1;
- int c;
- int length;
- int width =3D ((Size.cx+1)/2);
- int height =3D Size.cy - 1;
- BYTE *begin =3D CompressedBits;
- BYTE *bits =3D CompressedBits;
- BYTE *temp;
- while (y >=3D 0)
- {
- length =3D *bits++ / 2;
- if (length)
- {
- c =3D *bits++;
- while (length--)
- {
- if (x >=3D width) break;
- temp =3D UncompressedBits + (((height - y) * Delta) + x);
- x++;
- *temp =3D c;
- }
- } else {
- length =3D *bits++;
- switch (length)
- {
- case RLE_EOL:
- x =3D 0;
- y--;
- break;
- case RLE_END:
- return;
- case RLE_DELTA:
- x +=3D (*bits++)/2;
- y -=3D (*bits++)/2;
- break;
- default:
- length /=3D 2;
- while (length--)
- {
- c =3D *bits++;
- if (x < width)
- {
- temp =3D UncompressedBits + (((height - y) * Delta) + x);
- x++;
- *temp =3D c;
- }
- }
- if ((bits - begin) & 1)
- bits++;
- }
- }
- }
+ int x =3D 0;
+ int y =3D Size.cy - 1;
+ int c;
+ int length;
+ int width =3D ((Size.cx+1)/2);
+ int height =3D Size.cy - 1;
+ BYTE *begin =3D CompressedBits;
+ BYTE *bits =3D CompressedBits;
+ BYTE *temp;
+ while (y >=3D 0)
+ {
+ length =3D *bits++ / 2;
+ if (length)
+ {
+ c =3D *bits++;
+ while (length--)
+ {
+ if (x >=3D width) break;
+ temp =3D UncompressedBits + (((height - y) * Delta) + x);
+ x++;
+ *temp =3D c;
+ }
+ }
+ else
+ {
+ length =3D *bits++;
+ switch (length)
+ {
+ case RLE_EOL:
+ x =3D 0;
+ y--;
+ break;
+ case RLE_END:
+ return;
+ case RLE_DELTA:
+ x +=3D (*bits++)/2;
+ y -=3D (*bits++)/2;
+ break;
+ default:
+ length /=3D 2;
+ while (length--)
+ {
+ c =3D *bits++;
+ if (x < width)
+ {
+ temp =3D UncompressedBits + (((height - y) * D=
elta) + x);
+ x++;
+ *temp =3D c;
+ }
+ }
+ if ((bits - begin) & 1)
+ {
+ bits++;
+ }
+ }
+ }
+ }
}
=
VOID Decompress8bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBi=
ts, LONG Delta)
{
- int x =3D 0;
- int y =3D Size.cy - 1;
- int c;
- int length;
- int width =3D Size.cx;
- int height =3D Size.cy - 1;
- BYTE *begin =3D CompressedBits;
- BYTE *bits =3D CompressedBits;
- BYTE *temp;
- while (y >=3D 0)
- {
- length =3D *bits++;
- if (length)
- {
- c =3D *bits++;
- while (length--)
- {
- if (x >=3D width) break;
- temp =3D UncompressedBits + (((height - y) * Delta) + x);
- x++;
- *temp =3D c;
- }
- } else {
- length =3D *bits++;
- switch (length)
- {
- case RLE_EOL:
- x =3D 0;
- y--;
- break;
- case RLE_END:
- return;
- case RLE_DELTA:
- x +=3D *bits++;
- y -=3D *bits++;
- break;
- default:
- while (length--)
- {
- c =3D *bits++;
- if (x < width)
- {
- temp =3D UncompressedBits + (((height - y) * Delta) + x);
- x++;
- *temp =3D c;
- }
- }
- if ((bits - begin) & 1)
- bits++;
- }
- }
- }
+ int x =3D 0;
+ int y =3D Size.cy - 1;
+ int c;
+ int length;
+ int width =3D Size.cx;
+ int height =3D Size.cy - 1;
+ BYTE *begin =3D CompressedBits;
+ BYTE *bits =3D CompressedBits;
+ BYTE *temp;
+ while (y >=3D 0)
+ {
+ length =3D *bits++;
+ if (length)
+ {
+ c =3D *bits++;
+ while (length--)
+ {
+ if (x >=3D width) break;
+ temp =3D UncompressedBits + (((height - y) * Delta) + x);
+ x++;
+ *temp =3D c;
+ }
+ }
+ else
+ {
+ length =3D *bits++;
+ switch (length)
+ {
+ case RLE_EOL:
+ x =3D 0;
+ y--;
+ break;
+ case RLE_END:
+ return;
+ case RLE_DELTA:
+ x +=3D *bits++;
+ y -=3D *bits++;
+ break;
+ default:
+ while (length--)
+ {
+ c =3D *bits++;
+ if (x < width)
+ {
+ temp =3D UncompressedBits + (((height - y) * D=
elta) + x);
+ x++;
+ *temp =3D c;
+ }
+ }
+ if ((bits - begin) & 1)
+ {
+ bits++;
+ }
+ }
+ }
+ }
}
=
HBITMAP FASTCALL
IntCreateBitmap(IN SIZEL Size,
- IN LONG Width,
- IN ULONG Format,
- IN ULONG Flags,
- IN PVOID Bits)
-{
- HBITMAP NewBitmap;
- SURFOBJ *SurfObj;
- BITMAPOBJ *BitmapObj;
- PVOID UncompressedBits;
- ULONG UncompressedFormat;
-
- if (Format =3D=3D 0)
- return 0;
-
- NewBitmap =3D BITMAPOBJ_AllocBitmapDepricated();
- if (NewBitmap =3D=3D NULL)
- return 0;
-
- BitmapObj =3D BITMAPOBJ_LockBitmap(NewBitmap);
- if (! BITMAPOBJ_InitBitsLock(BitmapObj))
- {
- BITMAPOBJ_UnlockBitmap(BitmapObj);
- BITMAPOBJ_FreeBitmapByHandle(NewBitmap);
- return 0;
- }
- SurfObj =3D &BitmapObj->SurfObj;
-
- if (Format =3D=3D BMF_4RLE)
- {
- SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BMF_=
4BPP));
- SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
- UncompressedFormat =3D BMF_4BPP;
- UncompressedBits =3D EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, 0);
- Decompress4bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfObj=
->lDelta);
- }
- else if (Format =3D=3D BMF_8RLE)
- {
- SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BMF_=
8BPP));
- SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
- UncompressedFormat =3D BMF_8BPP;
- UncompressedBits =3D EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, 0);
- Decompress8bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfObj=
->lDelta);
- }
- else
- {
- SurfObj->lDelta =3D abs(Width);
- SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
- UncompressedBits =3D Bits;
- UncompressedFormat =3D Format;
- }
-
- if (UncompressedBits !=3D NULL)
- {
- SurfObj->pvBits =3D UncompressedBits;
- }
- else
- {
- if (SurfObj->cjBits =3D=3D 0)
+ IN LONG Width,
+ IN ULONG Format,
+ IN ULONG Flags,
+ IN PVOID Bits)
+{
+ HBITMAP NewBitmap;
+ SURFOBJ *SurfObj;
+ BITMAPOBJ *BitmapObj;
+ PVOID UncompressedBits;
+ ULONG UncompressedFormat;
+
+ if (Format =3D=3D 0)
+ return 0;
+
+ NewBitmap =3D BITMAPOBJ_AllocBitmapDepricated();
+ if (NewBitmap =3D=3D NULL)
+ return 0;
+
+ BitmapObj =3D BITMAPOBJ_LockBitmap(NewBitmap);
+ if (! BITMAPOBJ_InitBitsLock(BitmapObj))
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ BITMAPOBJ_FreeBitmapByHandle(NewBitmap);
+ return 0;
+ }
+ SurfObj =3D &BitmapObj->SurfObj;
+
+ if (Format =3D=3D BMF_4RLE)
+ {
+ SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BM=
F_4BPP));
+ SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
+ UncompressedFormat =3D BMF_4BPP;
+ UncompressedBits =3D EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, =
0);
+ Decompress4bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfO=
bj->lDelta);
+ }
+ else if (Format =3D=3D BMF_8RLE)
+ {
+ SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(BM=
F_8BPP));
+ SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
+ UncompressedFormat =3D BMF_8BPP;
+ UncompressedBits =3D EngAllocMem(FL_ZERO_MEMORY, SurfObj->cjBits, =
0);
+ Decompress8bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, SurfO=
bj->lDelta);
+ }
+ else
+ {
+ SurfObj->lDelta =3D abs(Width);
+ SurfObj->cjBits =3D SurfObj->lDelta * Size.cy;
+ UncompressedBits =3D Bits;
+ UncompressedFormat =3D Format;
+ }
+
+ if (UncompressedBits !=3D NULL)
+ {
+ SurfObj->pvBits =3D UncompressedBits;
+ }
+ else
+ {
+ if (SurfObj->cjBits =3D=3D 0)
{
- SurfObj->pvBits =3D NULL;
+ SurfObj->pvBits =3D NULL;
}
- else
+ else
{
- if (0 !=3D (Flags & BMF_USERMEM))
- {
- SurfObj->pvBits =3D EngAllocUserMem(SurfObj->cjBits, 0);
- }
- else
- {
- SurfObj->pvBits =3D EngAllocMem(0 !=3D (Flags & BMF_NOZEROIN=
IT) ? 0 : FL_ZERO_MEMORY,
- SurfObj->cjBits, 0);
- }
- if (SurfObj->pvBits =3D=3D NULL)
- {
- BITMAPOBJ_UnlockBitmap(BitmapObj);
- BITMAPOBJ_FreeBitmapByHandle(NewBitmap);
- return 0;
+ if (0 !=3D (Flags & BMF_USERMEM))
+ {
+ SurfObj->pvBits =3D EngAllocUserMem(SurfObj->cjBits, 0);
+ }
+ else
+ {
+ SurfObj->pvBits =3D EngAllocMem(0 !=3D (Flags & BMF_NOZERO=
INIT) ?
+ 0 : FL_ZERO_MEMORY,
+ SurfObj->cjBits, 0);
+ }
+ if (SurfObj->pvBits =3D=3D NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ BITMAPOBJ_FreeBitmapByHandle(NewBitmap);
+ return 0;
}
}
- }
-
-
- if (0 =3D=3D (Flags & BMF_TOPDOWN))
- {
- SurfObj->pvScan0 =3D (PVOID) ((ULONG_PTR) SurfObj->pvBits + SurfObj-=
cjBits - SurfObj->lDelta);
-
SurfObj->lDelta =3D - SurfObj->lDelta;
- }
- else
- {
- SurfObj->pvScan0 =3D SurfObj->pvBits;
- }
-
- SurfObj->dhsurf =3D 0; /* device managed surface */
- SurfObj->hsurf =3D (HSURF)NewBitmap;
- SurfObj->dhpdev =3D NULL;
- SurfObj->hdev =3D NULL;
- SurfObj->sizlBitmap =3D Size;
- SurfObj->iBitmapFormat =3D UncompressedFormat;
- SurfObj->iType =3D STYPE_BITMAP;
- SurfObj->fjBitmap =3D Flags & (BMF_TOPDOWN | BMF_NOZEROINIT);
- SurfObj->iUniq =3D 0;
-
- BitmapObj->flHooks =3D 0;
- BitmapObj->flFlags =3D 0;
- BitmapObj->dimension.cx =3D 0;
- BitmapObj->dimension.cy =3D 0;
- BitmapObj->dib =3D NULL;
-
- BITMAPOBJ_UnlockBitmap(BitmapObj);
-
- return NewBitmap;
+ }
+
+ if (0 =3D=3D (Flags & BMF_TOPDOWN))
+ {
+ SurfObj->pvScan0 =3D (PVOID) ((ULONG_PTR) SurfObj->pvBits + SurfOb=
j-
cjBits - SurfObj->lDelta);
+
SurfObj->lDelta =3D - SurfObj->lDelta;
+ }
+ else
+ {
+ SurfObj->pvScan0 =3D SurfObj->pvBits;
+ }
+
+ SurfObj->dhsurf =3D 0; /* device managed surface */
+ SurfObj->hsurf =3D (HSURF)NewBitmap;
+ SurfObj->dhpdev =3D NULL;
+ SurfObj->hdev =3D NULL;
+ SurfObj->sizlBitmap =3D Size;
+ SurfObj->iBitmapFormat =3D UncompressedFormat;
+ SurfObj->iType =3D STYPE_BITMAP;
+ SurfObj->fjBitmap =3D Flags & (BMF_TOPDOWN | BMF_NOZEROINIT);
+ SurfObj->iUniq =3D 0;
+
+ BitmapObj->flHooks =3D 0;
+ BitmapObj->flFlags =3D 0;
+ BitmapObj->dimension.cx =3D 0;
+ BitmapObj->dimension.cy =3D 0;
+ BitmapObj->dib =3D NULL;
+
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+
+ return NewBitmap;
}
=
/*
@@ -368,20 +402,20 @@
*/
HBITMAP STDCALL
EngCreateBitmap(IN SIZEL Size,
- IN LONG Width,
- IN ULONG Format,
- IN ULONG Flags,
- IN PVOID Bits)
-{
- HBITMAP NewBitmap;
-
- NewBitmap =3D IntCreateBitmap(Size, Width, Format, Flags, Bits);
- if ( !NewBitmap )
- return 0;
-
- GDIOBJ_SetOwnership(NewBitmap, NULL);
-
- return NewBitmap;
+ IN LONG Width,
+ IN ULONG Format,
+ IN ULONG Flags,
+ IN PVOID Bits)
+{
+ HBITMAP NewBitmap;
+
+ NewBitmap =3D IntCreateBitmap(Size, Width, Format, Flags, Bits);
+ if ( !NewBitmap )
+ return 0;
+
+ GDIOBJ_SetOwnership(NewBitmap, NULL);
+
+ return NewBitmap;
}
=
/*
@@ -389,53 +423,55 @@
*/
HSURF STDCALL
EngCreateDeviceSurface(IN DHSURF dhsurf,
- IN SIZEL Size,
- IN ULONG Format)
-{
- HSURF NewSurface;
- SURFOBJ *SurfObj;
- BITMAPOBJ *BitmapObj;
-
- NewSurface =3D (HSURF)BITMAPOBJ_AllocBitmapDepricated();
- if (NewSurface =3D=3D NULL)
- return 0;
-
- GDIOBJ_SetOwnership(NewSurface, NULL);
-
- BitmapObj =3D BITMAPOBJ_LockBitmap(NewSurface);
- if (! BITMAPOBJ_InitBitsLock(BitmapObj))
- {
- BITMAPOBJ_UnlockBitmap(BitmapObj);
- BITMAPOBJ_FreeBitmapByHandle(NewSurface);
- return 0;
- }
- SurfObj =3D &BitmapObj->SurfObj;
-
- SurfObj->dhsurf =3D dhsurf;
- SurfObj->hsurf =3D NewSurface;
- SurfObj->sizlBitmap =3D Size;
- SurfObj->iBitmapFormat =3D Format;
- SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format));
- SurfObj->iType =3D STYPE_DEVICE;
- SurfObj->iUniq =3D 0;
-
- BitmapObj->flHooks =3D 0;
-
- BITMAPOBJ_UnlockBitmap(BitmapObj);
-
- return NewSurface;
+ IN SIZEL Size,
+ IN ULONG Format)
+{
+ HSURF NewSurface;
+ SURFOBJ *SurfObj;
+ BITMAPOBJ *BitmapObj;
+
+ NewSurface =3D (HSURF)BITMAPOBJ_AllocBitmapDepricated();
+ if (NewSurface =3D=3D NULL)
+ return 0;
+
+ GDIOBJ_SetOwnership(NewSurface, NULL);
+
+ BitmapObj =3D BITMAPOBJ_LockBitmap(NewSurface);
+ if (! BITMAPOBJ_InitBitsLock(BitmapObj))
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ BITMAPOBJ_FreeBitmapByHandle(NewSurface);
+ return 0;
+ }
+ SurfObj =3D &BitmapObj->SurfObj;
+
+ SurfObj->dhsurf =3D dhsurf;
+ SurfObj->hsurf =3D NewSurface;
+ SurfObj->sizlBitmap =3D Size;
+ SurfObj->iBitmapFormat =3D Format;
+ SurfObj->lDelta =3D DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format=
));
+ SurfObj->iType =3D STYPE_DEVICE;
+ SurfObj->iUniq =3D 0;
+
+ BitmapObj->flHooks =3D 0;
+
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+
+ return NewSurface;
}
=
PFN FASTCALL DriverFunction(DRVENABLEDATA *DED, ULONG DriverFunc)
{
- ULONG i;
-
- for(i=3D0; i<DED->c; i++)
- {
- if(DED->pdrvfn[i].iFunc =3D=3D DriverFunc)
- return DED->pdrvfn[i].pfn;
- }
- return NULL;
+ ULONG i;
+
+ for (i=3D0; i<DED->c; i++)
+ {
+ if (DED->pdrvfn[i].iFunc =3D=3D DriverFunc)
+ {
+ return DED->pdrvfn[i].pfn;
+ }
+ }
+ return NULL;
}
=
/*
@@ -443,29 +479,29 @@
*/
BOOL STDCALL
EngAssociateSurface(IN HSURF Surface,
- IN HDEV Dev,
- IN ULONG Hooks)
-{
- SURFOBJ *SurfObj;
- BITMAPOBJ *BitmapObj;
- GDIDEVICE* Device;
-
- Device =3D (GDIDEVICE*)Dev;
-
- BitmapObj =3D BITMAPOBJ_LockBitmap(Surface);
- ASSERT(BitmapObj);
- SurfObj =3D &BitmapObj->SurfObj;
-
- /* Associate the hdev */
- SurfObj->hdev =3D Dev;
- SurfObj->dhpdev =3D Device->hPDev;
-
- /* Hook up specified functions */
- BitmapObj->flHooks =3D Hooks;
-
- BITMAPOBJ_UnlockBitmap(BitmapObj);
-
- return TRUE;
+ IN HDEV Dev,
+ IN ULONG Hooks)
+{
+ SURFOBJ *SurfObj;
+ BITMAPOBJ *BitmapObj;
+ GDIDEVICE* Device;
+
+ Device =3D (GDIDEVICE*)Dev;
+
+ BitmapObj =3D BITMAPOBJ_LockBitmap(Surface);
+ ASSERT(BitmapObj);
+ SurfObj =3D &BitmapObj->SurfObj;
+
+ /* Associate the hdev */
+ SurfObj->hdev =3D Dev;
+ SurfObj->dhpdev =3D Device->hPDev;
+
+ /* Hook up specified functions */
+ BitmapObj->flHooks =3D Hooks;
+
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+
+ return TRUE;
}
=
/*
@@ -473,37 +509,37 @@
*/
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 =3D EngLockSurface(hsurf);
- if (pso =3D=3D NULL)
- {
- return FALSE;
- }
-
- if (!EngAssociateSurface(hsurf, hdev, flHooks))
- {
- EngUnlockSurface(pso);
-
- return FALSE;
- }
-
- pso->dhsurf =3D dhsurf;
- pso->lDelta =3D lDelta;
- pso->pvScan0 =3D pvScan0;
-
- EngUnlockSurface(pso);
-
- return TRUE;
+ 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 =3D EngLockSurface(hsurf);
+ if (pso =3D=3D NULL)
+ {
+ return FALSE;
+ }
+
+ if (!EngAssociateSurface(hsurf, hdev, flHooks))
+ {
+ EngUnlockSurface(pso);
+
+ return FALSE;
+ }
+
+ pso->dhsurf =3D dhsurf;
+ pso->lDelta =3D lDelta;
+ pso->pvScan0 =3D pvScan0;
+
+ EngUnlockSurface(pso);
+
+ return TRUE;
}
=
/*
@@ -512,9 +548,9 @@
BOOL STDCALL
EngDeleteSurface(IN HSURF Surface)
{
- GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess());
- BITMAPOBJ_FreeBitmapByHandle(Surface);
- return TRUE;
+ GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess());
+ BITMAPOBJ_FreeBitmapByHandle(Surface);
+ return TRUE;
}
=
/*
@@ -522,12 +558,12 @@
*/
BOOL STDCALL
EngEraseSurface(SURFOBJ *Surface,
- RECTL *Rect,
- ULONG iColor)
-{
- ASSERT(Surface);
- ASSERT(Rect);
- return FillSolid(Surface, Rect, iColor);
+ RECTL *Rect,
+ ULONG iColor)
+{
+ ASSERT(Surface);
+ ASSERT(Rect);
+ return FillSolid(Surface, Rect, iColor);
}
=
#define GDIBdyToHdr(body) =
\
@@ -550,12 +586,12 @@
SURFOBJ * STDCALL
EngLockSurface(IN HSURF Surface)
{
- BITMAPOBJ *bmp =3D GDIOBJ_ShareLockObj(Surface, GDI_OBJECT_TYPE_BITMAP);
-
- if (bmp !=3D NULL)
- return &bmp->SurfObj;
-
- return NULL;
+ BITMAPOBJ *bmp =3D GDIOBJ_ShareLockObj(Surface, GDI_OBJECT_TYPE_BITMAP=
);
+
+ if (bmp !=3D NULL)
+ return &bmp->SurfObj;
+
+ return NULL;
}
=
=
@@ -574,11 +610,11 @@
VOID STDCALL
EngUnlockSurface(IN SURFOBJ *Surface)
{
- if (Surface !=3D NULL)
- {
- BITMAPOBJ *bmp =3D CONTAINING_RECORD(Surface, BITMAPOBJ, SurfObj);
- GDIOBJ_ShareUnlockObjByPtr((POBJ)bmp);
- }
+ if (Surface !=3D NULL)
+ {
+ BITMAPOBJ *bmp =3D CONTAINING_RECORD(Surface, BITMAPOBJ, SurfObj);
+ GDIOBJ_ShareUnlockObjByPtr((POBJ)bmp);
+ }
}
=
=