2008-04-06 23:20:31 +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
|
2015-11-10 17:41:55 +00:00
|
|
|
* FILE: win32ss/gdi/eng/surface.c
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
* PROGRAMERS: Jason Filby
|
|
|
|
* Timo Kreuzer
|
2001-03-31 15:35:08 +00:00
|
|
|
* 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
|
|
|
*/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
1999-08-01 11:21:05 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
LONG giUniqueSurface = 0;
|
2003-11-18 18:05:40 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
UCHAR
|
|
|
|
gajBitsPerFormat[11] =
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
0, /* 0: unused */
|
|
|
|
1, /* 1: BMF_1BPP */
|
|
|
|
4, /* 2: BMF_4BPP */
|
|
|
|
8, /* 3: BMF_8BPP */
|
|
|
|
16, /* 4: BMF_16BPP */
|
|
|
|
24, /* 5: BMF_24BPP */
|
|
|
|
32, /* 6: BMF_32BPP */
|
|
|
|
4, /* 7: BMF_4RLE */
|
|
|
|
8, /* 8: BMF_8RLE */
|
|
|
|
0, /* 9: BMF_JPEG */
|
|
|
|
0, /* 10: BMF_PNG */
|
|
|
|
};
|
2008-03-19 14:53:15 +00:00
|
|
|
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
ULONG
|
|
|
|
FASTCALL
|
|
|
|
BitmapFormat(ULONG cBits, ULONG iCompression)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2011-01-09 18:38:41 +00:00
|
|
|
switch (iCompression)
|
2008-03-19 14:53:15 +00:00
|
|
|
{
|
|
|
|
case BI_RGB:
|
|
|
|
/* Fall through */
|
|
|
|
case BI_BITFIELDS:
|
2011-01-09 18:38:41 +00:00
|
|
|
if (cBits <= 1) return BMF_1BPP;
|
|
|
|
if (cBits <= 4) return BMF_4BPP;
|
|
|
|
if (cBits <= 8) return BMF_8BPP;
|
|
|
|
if (cBits <= 16) return BMF_16BPP;
|
|
|
|
if (cBits <= 24) return BMF_24BPP;
|
|
|
|
if (cBits <= 32) return BMF_32BPP;
|
2008-03-19 14:53:15 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
case BI_RLE4:
|
|
|
|
return BMF_4RLE;
|
|
|
|
|
|
|
|
case BI_RLE8:
|
|
|
|
return BMF_8RLE;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
2014-05-22 11:45:53 +00:00
|
|
|
VOID
|
2011-08-27 12:38:23 +00:00
|
|
|
NTAPI
|
2014-05-22 11:45:53 +00:00
|
|
|
SURFACE_vCleanup(PVOID ObjectBody)
|
2009-01-08 16:33:40 +00:00
|
|
|
{
|
2009-01-09 02:06:39 +00:00
|
|
|
PSURFACE psurf = (PSURFACE)ObjectBody;
|
|
|
|
PVOID pvBits = psurf->SurfObj.pvBits;
|
|
|
|
|
2010-06-06 03:12:56 +00:00
|
|
|
/* Check if the surface has bits */
|
|
|
|
if (pvBits)
|
2009-01-09 02:06:39 +00:00
|
|
|
{
|
2010-06-06 03:12:56 +00:00
|
|
|
/* Only bitmaps can have bits */
|
|
|
|
ASSERT(psurf->SurfObj.iType == STYPE_BITMAP);
|
|
|
|
|
|
|
|
/* Check if it is a DIB section */
|
|
|
|
if (psurf->hDIBSection)
|
2009-01-09 02:06:39 +00:00
|
|
|
{
|
2012-05-07 22:41:10 +00:00
|
|
|
/* Unmap the section view */
|
|
|
|
EngUnmapSectionView(pvBits, psurf->dwOffset, psurf->hSecure);
|
2010-06-06 03:12:56 +00:00
|
|
|
}
|
|
|
|
else if (psurf->SurfObj.fjBitmap & BMF_USERMEM)
|
|
|
|
{
|
|
|
|
/* Bitmap was allocated from usermode memory */
|
|
|
|
EngFreeUserMem(pvBits);
|
|
|
|
}
|
|
|
|
else if (psurf->SurfObj.fjBitmap & BMF_KMSECTION)
|
|
|
|
{
|
|
|
|
/* Bitmap was allocated from a kernel section */
|
|
|
|
if (!EngFreeSectionMem(NULL, pvBits))
|
2009-01-09 02:06:39 +00:00
|
|
|
{
|
2010-06-06 03:12:56 +00:00
|
|
|
DPRINT1("EngFreeSectionMem failed for %p!\n", pvBits);
|
|
|
|
// Should we BugCheck here?
|
|
|
|
ASSERT(FALSE);
|
2009-01-09 02:06:39 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-01 12:14:10 +00:00
|
|
|
else if (psurf->SurfObj.fjBitmap & BMF_POOLALLOC)
|
2010-06-06 03:12:56 +00:00
|
|
|
{
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Free a pool allocation */
|
2012-10-06 20:15:36 +00:00
|
|
|
EngFreeMem(pvBits);
|
2009-01-09 02:06:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-08 22:10:41 +00:00
|
|
|
/* Free palette */
|
|
|
|
if(psurf->ppal)
|
|
|
|
{
|
|
|
|
PALETTE_ShareUnlockPalette(psurf->ppal);
|
|
|
|
}
|
2005-06-20 08:31:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-18 18:05:40 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
PSURFACE
|
|
|
|
NTAPI
|
|
|
|
SURFACE_AllocSurface(
|
2012-05-01 12:14:10 +00:00
|
|
|
_In_ USHORT iType,
|
|
|
|
_In_ ULONG cx,
|
|
|
|
_In_ ULONG cy,
|
|
|
|
_In_ ULONG iFormat,
|
|
|
|
_In_ ULONG fjBitmap,
|
|
|
|
_In_opt_ ULONG cjWidth,
|
2015-03-08 17:25:44 +00:00
|
|
|
_In_opt_ ULONG cjBufSize,
|
2012-05-01 12:14:10 +00:00
|
|
|
_In_opt_ PVOID pvBits)
|
2003-11-18 18:05:40 +00:00
|
|
|
{
|
2012-05-01 12:14:10 +00:00
|
|
|
ULONG cBitsPixel, cjBits, cjObject;
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
PSURFACE psurf;
|
|
|
|
SURFOBJ *pso;
|
2012-05-01 12:14:10 +00:00
|
|
|
PVOID pvSection;
|
|
|
|
|
2015-03-08 17:25:44 +00:00
|
|
|
NT_ASSERT(!pvBits || (iType == STYPE_BITMAP));
|
|
|
|
NT_ASSERT((iFormat <= BMF_32BPP) || (cjBufSize != 0));
|
|
|
|
NT_ASSERT((LONG)cy > 0);
|
2010-06-09 02:57:52 +00:00
|
|
|
|
|
|
|
/* Verify format */
|
2012-05-01 12:14:10 +00:00
|
|
|
if ((iFormat < BMF_1BPP) || (iFormat > BMF_PNG))
|
2010-06-09 02:57:52 +00:00
|
|
|
{
|
2012-07-31 18:40:52 +00:00
|
|
|
DPRINT1("Invalid bitmap format: %lu\n", iFormat);
|
2010-06-09 02:57:52 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-06-06 09:09:04 +00:00
|
|
|
/* Get bits per pixel from the format */
|
2012-05-01 12:14:10 +00:00
|
|
|
cBitsPixel = gajBitsPerFormat[iFormat];
|
2010-06-06 09:09:04 +00:00
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Are bits and a width in bytes given? */
|
|
|
|
if (pvBits && cjWidth)
|
2010-06-06 09:09:04 +00:00
|
|
|
{
|
2010-09-01 12:04:31 +00:00
|
|
|
/* Align the width (Windows compatibility, drivers expect that) */
|
2012-05-01 12:14:10 +00:00
|
|
|
cjWidth = WIDTH_BYTES_ALIGN32((cjWidth << 3) / cBitsPixel, cBitsPixel);
|
2010-08-02 01:41:16 +00:00
|
|
|
}
|
2012-05-01 12:14:10 +00:00
|
|
|
else
|
|
|
|
{
|
2010-09-01 12:04:31 +00:00
|
|
|
/* Calculate width from the bitmap width in pixels */
|
2012-05-01 12:14:10 +00:00
|
|
|
cjWidth = WIDTH_BYTES_ALIGN32(cx, cBitsPixel);
|
|
|
|
}
|
2010-08-02 00:53:25 +00:00
|
|
|
|
2015-03-08 17:25:44 +00:00
|
|
|
/* Is this an uncompressed format? */
|
|
|
|
if (iFormat <= BMF_32BPP)
|
|
|
|
{
|
|
|
|
/* Calculate the correct bitmap size in bytes */
|
|
|
|
if (!NT_SUCCESS(RtlULongMult(cjWidth, cy, &cjBits)))
|
|
|
|
{
|
|
|
|
DPRINT1("Overflow calculating size: cjWidth %lu, cy %lu\n",
|
|
|
|
cjWidth, cy);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Did we get a buffer and size? */
|
|
|
|
if ((pvBits != NULL) && (cjBufSize != 0))
|
|
|
|
{
|
|
|
|
/* Make sure the buffer is large enough */
|
|
|
|
if (cjBufSize < cjBits)
|
|
|
|
{
|
|
|
|
DPRINT1("Buffer is too small, required: %lu, got %lu\n",
|
|
|
|
cjBits, cjBufSize);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Compressed format, use the provided size */
|
|
|
|
NT_ASSERT(cjBufSize != 0);
|
|
|
|
cjBits = cjBufSize;
|
|
|
|
}
|
2004-07-07 16:33:44 +00:00
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Check if we need an extra large object */
|
|
|
|
if ((iType == STYPE_BITMAP) && (pvBits == NULL) &&
|
|
|
|
!(fjBitmap & BMF_USERMEM) && !(fjBitmap & BMF_KMSECTION))
|
2008-03-22 03:14:57 +00:00
|
|
|
{
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Allocate an object large enough to hold the bits */
|
|
|
|
cjObject = sizeof(SURFACE) + cjBits;
|
2010-03-11 19:26:00 +00:00
|
|
|
}
|
2012-05-01 12:14:10 +00:00
|
|
|
else
|
2010-03-11 19:26:00 +00:00
|
|
|
{
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Otherwise just allocate the SURFACE structure */
|
|
|
|
cjObject = sizeof(SURFACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for arithmetic overflow */
|
2015-03-08 17:25:44 +00:00
|
|
|
if (cjObject < sizeof(SURFACE))
|
2012-05-01 12:14:10 +00:00
|
|
|
{
|
|
|
|
/* Fail! */
|
2015-03-08 17:25:44 +00:00
|
|
|
DPRINT1("Overflow calculating cjObject: cjBits %lu\n", cjBits);
|
2012-05-01 12:14:10 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a SURFACE object */
|
|
|
|
psurf = (PSURFACE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_BITMAP, cjObject);
|
|
|
|
if (!psurf)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the basic fields */
|
|
|
|
pso = &psurf->SurfObj;
|
|
|
|
pso->hsurf = psurf->BaseObject.hHmgr;
|
|
|
|
pso->sizlBitmap.cx = cx;
|
|
|
|
pso->sizlBitmap.cy = cy;
|
|
|
|
pso->iBitmapFormat = iFormat;
|
|
|
|
pso->iType = iType;
|
|
|
|
pso->fjBitmap = (USHORT)fjBitmap;
|
|
|
|
pso->iUniq = InterlockedIncrement(&giUniqueSurface);
|
|
|
|
pso->cjBits = cjBits;
|
|
|
|
|
|
|
|
/* Check if we need a bitmap buffer */
|
|
|
|
if (iType == STYPE_BITMAP)
|
|
|
|
{
|
|
|
|
/* Check if we got one or if we need to allocate one */
|
|
|
|
if (pvBits != NULL)
|
|
|
|
{
|
|
|
|
/* Use the caller provided buffer */
|
|
|
|
pso->pvBits = pvBits;
|
|
|
|
}
|
|
|
|
else if (fjBitmap & BMF_USERMEM)
|
2010-03-11 17:49:44 +00:00
|
|
|
{
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* User mode memory was requested */
|
2012-05-01 12:14:10 +00:00
|
|
|
pso->pvBits = EngAllocUserMem(cjBits, 0);
|
|
|
|
|
|
|
|
/* Check for failure */
|
|
|
|
if (!pso->pvBits)
|
|
|
|
{
|
|
|
|
GDIOBJ_vDeleteObject(&psurf->BaseObject);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-03-11 19:26:00 +00:00
|
|
|
}
|
2012-05-01 12:14:10 +00:00
|
|
|
else if (fjBitmap & BMF_KMSECTION)
|
2010-03-11 19:26:00 +00:00
|
|
|
{
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Use a kernel mode section */
|
2012-05-01 12:14:10 +00:00
|
|
|
pso->pvBits = EngAllocSectionMem(&pvSection,
|
|
|
|
(fjBitmap & BMF_NOZEROINIT) ?
|
|
|
|
0 : FL_ZERO_MEMORY,
|
|
|
|
cjBits, TAG_DIB);
|
|
|
|
|
|
|
|
/* Check for failure */
|
|
|
|
if (!pso->pvBits)
|
|
|
|
{
|
|
|
|
GDIOBJ_vDeleteObject(&psurf->BaseObject);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-06-10 14:32:05 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Free the section already, but keep the mapping */
|
2012-05-01 12:14:10 +00:00
|
|
|
EngFreeSectionMem(pvSection, NULL);
|
2010-03-11 17:49:44 +00:00
|
|
|
}
|
2012-05-01 12:14:10 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Buffer is after the object */
|
|
|
|
pso->pvBits = psurf + 1;
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Zero the buffer, except requested otherwise */
|
|
|
|
if (!(fjBitmap & BMF_NOZEROINIT))
|
|
|
|
{
|
|
|
|
RtlZeroMemory(pso->pvBits, cjBits);
|
|
|
|
}
|
|
|
|
}
|
2002-08-04 09:55:11 +00:00
|
|
|
|
2012-05-03 14:39:53 +00:00
|
|
|
/* Set pvScan0 and lDelta */
|
|
|
|
if (fjBitmap & BMF_TOPDOWN)
|
|
|
|
{
|
|
|
|
/* Topdown is the normal way */
|
|
|
|
pso->pvScan0 = pso->pvBits;
|
|
|
|
pso->lDelta = cjWidth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Inversed bitmap (bottom up) */
|
|
|
|
pso->pvScan0 = ((PCHAR)pso->pvBits + pso->cjBits - cjWidth);
|
|
|
|
pso->lDelta = -(LONG)cjWidth;
|
|
|
|
}
|
2004-02-14 22:24:54 +00:00
|
|
|
}
|
2008-03-19 14:53:15 +00:00
|
|
|
else
|
2004-02-14 22:24:54 +00:00
|
|
|
{
|
2012-05-03 14:39:53 +00:00
|
|
|
/* There are no bitmap bits */
|
|
|
|
pso->pvScan0 = pso->pvBits = NULL;
|
|
|
|
pso->lDelta = 0;
|
2004-06-23 07:31:22 +00:00
|
|
|
}
|
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
/* Assign a default palette and increment its reference count */
|
2012-07-01 13:43:33 +00:00
|
|
|
SURFACE_vSetPalette(psurf, appalSurfaceDefault[iFormat]);
|
2010-04-19 00:56:25 +00:00
|
|
|
|
2012-05-01 12:14:10 +00:00
|
|
|
return psurf;
|
2010-03-11 17:49:44 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
HBITMAP
|
|
|
|
APIENTRY
|
|
|
|
EngCreateBitmap(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ SIZEL sizl,
|
|
|
|
_In_ LONG lWidth,
|
|
|
|
_In_ ULONG iFormat,
|
|
|
|
_In_ ULONG fl,
|
2013-03-05 08:47:51 +00:00
|
|
|
_In_opt_ PVOID pvBits)
|
2010-03-11 17:49:44 +00:00
|
|
|
{
|
|
|
|
PSURFACE psurf;
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
HBITMAP hbmp;
|
2010-03-11 17:49:44 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Allocate a surface */
|
2012-05-01 12:14:10 +00:00
|
|
|
psurf = SURFACE_AllocSurface(STYPE_BITMAP,
|
|
|
|
sizl.cx,
|
|
|
|
sizl.cy,
|
|
|
|
iFormat,
|
|
|
|
fl,
|
|
|
|
lWidth,
|
2015-03-08 17:25:44 +00:00
|
|
|
0,
|
2012-05-01 12:14:10 +00:00
|
|
|
pvBits);
|
2010-03-11 23:11:00 +00:00
|
|
|
if (!psurf)
|
|
|
|
{
|
2017-04-17 15:48:56 +00:00
|
|
|
DPRINT1("SURFACE_AllocSurface failed. (STYPE_BITMAP, sizl.cx=%ld, sizl.cy=%ld, iFormat=%lu, fl=%lu, lWidth=%ld, pvBits=0x%p)\n",
|
|
|
|
sizl.cx, sizl.cy, iFormat, fl, lWidth, pvBits);
|
2010-03-11 23:11:00 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Get the handle for the bitmap */
|
|
|
|
hbmp = (HBITMAP)psurf->SurfObj.hsurf;
|
2010-03-11 17:49:44 +00:00
|
|
|
|
[WIN32SS:ENG] EngCreateBitmap: mark created bitmaps as API bitmaps (#4146)
CORE-17561
Set the API_BITMAP flag for bitmaps created by EngCreateBitmap().
This avoids failure when created bitmap is passed to NtGdiSelectBitmap(), since it checks for this flag and fails if it isn't set.
Otherwise, if failure occurs, the bitmap is hot handled properly.
Setting this flag outside of that function is not an option at all, because it is a public (exported) function, and in many cases it's called directly by the caller (in case with MS DDraw stack, it can be called also by dxg.sys from dxgthk!EngCreateBitmap, which directly calls win32k!EngCreateBitmap).
In particular, it allows Windows XP/2003 DirectDraw stack (ddraw.dll & dxg.sys) to properly work in ReactOS (in software emulation mode), even on real hardware. So now, a lot of DirectX 1-7 apps and games (whose can work withoug hardware acceleation), are working properly with ddraw.dll + dxg.sys replacement! Also Justin Miller (DarkFire01) confirmed that even Direct3D software emulation now also works correctly on real hardware!
2021-12-29 15:51:23 +00:00
|
|
|
/* Mark as API bitmap */
|
|
|
|
psurf->flags = API_BITMAP;
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Set public ownership */
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GDIOBJ_vSetObjectOwner(&psurf->BaseObject, GDI_OBJ_HMGR_PUBLIC);
|
2010-04-19 00:56:25 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Unlock the surface and return */
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE_UnlockSurface(psurf);
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
return hbmp;
|
2004-07-03 13:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2010-03-11 17:49:44 +00:00
|
|
|
HBITMAP
|
|
|
|
APIENTRY
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
EngCreateDeviceBitmap(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ DHSURF dhsurf,
|
|
|
|
_In_ SIZEL sizl,
|
|
|
|
_In_ ULONG iFormat)
|
2004-07-03 13:55:37 +00:00
|
|
|
{
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
PSURFACE psurf;
|
|
|
|
HBITMAP hbmp;
|
|
|
|
|
|
|
|
/* Allocate a surface */
|
2012-05-01 12:14:10 +00:00
|
|
|
psurf = SURFACE_AllocSurface(STYPE_DEVBITMAP,
|
|
|
|
sizl.cx,
|
|
|
|
sizl.cy,
|
|
|
|
iFormat,
|
|
|
|
0,
|
|
|
|
0,
|
2015-03-08 17:25:44 +00:00
|
|
|
0,
|
2012-05-01 12:14:10 +00:00
|
|
|
NULL);
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
if (!psurf)
|
2010-03-11 17:49:44 +00:00
|
|
|
{
|
2017-04-17 15:48:56 +00:00
|
|
|
DPRINT1("SURFACE_AllocSurface failed. (STYPE_DEVBITMAP, sizl.cx=%ld, sizl.cy=%ld, iFormat=%lu)\n",
|
|
|
|
sizl.cx, sizl.cy, iFormat);
|
2012-05-01 12:14:10 +00:00
|
|
|
return NULL;
|
2010-03-11 17:49:44 +00:00
|
|
|
}
|
2010-04-19 00:56:25 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Set the device handle */
|
|
|
|
psurf->SurfObj.dhsurf = dhsurf;
|
|
|
|
|
|
|
|
/* Set public ownership */
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GDIOBJ_vSetObjectOwner(&psurf->BaseObject, GDI_OBJ_HMGR_PUBLIC);
|
2000-03-17 21:44:02 +00:00
|
|
|
|
2013-02-16 17:44:38 +00:00
|
|
|
/* Get the handle for the bitmap */
|
|
|
|
hbmp = (HBITMAP)psurf->SurfObj.hsurf;
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Unlock the surface and return */
|
|
|
|
SURFACE_UnlockSurface(psurf);
|
|
|
|
return hbmp;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
HSURF
|
|
|
|
APIENTRY
|
|
|
|
EngCreateDeviceSurface(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ DHSURF dhsurf,
|
|
|
|
_In_ SIZEL sizl,
|
|
|
|
_In_ ULONG iFormat)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
PSURFACE psurf;
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
HSURF hsurf;
|
2000-03-17 21:44:02 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Allocate a surface */
|
2012-05-01 12:14:10 +00:00
|
|
|
psurf = SURFACE_AllocSurface(STYPE_DEVICE,
|
|
|
|
sizl.cx,
|
|
|
|
sizl.cy,
|
|
|
|
iFormat,
|
|
|
|
0,
|
|
|
|
0,
|
2015-03-08 17:25:44 +00:00
|
|
|
0,
|
2012-05-01 12:14:10 +00:00
|
|
|
NULL);
|
2009-01-08 16:33:40 +00:00
|
|
|
if (!psurf)
|
2008-04-06 23:20:31 +00:00
|
|
|
{
|
2017-04-17 15:48:56 +00:00
|
|
|
DPRINT1("SURFACE_AllocSurface failed. (STYPE_DEVICE, sizl.cx=%ld, sizl.cy=%ld, iFormat=%lu)\n",
|
|
|
|
sizl.cx, sizl.cy, iFormat);
|
2012-05-01 12:14:10 +00:00
|
|
|
return NULL;
|
2008-04-06 23:20:31 +00:00
|
|
|
}
|
1999-08-01 11:21:05 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Set the device handle */
|
|
|
|
psurf->SurfObj.dhsurf = dhsurf;
|
2005-09-03 17:40:33 +00:00
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Set public ownership */
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
GDIOBJ_vSetObjectOwner(&psurf->BaseObject, GDI_OBJ_HMGR_PUBLIC);
|
2004-07-03 13:55:37 +00:00
|
|
|
|
2013-02-16 17:44:38 +00:00
|
|
|
/* Get the handle for the surface */
|
|
|
|
hsurf = psurf->SurfObj.hsurf;
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
/* Unlock the surface and return */
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE_UnlockSurface(psurf);
|
|
|
|
return hsurf;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
EngAssociateSurface(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ HSURF hsurf,
|
|
|
|
_In_ HDEV hdev,
|
|
|
|
_In_ FLONG flHooks)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFOBJ *pso;
|
|
|
|
PSURFACE psurf;
|
2009-03-23 00:38:59 +00:00
|
|
|
PDEVOBJ* ppdev;
|
2012-07-01 13:43:33 +00:00
|
|
|
PPALETTE ppal;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
ppdev = (PDEVOBJ*)hdev;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
/* Lock the surface */
|
2011-04-15 15:20:17 +00:00
|
|
|
psurf = SURFACE_ShareLockSurface(hsurf);
|
2009-03-23 00:38:59 +00:00
|
|
|
if (!psurf)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-01-08 16:33:40 +00:00
|
|
|
pso = &psurf->SurfObj;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2008-03-19 14:53:15 +00:00
|
|
|
/* Associate the hdev */
|
2009-03-20 18:02:55 +00:00
|
|
|
pso->hdev = hdev;
|
2009-08-16 12:57:41 +00:00
|
|
|
pso->dhpdev = ppdev->dhpdev;
|
2001-03-31 15:35:08 +00:00
|
|
|
|
2008-03-19 14:53:15 +00:00
|
|
|
/* Hook up specified functions */
|
2010-06-05 21:19:41 +00:00
|
|
|
psurf->flags &= ~HOOK_FLAGS;
|
|
|
|
psurf->flags |= (flHooks & HOOK_FLAGS);
|
2004-07-03 13:55:37 +00:00
|
|
|
|
2012-07-01 13:43:33 +00:00
|
|
|
/* Assign the PDEV's palette */
|
|
|
|
ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
|
|
|
|
SURFACE_vSetPalette(psurf, ppal);
|
|
|
|
PALETTE_ShareUnlockPalette(ppal);
|
2010-05-08 22:10:41 +00:00
|
|
|
|
2011-04-15 15:20:17 +00:00
|
|
|
SURFACE_ShareUnlockSurface(psurf);
|
2004-01-16 19:32:00 +00:00
|
|
|
|
2008-03-19 14:53:15 +00:00
|
|
|
return TRUE;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
2004-03-06 01:22:04 +00:00
|
|
|
EngModifySurface(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ HSURF hsurf,
|
|
|
|
_In_ HDEV hdev,
|
|
|
|
_In_ FLONG flHooks,
|
|
|
|
_In_ FLONG flSurface,
|
|
|
|
_In_ DHSURF dhsurf,
|
2015-02-04 08:21:54 +00:00
|
|
|
_In_ PVOID pvScan0,
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ LONG lDelta,
|
2015-02-04 08:21:54 +00:00
|
|
|
_Reserved_ PVOID pvReserved)
|
2004-03-06 01:22:04 +00:00
|
|
|
{
|
2008-03-19 14:53:15 +00:00
|
|
|
SURFOBJ *pso;
|
2009-03-23 00:38:59 +00:00
|
|
|
PSURFACE psurf;
|
|
|
|
PDEVOBJ* ppdev;
|
2012-07-01 13:43:33 +00:00
|
|
|
PPALETTE ppal;
|
2004-03-06 01:22:04 +00:00
|
|
|
|
2015-02-04 08:21:54 +00:00
|
|
|
/* Lock the surface */
|
2011-04-15 15:20:17 +00:00
|
|
|
psurf = SURFACE_ShareLockSurface(hsurf);
|
2009-03-23 00:38:59 +00:00
|
|
|
if (psurf == NULL)
|
2008-03-19 14:53:15 +00:00
|
|
|
{
|
2015-02-04 08:21:54 +00:00
|
|
|
DPRINT1("Failed to reference surface %p\n", hsurf);
|
2008-03-19 14:53:15 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-03-06 01:22:04 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
ppdev = (PDEVOBJ*)hdev;
|
|
|
|
pso = &psurf->SurfObj;
|
2008-03-19 14:53:15 +00:00
|
|
|
pso->dhsurf = dhsurf;
|
2004-03-06 01:22:04 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
/* Associate the hdev */
|
|
|
|
pso->hdev = hdev;
|
2009-08-16 12:57:41 +00:00
|
|
|
pso->dhpdev = ppdev->dhpdev;
|
2009-03-23 00:38:59 +00:00
|
|
|
|
|
|
|
/* Hook up specified functions */
|
2010-06-05 21:19:41 +00:00
|
|
|
psurf->flags &= ~HOOK_FLAGS;
|
|
|
|
psurf->flags |= (flHooks & HOOK_FLAGS);
|
2009-03-23 00:38:59 +00:00
|
|
|
|
2012-07-01 13:43:33 +00:00
|
|
|
/* Assign the PDEV's palette */
|
|
|
|
ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
|
|
|
|
SURFACE_vSetPalette(psurf, ppal);
|
|
|
|
PALETTE_ShareUnlockPalette(ppal);
|
2010-05-08 22:10:41 +00:00
|
|
|
|
2015-02-04 08:21:54 +00:00
|
|
|
/* Update surface flags */
|
|
|
|
if (flSurface & MS_NOTSYSTEMMEMORY)
|
|
|
|
pso->fjBitmap |= BMF_NOTSYSMEM;
|
|
|
|
else
|
|
|
|
pso->fjBitmap &= ~BMF_NOTSYSMEM;
|
|
|
|
if (flSurface & MS_SHAREDACCESS)
|
|
|
|
psurf->flags |= SHAREACCESS_SURFACE;
|
|
|
|
else
|
|
|
|
psurf->flags &= ~SHAREACCESS_SURFACE;
|
|
|
|
|
2015-01-26 22:11:34 +00:00
|
|
|
/* Check if the caller passed bitmap bits */
|
|
|
|
if ((pvScan0 != NULL) && (lDelta != 0))
|
|
|
|
{
|
|
|
|
/* Update the fields */
|
|
|
|
pso->pvScan0 = pvScan0;
|
|
|
|
pso->lDelta = lDelta;
|
|
|
|
|
|
|
|
/* This is a bitmap now! */
|
|
|
|
pso->iType = STYPE_BITMAP;
|
|
|
|
|
|
|
|
/* Check memory layout */
|
|
|
|
if (lDelta > 0)
|
|
|
|
{
|
|
|
|
/* Topdown is the normal way */
|
|
|
|
pso->cjBits = lDelta * pso->sizlBitmap.cy;
|
|
|
|
pso->pvBits = pso->pvScan0;
|
|
|
|
pso->fjBitmap |= BMF_TOPDOWN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Inversed bitmap (bottom up) */
|
|
|
|
pso->cjBits = (-lDelta) * pso->sizlBitmap.cy;
|
|
|
|
pso->pvBits = (PCHAR)pso->pvScan0 - pso->cjBits - lDelta;
|
|
|
|
pso->fjBitmap &= ~BMF_TOPDOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Set bits to NULL */
|
|
|
|
pso->pvBits = NULL;
|
|
|
|
pso->pvScan0 = NULL;
|
|
|
|
pso->lDelta = 0;
|
|
|
|
|
|
|
|
/* Set appropriate surface type */
|
|
|
|
if (pso->iType != STYPE_DEVICE)
|
|
|
|
pso->iType = STYPE_DEVBITMAP;
|
|
|
|
}
|
|
|
|
|
2011-04-15 15:20:17 +00:00
|
|
|
SURFACE_ShareUnlockSurface(psurf);
|
2004-03-06 01:22:04 +00:00
|
|
|
|
2008-03-19 14:53:15 +00:00
|
|
|
return TRUE;
|
2004-03-06 01:22:04 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
|
|
|
|
BOOL
|
|
|
|
APIENTRY
|
2013-01-01 09:40:48 +00:00
|
|
|
EngDeleteSurface(
|
2013-03-05 08:47:51 +00:00
|
|
|
_In_ _Post_ptr_invalid_ HSURF hsurf)
|
1999-08-01 11:21:05 +00:00
|
|
|
{
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
PSURFACE psurf;
|
|
|
|
|
|
|
|
psurf = SURFACE_ShareLockSurface(hsurf);
|
|
|
|
if (!psurf)
|
|
|
|
{
|
2015-02-04 08:21:54 +00:00
|
|
|
DPRINT1("Could not reference surface %p to delete\n", hsurf);
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GDIOBJ_vDeleteObject(&psurf->BaseObject);
|
2008-03-19 14:53:15 +00:00
|
|
|
return TRUE;
|
2000-03-17 21:44:02 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
EngEraseSurface(
|
2013-01-01 09:40:48 +00:00
|
|
|
_In_ SURFOBJ *pso,
|
|
|
|
_In_ RECTL *prcl,
|
|
|
|
_In_ ULONG iColor)
|
2002-06-15 21:44:08 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
ASSERT(pso);
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
ASSERT(prcl);
|
|
|
|
return FillSolid(pso, prcl, iColor);
|
2002-06-15 21:44:08 +00:00
|
|
|
}
|
|
|
|
|
2007-08-09 10:11:47 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2008-11-29 22:48:58 +00:00
|
|
|
SURFOBJ * APIENTRY
|
2009-01-08 16:33:40 +00:00
|
|
|
NtGdiEngLockSurface(IN HSURF hsurf)
|
2007-08-09 10:11:47 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
return EngLockSurface(hsurf);
|
2007-08-09 10:11:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
SURFOBJ *
|
|
|
|
APIENTRY
|
2013-01-01 09:40:48 +00:00
|
|
|
EngLockSurface(
|
|
|
|
_In_ HSURF hsurf)
|
2000-03-17 21:44:02 +00:00
|
|
|
{
|
2011-04-15 15:20:17 +00:00
|
|
|
SURFACE *psurf = SURFACE_ShareLockSurface(hsurf);
|
2005-06-07 16:34:07 +00:00
|
|
|
|
2011-04-15 15:20:17 +00:00
|
|
|
return psurf ? &psurf->SurfObj : NULL;
|
1999-08-01 11:21:05 +00:00
|
|
|
}
|
2003-02-15 19:16:34 +00:00
|
|
|
|
2015-03-10 00:10:33 +00:00
|
|
|
__kernel_entry
|
|
|
|
NTSTATUS
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
APIENTRY
|
2015-03-10 00:10:33 +00:00
|
|
|
NtGdiEngUnlockSurface(
|
|
|
|
_In_ SURFOBJ *pso)
|
2007-08-25 17:34:03 +00:00
|
|
|
{
|
2011-04-15 15:20:17 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
ASSERT(FALSE);
|
2015-03-10 00:10:33 +00:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
2007-08-25 17:34:03 +00:00
|
|
|
}
|
|
|
|
|
[WIN32K]
- Move RLE specific code to it's own file (rlecomp.c)
- Relace BitsPerFormat function with an array of UCHARs
- Rewrite surface creation. Surfaces are now allocated from one central function SURFACE_AllocSurface, which sets the size, iType, iUniq, the handle and the default palette.
- Implement SURFACE_vSetDefaultPalette, which sets the default RGB palette, based on bit depth.
- Implement SURFACE_bSetBitmapBits, wich sets cjBits, pvBits, pvScan0 and lDelta and allocates memory if neccessary.
- Use these functions for EngCreateBitmap, EngCreateDeviceBitmap, EngCreateDeviceSurface and IntCreateBitmap
svn path=/branches/reactos-yarotows/; revision=47612
2010-06-06 07:02:15 +00:00
|
|
|
VOID
|
|
|
|
APIENTRY
|
2013-01-01 09:40:48 +00:00
|
|
|
EngUnlockSurface(
|
2013-03-05 08:47:51 +00:00
|
|
|
_In_ _Post_ptr_invalid_ SURFOBJ *pso)
|
2003-02-15 19:16:34 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
if (pso != NULL)
|
2008-03-19 14:53:15 +00:00
|
|
|
{
|
2009-01-08 16:33:40 +00:00
|
|
|
SURFACE *psurf = CONTAINING_RECORD(pso, SURFACE, SurfObj);
|
2011-04-15 15:20:17 +00:00
|
|
|
SURFACE_ShareUnlockSurface(psurf);
|
2008-03-19 14:53:15 +00:00
|
|
|
}
|
2003-02-15 19:16:34 +00:00
|
|
|
}
|
2007-08-25 17:34:03 +00:00
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|