mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 04:13:35 +00:00
*** empty log message ***
svn path=/trunk/; revision=608
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Bitmap Functions
|
||||
* FILE: subsys/win32k/eng/bitmap.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
HBITMAP EngCreateDeviceBitmap(DHSURF dhsurf, SIZEL Size, ULONG Format)
|
||||
{
|
||||
BITMAP *btc;
|
||||
ULONG bpp, cplanes;
|
||||
|
||||
if(Format==BMF_1BPP)
|
||||
{
|
||||
bpp=1;
|
||||
cplanes=1;
|
||||
} else
|
||||
if((Format==BMF_4BPP) || (Format==BMF_4RLE))
|
||||
{
|
||||
bpp=4;
|
||||
cplanes=1;
|
||||
} else
|
||||
if((Format==BMF_8BPP) || (Format==BMF_8RLE))
|
||||
{
|
||||
bpp=8;
|
||||
cplanes=1;
|
||||
} else
|
||||
if(Format==BMF_16BPP)
|
||||
{
|
||||
bpp=16;
|
||||
cplanes=2;
|
||||
} else
|
||||
if(Format==BMF_24BPP)
|
||||
{
|
||||
bpp=24;
|
||||
cplanes=3;
|
||||
} else
|
||||
if(Format==BMF_32BPP)
|
||||
{
|
||||
bpp=32;
|
||||
cplanes=4;
|
||||
}
|
||||
|
||||
// Allocate memory for the bitmap structure
|
||||
btc=EngAllocMem(FL_ZERO_MEMORY, sizeof(BITMAP), 0);
|
||||
|
||||
// Assign properties of newly created bitmap
|
||||
btc->bmType = Format;
|
||||
btc->bmWidth = Size.cx;
|
||||
btc->bmHeight = Size.cy;
|
||||
btc->bmWidthBytes = Size.cx * cplanes;
|
||||
btc->bmPlanes = cplanes;
|
||||
btc->bmBitsPixel = bpp;
|
||||
|
||||
// Assume that the value returned from ExAllocatePool is the handle value
|
||||
return btc;
|
||||
}
|
||||
|
||||
|
||||
HBITMAP EngCreateBitmap(IN SIZEL Size,
|
||||
IN LONG Width,
|
||||
IN ULONG Format,
|
||||
IN ULONG Flags,
|
||||
IN PVOID Bits)
|
||||
{
|
||||
BITMAP *btc;
|
||||
ULONG tsize;
|
||||
|
||||
// Create the handle for the bitmap
|
||||
btc = EngCreateDeviceBitmap(NULL, Size, Format);
|
||||
|
||||
// Size of bitmap = total pixels * color planes
|
||||
tsize=Size.cx*Size.cy*btc->bmPlanes;
|
||||
|
||||
// Allocate memory for the bitmap
|
||||
if(Bits!=NULL)
|
||||
{
|
||||
if((Flags & BMF_USERMEM)==0)
|
||||
{
|
||||
if((Flags & BMF_NOZEROINIT)==0)
|
||||
{
|
||||
Bits=EngAllocMem(FL_ZERO_MEMORY, tsize, 0);
|
||||
} else {
|
||||
Bits=EngAllocMem(0, tsize, 0);
|
||||
}
|
||||
} else
|
||||
{
|
||||
Bits=EngAllocUserMem(tsize, 0);
|
||||
}
|
||||
}
|
||||
|
||||
btc->bmBits = Bits;
|
||||
|
||||
// Assume that the value returned from ExAllocatePool is the handle value
|
||||
return btc;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Brush Functions
|
||||
* FILE: subsys/win32k/eng/brush.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
PVOID BRUSHOBJ_pvAllocRbrush(IN PBRUSHOBJ BrushObj,
|
||||
IN ULONG ObjSize)
|
||||
{
|
||||
BrushObj->pvRbrush=EngAllocMem(NULL, ObjSize, 0);
|
||||
}
|
||||
|
||||
PVOID BRUSHOBJ_pvGetRbrush(IN PBRUSHOBJ BrushObj)
|
||||
{
|
||||
return BrushObj->pvRbrush;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Brush Functions
|
||||
* FILE: subsys/win32k/eng/debug.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 11/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
VOID EngDebugPrint(PCHAR StandardPrefix, PCHAR DebugMessage, va_list ap)
|
||||
{
|
||||
DbgPrint(StandardPrefix);
|
||||
DbgPrint(DebugMessage, ap);
|
||||
DbgPrint("\n");
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Device Functions
|
||||
* FILE: subsys/win32k/eng/device.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
DWORD APIENTRY EngDeviceIoControl(
|
||||
HANDLE hDevice,
|
||||
DWORD dwIoControlCode,
|
||||
LPVOID lpInBuffer,
|
||||
DWORD nInBufferSize,
|
||||
LPVOID lpOutBuffer,
|
||||
DWORD nOutBufferSize,
|
||||
DWORD *lpBytesReturned)
|
||||
{
|
||||
PIRP Irp;
|
||||
NTSTATUS Status;
|
||||
KEVENT Event;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
PDEVICE_OBJECT theDevice;
|
||||
|
||||
ObReferenceObjectByHandle(hDevice, GENERIC_ALL, NULL, UserMode,
|
||||
(PVOID *)&theDevice, NULL);
|
||||
|
||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(dwIoControlCode,
|
||||
theDevice,
|
||||
lpInBuffer,
|
||||
nInBufferSize,
|
||||
lpOutBuffer,
|
||||
nOutBufferSize,
|
||||
FALSE,
|
||||
&Event,
|
||||
&Iosb);
|
||||
|
||||
Status = IoCallDriver(theDevice, Irp);
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
(void) KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
|
||||
}
|
||||
|
||||
return (Status);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Enumeration Functions
|
||||
* FILE: subsys/win32k/eng/enum.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
ULONG CLIPOBJ_cEnumStart(IN PCLIPOBJ ClipObj,
|
||||
IN BOOL ShouldDoAll,
|
||||
IN ULONG ClipType,
|
||||
IN ULONG BuildOrder,
|
||||
IN ULONG MaxRects)
|
||||
{
|
||||
// Sets the parameters for enumerating rectables in the given clip region
|
||||
|
||||
ULONG enumCount = 0;
|
||||
ENUMRECTS enumRects;
|
||||
|
||||
// MUCH WORK TO DO HERE
|
||||
|
||||
// Return the number of rectangles enumerated
|
||||
if(enumCount>MaxRects)
|
||||
{
|
||||
enumCount = 0xFFFFFFFF;
|
||||
}
|
||||
return enumCount;
|
||||
}
|
||||
|
||||
BOOL CLIPOBJ_bEnum(IN PCLIPOBJ ClipObj,
|
||||
IN ULONG ObjSize,
|
||||
OUT ULONG *EnumRects)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Memory Management Functions
|
||||
* FILE: subsys/win32k/eng/mem.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 3/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
PVOID EngAllocMem(ULONG Flags, ULONG MemSize, ULONG Tag)
|
||||
{
|
||||
PVOID newMem;
|
||||
|
||||
newMem = ExAllocatePoolWithTag(PagedPool, MemSize, Tag);
|
||||
|
||||
if(Flags == FL_ZERO_MEMORY)
|
||||
{
|
||||
RtlZeroMemory(newMem, MemSize);
|
||||
}
|
||||
|
||||
return newMem;
|
||||
}
|
||||
|
||||
VOID EngFreeMem(PVOID Mem)
|
||||
{
|
||||
ExFreePool(Mem);
|
||||
}
|
||||
|
||||
PVOID EngAllocUserMem(ULONG cj, ULONG tag)
|
||||
{
|
||||
PVOID newMem;
|
||||
|
||||
/* return ZwAllocateVirtualMemory(mycurrentprocess, newMem, 0, cj,
|
||||
MEM_COMMIT, PAGE_READWRITE); */
|
||||
}
|
||||
|
||||
VOID EngFreeUserMem(PVOID pv)
|
||||
{
|
||||
/* ZwFreeVirtualMemory (mycurrentprocess, pv, 0, MEM_DECOMMIT); */
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Bitmap Functions
|
||||
* FILE: subsys/win32k/eng/palette.c
|
||||
* PROGRAMER: Jason Filby
|
||||
* REVISION HISTORY:
|
||||
* 11/7/1999: Created
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
HPALETTE EngCreatePalette(IN ULONG Mode,
|
||||
IN ULONG NumColors,
|
||||
IN PULONG *Colors,
|
||||
IN ULONG Red,
|
||||
IN ULONG Green,
|
||||
IN ULONG Blue)
|
||||
{
|
||||
/* We need to take the colors given to us and generate a nice default color
|
||||
model */
|
||||
|
||||
if(Mode==PAL_INDEXED)
|
||||
{
|
||||
/* For now the ultimate color model is just colors.. */
|
||||
}
|
||||
|
||||
/* FIXME: Add support for other given palette types */
|
||||
|
||||
/* FIXME: Generate a handle for Colors */
|
||||
|
||||
return Colors;
|
||||
}
|
||||
|
||||
BOOL EngDeletePalette(IN HPALETTE hpal)
|
||||
{
|
||||
/* Should actually get the pointer from this handle.. which for now IS
|
||||
the pointer */
|
||||
|
||||
EngFreeMem(hpal);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <ddk/winddi.h>
|
||||
|
||||
BOOL EngAssociateSurface(IN HSURF Surface,
|
||||
IN HDEV Dev,
|
||||
IN ULONG Hooks)
|
||||
{
|
||||
SURFOBJ *Surfobj;
|
||||
|
||||
// Point our new Surfobj to hsurf (assumes hsurf is value returned by
|
||||
// ExAllocatePool)
|
||||
Surfobj = Surface;
|
||||
|
||||
// Associate the hdev
|
||||
Surfobj->hdev = Dev;
|
||||
|
||||
// FIXME: Hook up the specified functions
|
||||
}
|
||||
|
||||
BOOL APIENTRY EngDeleteSurface(HSURF hsurf)
|
||||
{
|
||||
// Assume the hsurf was the value returned by ExAllocatePool
|
||||
ExFreePool(hsurf);
|
||||
}
|
||||
|
||||
SURFOBJ *EngLockSurface(IN HSURF hsurf)
|
||||
{
|
||||
/* We assume that hsurf is the value returned from ExAllocatePool */
|
||||
return EngAllocUserMem(NULL, sizeof(SURFOBJ), "");
|
||||
}
|
||||
|
||||
VOID EngUnlockSurface(IN SURFOBJ *pso)
|
||||
{
|
||||
EngFreeUserMem(sizeof(pso));
|
||||
}
|
||||
Reference in New Issue
Block a user