mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 07:41:48 +00:00
- Add support for 8-bit and 32-bit displays
- Precompute DIB routines - Fix some compiler warnings svn path=/trunk/; revision=4238
This commit is contained in:
parent
4ea32f911a
commit
31e559fb73
24 changed files with 1066 additions and 434 deletions
|
@ -1,81 +1,204 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern BOOL STDCALL GdiDllInitialize(HANDLE hInstance, DWORD Event, LPVOID Reserved);
|
#define CELL_SIZE 10
|
||||||
|
|
||||||
void __stdcall Test1BPP (HDC Desktop)
|
static RGBQUAD Colors[] =
|
||||||
{
|
{
|
||||||
HDC TestDC;
|
{ 0x00, 0x00, 0x00, 0x00 }, // black
|
||||||
HPEN WhitePen;
|
{ 0x00, 0x00, 0x80, 0x00 }, // red
|
||||||
HBITMAP DIB1;
|
{ 0x00, 0x80, 0x00, 0x00 }, // green
|
||||||
BITMAPINFOHEADER BitInf;
|
{ 0x00, 0x80, 0x80, 0x00 }, // brown
|
||||||
PBITMAPINFO BitPalInf;
|
{ 0x80, 0x00, 0x00, 0x00 }, // blue
|
||||||
DWORD bmiSize = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 2;
|
{ 0x80, 0x00, 0x80, 0x00 }, // magenta
|
||||||
|
{ 0x80, 0x80, 0x00, 0x00 }, // cyan
|
||||||
|
{ 0x80, 0x80, 0x80, 0x00 }, // dark gray
|
||||||
|
{ 0xc0, 0xc0, 0xc0, 0x00 }, // light gray
|
||||||
|
{ 0x00, 0x00, 0xFF, 0x00 }, // bright red
|
||||||
|
{ 0x00, 0xFF, 0x00, 0x00 }, // bright green
|
||||||
|
{ 0x00, 0xFF, 0xFF, 0x00 }, // bright yellow
|
||||||
|
{ 0xFF, 0x00, 0x00, 0x00 }, // bright blue
|
||||||
|
{ 0xFF, 0x00, 0xFF, 0x00 }, // bright magenta
|
||||||
|
{ 0xFF, 0xFF, 0x00, 0x00 }, // bright cyan
|
||||||
|
{ 0xFF, 0xFF, 0xFF, 0x00 } // bright white
|
||||||
|
};
|
||||||
|
|
||||||
// Create a 1BPP DIB
|
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
BitPalInf = (PBITMAPINFO)malloc(bmiSize);
|
|
||||||
BitInf.biSize = sizeof(BITMAPINFOHEADER);
|
|
||||||
BitInf.biWidth = 50;
|
|
||||||
BitInf.biHeight = -50; // it's top down (since BI_RGB is used, the sign is operative of direction)
|
|
||||||
BitInf.biPlanes = 1;
|
|
||||||
BitInf.biBitCount = 1;
|
|
||||||
BitInf.biCompression = BI_RGB;
|
|
||||||
BitInf.biSizeImage = 0;
|
|
||||||
BitInf.biXPelsPerMeter = 0;
|
|
||||||
BitInf.biYPelsPerMeter = 0;
|
|
||||||
BitInf.biClrUsed = 0;
|
|
||||||
BitInf.biClrImportant = 0;
|
|
||||||
BitPalInf->bmiHeader = BitInf;
|
|
||||||
BitPalInf->bmiColors[1].rgbBlue = 255;
|
|
||||||
BitPalInf->bmiColors[1].rgbGreen = 255;
|
|
||||||
BitPalInf->bmiColors[1].rgbRed = 255;
|
|
||||||
BitPalInf->bmiColors[1].rgbReserved = 255;
|
|
||||||
BitPalInf->bmiColors[0].rgbBlue = 0;
|
|
||||||
BitPalInf->bmiColors[0].rgbGreen = 0;
|
|
||||||
BitPalInf->bmiColors[0].rgbRed = 0;
|
|
||||||
BitPalInf->bmiColors[0].rgbReserved = 0;
|
|
||||||
|
|
||||||
DIB1 = (HBITMAP) CreateDIBSection(NULL, BitPalInf, DIB_RGB_COLORS, NULL, NULL, 0);
|
int WINAPI
|
||||||
TestDC = CreateCompatibleDC(NULL);
|
WinMain(HINSTANCE hInstance,
|
||||||
SelectObject(TestDC, DIB1);
|
HINSTANCE hPrevInstance,
|
||||||
|
LPSTR lpszCmdLine,
|
||||||
// Draw a white rectangle on the 1BPP DIB
|
int nCmdShow)
|
||||||
WhitePen = CreatePen(PS_SOLID, 1, RGB(255, 255, 255));
|
|
||||||
SelectObject(TestDC, WhitePen);
|
|
||||||
Rectangle(TestDC, 0, 0, 40, 40);
|
|
||||||
|
|
||||||
// Blt the 1BPP DIB to the display
|
|
||||||
BitBlt(Desktop, 0, 0, 50, 50, TestDC, 0, 0, SRCCOPY);
|
|
||||||
|
|
||||||
free(BitPalInf);
|
|
||||||
// Rectangle(Desktop, 50, 50, 200, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DIBTest(void)
|
|
||||||
{
|
{
|
||||||
HDC Desktop;
|
WNDCLASS wc;
|
||||||
|
MSG msg;
|
||||||
|
HWND hWnd;
|
||||||
|
|
||||||
// Set up a DC called Desktop that accesses DISPLAY
|
wc.lpszClassName = "DibTestClass";
|
||||||
Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
wc.lpfnWndProc = MainWndProc;
|
||||||
if(Desktop == NULL) {
|
wc.style = CS_VREDRAW | CS_HREDRAW;
|
||||||
printf("Can't create desktop\n");
|
wc.hInstance = hInstance;
|
||||||
return;
|
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
if (RegisterClass(&wc) == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
|
||||||
|
GetLastError());
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
hWnd = CreateWindow("DibTestClass",
|
||||||
|
"DIB Test",
|
||||||
|
WS_OVERLAPPEDWINDOW,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
25 * CELL_SIZE + 5,
|
||||||
|
25 * CELL_SIZE + 20,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
hInstance,
|
||||||
|
NULL);
|
||||||
|
if (hWnd == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
|
||||||
|
GetLastError());
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowWindow(hWnd, nCmdShow);
|
||||||
|
|
||||||
|
while(GetMessage(&msg, NULL, 0, 0))
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1BPP Test
|
return msg.wParam;
|
||||||
Test1BPP(Desktop);
|
|
||||||
|
|
||||||
Sleep(50000);
|
|
||||||
|
|
||||||
// Free up everything
|
|
||||||
DeleteDC(Desktop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
static void PaintCells(HDC WindowDC, WORD BitCount1, WORD BitCount2,
|
||||||
|
int XDest, int YDest)
|
||||||
{
|
{
|
||||||
printf("Entering DIBTest..\n");
|
HBRUSH Brush;
|
||||||
|
RECT Rect;
|
||||||
|
UINT row, col;
|
||||||
|
BITMAPINFO *BitmapInfo;
|
||||||
|
HBITMAP DIB1, DIB2;
|
||||||
|
HDC DC1, DC2;
|
||||||
|
|
||||||
GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
|
BitmapInfo = malloc(sizeof(BITMAPINFO) + 15 * sizeof(RGBQUAD));
|
||||||
DIBTest();
|
BitmapInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
BitmapInfo->bmiHeader.biWidth = 4 * CELL_SIZE + 9;
|
||||||
|
BitmapInfo->bmiHeader.biHeight = -(4 * CELL_SIZE + 9); // it's top down (since BI_RGB is used, the sign is operative of direction)
|
||||||
|
BitmapInfo->bmiHeader.biPlanes = 1;
|
||||||
|
BitmapInfo->bmiHeader.biBitCount = BitCount1;
|
||||||
|
BitmapInfo->bmiHeader.biCompression = BI_RGB;
|
||||||
|
BitmapInfo->bmiHeader.biSizeImage = 0;
|
||||||
|
BitmapInfo->bmiHeader.biXPelsPerMeter = 0;
|
||||||
|
BitmapInfo->bmiHeader.biYPelsPerMeter = 0;
|
||||||
|
BitmapInfo->bmiHeader.biClrUsed = 16;
|
||||||
|
BitmapInfo->bmiHeader.biClrImportant = 16;
|
||||||
|
for (col = 0; col < 16; col++) {
|
||||||
|
BitmapInfo->bmiColors[col] = Colors[col];
|
||||||
|
}
|
||||||
|
DIB1 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||||
|
DC1 = CreateCompatibleDC(NULL);
|
||||||
|
SelectObject(DC1, DIB1);
|
||||||
|
|
||||||
|
BitmapInfo->bmiHeader.biBitCount = BitCount2;
|
||||||
|
DIB2 = CreateDIBSection(NULL, BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||||
|
DC2 = CreateCompatibleDC(NULL);
|
||||||
|
SelectObject(DC2, DIB2);
|
||||||
|
free(BitmapInfo);
|
||||||
|
|
||||||
|
/* Now paint on the first bitmap */
|
||||||
|
for (row = 0; row < 4; row++)
|
||||||
|
{
|
||||||
|
for (col = 0; col < 4; col++)
|
||||||
|
{
|
||||||
|
Brush = CreateSolidBrush(RGB(Colors[4 * row + col].rgbRed,
|
||||||
|
Colors[4 * row + col].rgbGreen,
|
||||||
|
Colors[4 * row + col].rgbBlue));
|
||||||
|
Rect.left = CELL_SIZE * col + 5;
|
||||||
|
Rect.top = CELL_SIZE * row + 5;
|
||||||
|
Rect.right = Rect.left + CELL_SIZE;
|
||||||
|
Rect.bottom = Rect.top + CELL_SIZE;
|
||||||
|
FillRect(DC1, &Rect, Brush);
|
||||||
|
DeleteObject(Brush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifndef TODO
|
||||||
|
/* Copy the first bitmap to the second */
|
||||||
|
BitBlt(DC2, 4, 4, 4 * CELL_SIZE, 4 * CELL_SIZE, DC1, 5, 5, SRCCOPY);
|
||||||
|
|
||||||
|
/* Show results on screen */
|
||||||
|
BitBlt(WindowDC, XDest, YDest, 4 * CELL_SIZE, 4 * CELL_SIZE, DC2, 4, 4, SRCCOPY);
|
||||||
|
#else
|
||||||
|
/* Show results on screen */
|
||||||
|
BitBlt(WindowDC, XDest, YDest, 4 * CELL_SIZE, 4 * CELL_SIZE, DC1, 5, 5, SRCCOPY);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CALLBACK MainWndProc(HWND Wnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC WindowDC;
|
||||||
|
|
||||||
|
switch(msg)
|
||||||
|
{
|
||||||
|
case WM_PAINT:
|
||||||
|
WindowDC = BeginPaint(Wnd, &ps);
|
||||||
|
|
||||||
|
#ifndef TODO
|
||||||
|
PaintCells(WindowDC, 4, 4, 0, 0);
|
||||||
|
PaintCells(WindowDC, 4, 8, 5 * CELL_SIZE, 0);
|
||||||
|
PaintCells(WindowDC, 4, 16, 10 * CELL_SIZE, 0);
|
||||||
|
PaintCells(WindowDC, 4, 24, 15 * CELL_SIZE, 0);
|
||||||
|
PaintCells(WindowDC, 4, 32, 20 * CELL_SIZE, 0);
|
||||||
|
|
||||||
|
PaintCells(WindowDC, 8, 4, 0, 5 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 8, 8, 5 * CELL_SIZE, 5 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 8, 16, 10 * CELL_SIZE, 5 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 8, 24, 15 * CELL_SIZE, 5 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 8, 32, 20 * CELL_SIZE, 5 * CELL_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PaintCells(WindowDC, 16, 4, 0, 10 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 16, 8, 5 * CELL_SIZE, 10 * CELL_SIZE);
|
||||||
|
#ifndef TODO
|
||||||
|
PaintCells(WindowDC, 16, 16, 10 * CELL_SIZE, 10 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 16, 24, 15 * CELL_SIZE, 10 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 16, 32, 20 * CELL_SIZE, 10 * CELL_SIZE);
|
||||||
|
|
||||||
|
PaintCells(WindowDC, 24, 4, 0, 15 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 24, 8, 5 * CELL_SIZE, 15 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 24, 16, 10 * CELL_SIZE, 15 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 24, 24, 15 * CELL_SIZE, 15 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 24, 32, 20 * CELL_SIZE, 15 * CELL_SIZE);
|
||||||
|
|
||||||
|
PaintCells(WindowDC, 32, 4, 0, 20 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 32, 8, 5 * CELL_SIZE, 20 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 32, 16, 10 * CELL_SIZE, 20 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 32, 24, 15 * CELL_SIZE, 20 * CELL_SIZE);
|
||||||
|
PaintCells(WindowDC, 32, 32, 20 * CELL_SIZE, 20 * CELL_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EndPaint(Wnd, &ps);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return DefWindowProc(Wnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.1 2002/09/22 20:09:01 jfilby Exp $
|
# $Id: makefile,v 1.2 2003/03/04 10:09:00 gvg Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../../..
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ TARGET_NORC = yes
|
||||||
|
|
||||||
TARGET_TYPE = program
|
TARGET_TYPE = program
|
||||||
|
|
||||||
TARGET_APPTYPE = console
|
TARGET_APPTYPE = windows
|
||||||
|
|
||||||
TARGET_NAME = dibtest
|
TARGET_NAME = dibtest
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
|
||||||
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0, c8;
|
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0, c8;
|
||||||
BYTE *GDIpos, *initial, *tMask, *lMask;
|
BYTE *GDIpos, *initial, *tMask, *lMask;
|
||||||
|
|
||||||
GDIpos = Source->pvBits;
|
GDIpos = Source->pvScan0;
|
||||||
|
|
||||||
dx = DestRect->right - DestRect->left;
|
dx = DestRect->right - DestRect->left;
|
||||||
dy = DestRect->bottom - DestRect->top;
|
dy = DestRect->bottom - DestRect->top;
|
||||||
|
@ -23,9 +23,10 @@ DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
|
||||||
alterx = abs(SourcePoint->x - DestRect->left);
|
alterx = abs(SourcePoint->x - DestRect->left);
|
||||||
altery = abs(SourcePoint->y - DestRect->top);
|
altery = abs(SourcePoint->y - DestRect->top);
|
||||||
|
|
||||||
if (ColorTranslation == NULL)
|
if (NULL == ColorTranslation)
|
||||||
{
|
{
|
||||||
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits,
|
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy,
|
||||||
|
Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1),
|
||||||
Source->lDelta);
|
Source->lDelta);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,43 +2,56 @@ extern unsigned char notmask[2];
|
||||||
extern unsigned char altnotmask[2];
|
extern unsigned char altnotmask[2];
|
||||||
extern unsigned char mask1Bpp[8];
|
extern unsigned char mask1Bpp[8];
|
||||||
|
|
||||||
typedef VOID (*PFN_DIB_PutPixel)(PSURFOBJ, LONG, LONG, ULONG);
|
|
||||||
typedef ULONG (*PFN_DIB_GetPixel)(PSURFOBJ, LONG, LONG);
|
|
||||||
typedef VOID (*PFN_DIB_HLine) (PSURFOBJ, LONG, LONG, LONG, ULONG);
|
|
||||||
typedef VOID (*PFN_DIB_VLine) (PSURFOBJ, LONG, LONG, LONG, ULONG);
|
|
||||||
|
|
||||||
VOID DIB_1BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_1BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_1BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_1BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
VOID DIB_1BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
VOID DIB_1BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
VOID DIB_1BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
VOID DIB_1BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_To_1BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation);
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
VOID DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
VOID DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation);
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
|
VOID DIB_8BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
|
ULONG DIB_8BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
VOID DIB_8BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
|
VOID DIB_8BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
|
BOOLEAN DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
VOID DIB_16BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
VOID DIB_16BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation);
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
VOID DIB_24BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
VOID DIB_24BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
BOOLEAN DIB_To_24BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_24BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation);
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
|
VOID DIB_32BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c);
|
||||||
|
ULONG DIB_32BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y);
|
||||||
|
VOID DIB_32BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c);
|
||||||
|
VOID DIB_32BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c);
|
||||||
|
BOOLEAN DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PWORD addr = (PWORD)byteaddr + x;
|
PWORD addr = (PWORD)byteaddr + x;
|
||||||
|
|
||||||
*addr = (WORD)c;
|
*addr = (WORD)c;
|
||||||
|
@ -18,7 +18,7 @@ VOID DIB_16BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
|
||||||
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PWORD addr = (PWORD)byteaddr + x;
|
PWORD addr = (PWORD)byteaddr + x;
|
||||||
|
|
||||||
return (ULONG)(*addr);
|
return (ULONG)(*addr);
|
||||||
|
@ -26,7 +26,7 @@ ULONG DIB_16BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
|
|
||||||
VOID DIB_16BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
VOID DIB_16BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PWORD addr = (PWORD)byteaddr + x1;
|
PWORD addr = (PWORD)byteaddr + x1;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ VOID DIB_16BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
|
||||||
VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y1 * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
||||||
PWORD addr = (PWORD)byteaddr + x;
|
PWORD addr = (PWORD)byteaddr + x;
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
|
@ -52,15 +52,15 @@ VOID DIB_16BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_16BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation)
|
XLATEOBJ *ColorTranslation)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, xColor, f1;
|
LONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
DestBits = DestSurf->pvBits + (DestRect->top * DestSurf->lDelta) + 2 * DestRect->left;
|
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + 2 * DestRect->left;
|
||||||
|
|
||||||
switch(SourceGDI->BitsPerPixel)
|
switch(SourceGDI->BitsPerPixel)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
SourceBits_4BPP = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
|
||||||
|
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
|
@ -107,10 +107,31 @@ BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *SourceBits);
|
||||||
|
SourceBits += 1;
|
||||||
|
DestBits += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
||||||
{
|
{
|
||||||
SourceBits = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
||||||
for (j = DestRect->top; j < DestRect->bottom; j++)
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
RtlCopyMemory(DestBits, SourceBits, 2 * (DestRect->right - DestRect->left));
|
RtlCopyMemory(DestBits, SourceBits, 2 * (DestRect->right - DestRect->left));
|
||||||
|
@ -127,7 +148,7 @@ BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
SourceLine = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
|
||||||
DestLine = DestBits;
|
DestLine = DestBits;
|
||||||
|
|
||||||
for (j = DestRect->top; j < DestRect->bottom; j++)
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
@ -150,6 +171,27 @@ BOOL DIB_To_16BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
*((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(ColorTranslation, *((PDWORD) SourceBits));
|
||||||
|
SourceBits += 4;
|
||||||
|
DestBits += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
DbgPrint("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
VOID DIB_1BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
VOID DIB_1BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits;
|
PBYTE addr = SurfObj->pvScan0;
|
||||||
|
|
||||||
addr += y * SurfObj->lDelta + (x >> 3);
|
addr += y * SurfObj->lDelta + (x >> 3);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ VOID DIB_1BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
|
||||||
ULONG DIB_1BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
ULONG DIB_1BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits + y * SurfObj->lDelta + (x >> 3);
|
PBYTE addr = SurfObj->pvScan0 + y * SurfObj->lDelta + (x >> 3);
|
||||||
|
|
||||||
return (*addr & mask1Bpp[x % 8] ? 1 : 0);
|
return (*addr & mask1Bpp[x % 8] ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,10 @@ VOID DIB_1BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN DIB_To_1BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_1BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation)
|
XLATEOBJ *ColorTranslation)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy = SourcePoint->y;
|
LONG i, j, sx, sy = SourcePoint->y;
|
||||||
|
|
||||||
|
@ -92,6 +92,42 @@ BOOLEAN DIB_To_1BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if(XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy)) == 0)
|
||||||
|
{
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
|
||||||
|
} else {
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if(XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy)) == 0)
|
||||||
|
{
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
|
||||||
|
} else {
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +146,24 @@ BOOLEAN DIB_To_1BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if(XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy)) == 0)
|
||||||
|
{
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 0);
|
||||||
|
} else {
|
||||||
|
DIB_1BPP_PutPixel(DestSurf, i, j, 1);
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("DIB_1BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
DbgPrint("DIB_1BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
||||||
|
|
||||||
*(PULONG)(addr) = c;
|
*(PULONG)(addr) = c;
|
||||||
|
@ -18,7 +18,7 @@ VOID DIB_24BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
|
||||||
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
||||||
|
|
||||||
return *(PULONG)(addr) & 0x00ffffff;
|
return *(PULONG)(addr) & 0x00ffffff;
|
||||||
|
@ -26,7 +26,7 @@ ULONG DIB_24BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
|
|
||||||
VOID DIB_24BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
VOID DIB_24BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x1;
|
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x1;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ VOID DIB_24BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
|
||||||
VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE byteaddr = SurfObj->pvBits + y1 * SurfObj->lDelta;
|
PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
||||||
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
PRGBTRIPLE addr = (PRGBTRIPLE)byteaddr + x;
|
||||||
LONG lDelta = SurfObj->lDelta;
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
|
@ -52,48 +52,17 @@ VOID DIB_24BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIB_24BPP_BltTo_24BPP(PSURFOBJ dstpsd, LONG dstx, LONG dsty, LONG w, LONG h,
|
BOOLEAN DIB_24BPP_BitBlt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
PSURFOBJ srcpsd, LONG srcx, LONG srcy)
|
|
||||||
{
|
|
||||||
PRGBTRIPLE dst;
|
|
||||||
PRGBTRIPLE src;
|
|
||||||
PBYTE bytedst;
|
|
||||||
PBYTE bytesrc;
|
|
||||||
int i;
|
|
||||||
int dlDelta = dstpsd->lDelta;
|
|
||||||
int slDelta = srcpsd->lDelta;
|
|
||||||
|
|
||||||
bytedst = (char *)dstpsd->pvBits + dsty * dlDelta;
|
|
||||||
bytesrc = (char *)srcpsd->pvBits + srcy * slDelta;
|
|
||||||
dst = (PRGBTRIPLE)bytedst + dstx;
|
|
||||||
src = (PRGBTRIPLE)bytesrc + srcx;
|
|
||||||
|
|
||||||
while(--h >= 0) {
|
|
||||||
PRGBTRIPLE d = dst;
|
|
||||||
PRGBTRIPLE s = src;
|
|
||||||
LONG dx = dstx;
|
|
||||||
LONG sx = srcx;
|
|
||||||
for(i=0; i<w; ++i) {
|
|
||||||
*d = *s;
|
|
||||||
++d;
|
|
||||||
++s;
|
|
||||||
}
|
|
||||||
dst += dlDelta;
|
|
||||||
src += slDelta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOLEAN DIB_To_24BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation)
|
XLATEOBJ *ColorTranslation)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, xColor, f1;
|
LONG i, j, sx, sy, xColor, f1;
|
||||||
PBYTE DestBits, DestLine;
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
PWORD SourceBits_16BPP, SourceLine_16BPP;
|
PWORD SourceBits_16BPP, SourceLine_16BPP;
|
||||||
|
|
||||||
DestBits = DestSurf->pvBits + (DestRect->top * DestSurf->lDelta) + DestRect->left * 3;
|
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left * 3;
|
||||||
|
|
||||||
switch(SourceGDI->BitsPerPixel)
|
switch(SourceGDI->BitsPerPixel)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +88,7 @@ BOOLEAN DIB_To_24BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
SourceBits_4BPP = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
|
||||||
|
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
|
@ -144,8 +113,31 @@ BOOLEAN DIB_To_24BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = XLATEOBJ_iXlate(ColorTranslation, *SourceBits);
|
||||||
|
*DestBits = xColor & 0xff;
|
||||||
|
*(PWORD)(DestBits + 1) = xColor >> 8;
|
||||||
|
SourceBits += 1;
|
||||||
|
DestBits += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
SourceBits_16BPP = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
SourceBits_16BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
||||||
|
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
|
@ -166,6 +158,48 @@ BOOLEAN DIB_To_24BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
||||||
|
{
|
||||||
|
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
RtlCopyMemory(DestBits, SourceBits, 3 * (DestRect->right - DestRect->left));
|
||||||
|
SourceBits += SourceSurf->lDelta;
|
||||||
|
DestBits += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
DPRINT1("DIB_24BPP_Bitblt: Unhandled ColorTranslation for 16 -> 16 copy");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = XLATEOBJ_iXlate(ColorTranslation, *((PDWORD) SourceBits));
|
||||||
|
*DestBits = xColor & 0xff;
|
||||||
|
*(PWORD)(DestBits + 1) = xColor >> 8;
|
||||||
|
SourceBits += 4;
|
||||||
|
DestBits += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
203
reactos/subsys/win32k/dib/dib32bpp.c
Normal file
203
reactos/subsys/win32k/dib/dib32bpp.c
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <win32k/bitmaps.h>
|
||||||
|
#include <win32k/debug.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <ddk/winddi.h>
|
||||||
|
#include "../eng/objects.h"
|
||||||
|
#include "dib.h"
|
||||||
|
|
||||||
|
VOID DIB_32BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
|
||||||
|
*addr = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG DIB_32BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
|
||||||
|
return (ULONG)(*addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID DIB_32BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
|
PDWORD addr = (PDWORD)byteaddr + x1;
|
||||||
|
LONG cx = x1;
|
||||||
|
|
||||||
|
while(cx < x2) {
|
||||||
|
*addr = (DWORD)c;
|
||||||
|
++addr;
|
||||||
|
++cx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID DIB_32BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
||||||
|
PDWORD addr = (PDWORD)byteaddr + x;
|
||||||
|
LONG lDelta = SurfObj->lDelta / sizeof(DWORD);
|
||||||
|
|
||||||
|
byteaddr = (PBYTE)addr;
|
||||||
|
while(y1++ < y2) {
|
||||||
|
*addr = (DWORD)c;
|
||||||
|
|
||||||
|
addr += lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN DIB_32BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation)
|
||||||
|
{
|
||||||
|
ULONG i, j, sx, sy, xColor, f1;
|
||||||
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
|
|
||||||
|
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + 4 * DestRect->left;
|
||||||
|
|
||||||
|
switch(SourceGDI->BitsPerPixel)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
sy = SourcePoint->y;
|
||||||
|
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
|
||||||
|
{
|
||||||
|
DIB_32BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
|
||||||
|
} else {
|
||||||
|
DIB_32BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
|
||||||
|
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceLine_4BPP = SourceBits_4BPP;
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
f1 = sx & 1;
|
||||||
|
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = XLATEOBJ_iXlate(ColorTranslation,
|
||||||
|
(*SourceLine_4BPP & altnotmask[sx&1]) >> (4 * (1-(sx & 1))));
|
||||||
|
DIB_32BPP_PutPixel(DestSurf, i, j, xColor);
|
||||||
|
if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceBits_4BPP += SourceSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *SourceBits;
|
||||||
|
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 1;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PWORD) SourceBits);
|
||||||
|
*((PDWORD) DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 2;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = (*(SourceBits + 2) << 0x10) +
|
||||||
|
(*(SourceBits + 1) << 0x08) +
|
||||||
|
(*(SourceBits));
|
||||||
|
*((PDWORD)DestBits) = (DWORD)XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 3;
|
||||||
|
DestBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
||||||
|
{
|
||||||
|
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
RtlCopyMemory(DestBits, SourceBits, 4 * (DestRect->right - DestRect->left));
|
||||||
|
SourceBits += SourceSurf->lDelta;
|
||||||
|
DestBits += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
DPRINT1("DIB_32BPP_Bitblt: Unhandled ColorTranslation for 32 -> 32 copy");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DbgPrint("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits;
|
PBYTE addr = SurfObj->pvScan0;
|
||||||
|
|
||||||
addr += (x>>1) + y * SurfObj->lDelta;
|
addr += (x>>1) + y * SurfObj->lDelta;
|
||||||
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
|
||||||
|
@ -18,14 +18,14 @@ VOID DIB_4BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
|
||||||
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
ULONG DIB_4BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits;
|
PBYTE addr = SurfObj->pvScan0;
|
||||||
|
|
||||||
return (addr[(x>>1) + y * SurfObj->lDelta] >> ((1-(x&1))<<2) ) & 0x0f;
|
return (addr[(x>>1) + y * SurfObj->lDelta] >> ((1-(x&1))<<2) ) & 0x0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
VOID DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits + (x1>>1) + y * SurfObj->lDelta;
|
PBYTE addr = SurfObj->pvScan0 + (x1>>1) + y * SurfObj->lDelta;
|
||||||
LONG cx = x1;
|
LONG cx = x1;
|
||||||
|
|
||||||
while(cx < x2) {
|
while(cx < x2) {
|
||||||
|
@ -38,7 +38,7 @@ VOID DIB_4BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
|
||||||
VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
{
|
{
|
||||||
PBYTE addr = SurfObj->pvBits;
|
PBYTE addr = SurfObj->pvScan0;
|
||||||
int lDelta = SurfObj->lDelta;
|
int lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
addr += (x>>1) + y1 * lDelta;
|
addr += (x>>1) + y1 * lDelta;
|
||||||
|
@ -48,16 +48,17 @@ VOID DIB_4BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
BOOLEAN DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation)
|
XLATEOBJ *ColorTranslation)
|
||||||
{
|
{
|
||||||
LONG i, j, sx, sy, f1, f2, xColor;
|
LONG i, j, sx, sy, f1, f2, xColor;
|
||||||
PBYTE SourceBits_24BPP, SourceLine_24BPP;
|
PBYTE SourceBits_24BPP, SourceLine_24BPP;
|
||||||
PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
|
PBYTE DestBits, DestLine, SourceBits_8BPP, SourceLine_8BPP;
|
||||||
|
PBYTE SourceBits, SourceLine;
|
||||||
|
|
||||||
DestBits = DestSurf->pvBits + (DestRect->left>>1) + DestRect->top * DestSurf->lDelta;
|
DestBits = DestSurf->pvScan0 + (DestRect->left>>1) + DestRect->top * DestSurf->lDelta;
|
||||||
|
|
||||||
switch(SourceGDI->BitsPerPixel)
|
switch(SourceGDI->BitsPerPixel)
|
||||||
{
|
{
|
||||||
|
@ -99,23 +100,20 @@ BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
SourceBits_8BPP = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
SourceBits_8BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
||||||
|
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
SourceLine_8BPP = SourceBits_8BPP;
|
SourceLine_8BPP = SourceBits_8BPP;
|
||||||
DestLine = DestBits;
|
DestLine = DestBits;
|
||||||
sx = SourcePoint->x;
|
|
||||||
f1 = sx & 1;
|
|
||||||
f2 = DestRect->left & 1;
|
f2 = DestRect->left & 1;
|
||||||
|
|
||||||
for (i=DestRect->left; i<DestRect->right; i++)
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
{
|
{
|
||||||
*DestLine = (*DestLine & notmask[i&1]) |
|
*DestLine = (*DestLine & notmask[i&1]) |
|
||||||
((XLATEOBJ_iXlate(ColorTranslation, *SourceLine_8BPP)) << ((4 * (1-(sx & 1)))));
|
((XLATEOBJ_iXlate(ColorTranslation, *SourceLine_8BPP)) << ((4 * (1-(i & 1)))));
|
||||||
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
|
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
|
||||||
SourceLine_8BPP++;
|
SourceLine_8BPP++;
|
||||||
sx++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceBits_8BPP += SourceSurf->lDelta;
|
SourceBits_8BPP += SourceSurf->lDelta;
|
||||||
|
@ -123,15 +121,37 @@ BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
f2 = DestRect->left & 1;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PWORD) SourceBits);
|
||||||
|
*DestBits = (*DestBits & notmask[i&1]) |
|
||||||
|
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1-(i & 1)))));
|
||||||
|
if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
|
||||||
|
SourceBits += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
SourceBits_24BPP = SourceSurf->pvBits + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x * 3;
|
SourceBits_24BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x * 3;
|
||||||
|
|
||||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
{
|
{
|
||||||
SourceLine_24BPP = SourceBits_24BPP;
|
SourceLine_24BPP = SourceBits_24BPP;
|
||||||
DestLine = DestBits;
|
DestLine = DestBits;
|
||||||
sx = SourcePoint->x;
|
|
||||||
f1 = sx & 1;
|
|
||||||
f2 = DestRect->left & 1;
|
f2 = DestRect->left & 1;
|
||||||
|
|
||||||
for (i=DestRect->left; i<DestRect->right; i++)
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
@ -140,10 +160,9 @@ BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
(*(SourceLine_24BPP + 1) << 0x08) +
|
(*(SourceLine_24BPP + 1) << 0x08) +
|
||||||
(*(SourceLine_24BPP));
|
(*(SourceLine_24BPP));
|
||||||
*DestLine = (*DestLine & notmask[i&1]) |
|
*DestLine = (*DestLine & notmask[i&1]) |
|
||||||
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1-(sx & 1)))));
|
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1-(i & 1)))));
|
||||||
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
|
if(f2 == 1) { DestLine++; f2 = 0; } else { f2 = 1; }
|
||||||
SourceLine_24BPP+=3;
|
SourceLine_24BPP+=3;
|
||||||
sx++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceBits_24BPP += SourceSurf->lDelta;
|
SourceBits_24BPP += SourceSurf->lDelta;
|
||||||
|
@ -151,6 +170,30 @@ BOOLEAN DIB_To_4BPP_Bitblt( SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
f2 = DestRect->left & 1;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PDWORD) SourceBits);
|
||||||
|
*DestBits = (*DestBits & notmask[i&1]) |
|
||||||
|
((XLATEOBJ_iXlate(ColorTranslation, xColor)) << ((4 * (1-(i & 1)))));
|
||||||
|
if(f2 == 1) { DestBits++; f2 = 0; } else { f2 = 1; }
|
||||||
|
SourceBits += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
201
reactos/subsys/win32k/dib/dib8bpp.c
Normal file
201
reactos/subsys/win32k/dib/dib8bpp.c
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <win32k/bitmaps.h>
|
||||||
|
#include <win32k/debug.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <ddk/winddi.h>
|
||||||
|
#include "../eng/objects.h"
|
||||||
|
#include "dib.h"
|
||||||
|
|
||||||
|
VOID DIB_8BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta + x;
|
||||||
|
|
||||||
|
*byteaddr = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG DIB_8BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta + x;
|
||||||
|
|
||||||
|
return (ULONG)(*byteaddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID DIB_8BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
|
||||||
|
PBYTE addr = byteaddr + x1;
|
||||||
|
LONG cx = x1;
|
||||||
|
|
||||||
|
while(cx < x2) {
|
||||||
|
*addr = c;
|
||||||
|
++addr;
|
||||||
|
++cx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID DIB_8BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
{
|
||||||
|
PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
|
||||||
|
PBYTE addr = byteaddr + x;
|
||||||
|
LONG lDelta = SurfObj->lDelta;
|
||||||
|
|
||||||
|
byteaddr = addr;
|
||||||
|
while(y1++ < y2) {
|
||||||
|
*addr = c;
|
||||||
|
|
||||||
|
addr += lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation)
|
||||||
|
{
|
||||||
|
ULONG i, j, sx, sy, xColor, f1;
|
||||||
|
PBYTE SourceBits, DestBits, SourceLine, DestLine;
|
||||||
|
PBYTE SourceBits_4BPP, SourceLine_4BPP;
|
||||||
|
|
||||||
|
DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left;
|
||||||
|
|
||||||
|
switch(SourceGDI->BitsPerPixel)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
sy = SourcePoint->y;
|
||||||
|
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
|
||||||
|
{
|
||||||
|
DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
|
||||||
|
} else {
|
||||||
|
DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
|
||||||
|
}
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
sy++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
|
||||||
|
|
||||||
|
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceLine_4BPP = SourceBits_4BPP;
|
||||||
|
sx = SourcePoint->x;
|
||||||
|
f1 = sx & 1;
|
||||||
|
|
||||||
|
for (i=DestRect->left; i<DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = XLATEOBJ_iXlate(ColorTranslation,
|
||||||
|
(*SourceLine_4BPP & altnotmask[sx&1]) >> (4 * (1-(sx & 1))));
|
||||||
|
DIB_8BPP_PutPixel(DestSurf, i, j, xColor);
|
||||||
|
if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
|
||||||
|
sx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceBits_4BPP += SourceSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
|
||||||
|
{
|
||||||
|
SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
RtlCopyMemory(DestBits, SourceBits, DestRect->right - DestRect->left);
|
||||||
|
SourceBits += SourceSurf->lDelta;
|
||||||
|
DestBits += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FIXME */
|
||||||
|
DPRINT1("DIB_8BPP_Bitblt: Unhandled ColorTranslation for 32 -> 32 copy");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PWORD) SourceBits);
|
||||||
|
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 2;
|
||||||
|
DestBits += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = (*(SourceBits + 2) << 0x10) +
|
||||||
|
(*(SourceBits + 1) << 0x08) +
|
||||||
|
(*(SourceBits));
|
||||||
|
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 3;
|
||||||
|
DestBits += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
|
||||||
|
DestLine = DestBits;
|
||||||
|
|
||||||
|
for (j = DestRect->top; j < DestRect->bottom; j++)
|
||||||
|
{
|
||||||
|
SourceBits = SourceLine;
|
||||||
|
DestBits = DestLine;
|
||||||
|
|
||||||
|
for (i = DestRect->left; i < DestRect->right; i++)
|
||||||
|
{
|
||||||
|
xColor = *((PDWORD) SourceBits);
|
||||||
|
*DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
|
||||||
|
SourceBits += 4;
|
||||||
|
DestBits += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceLine += SourceSurf->lDelta;
|
||||||
|
DestLine += DestSurf->lDelta;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
DbgPrint("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -53,34 +53,8 @@ BltMask(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
{
|
{
|
||||||
LONG i, j, dx, dy, c8;
|
LONG i, j, dx, dy, c8;
|
||||||
BYTE *tMask, *lMask;
|
BYTE *tMask, *lMask;
|
||||||
PFN_DIB_PutPixel DIB_PutPixel;
|
|
||||||
static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
static BYTE maskbit[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
||||||
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
|
||||||
switch(BitsPerFormat(Dest->iBitmapFormat))
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_1BPP_PutPixel;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_4BPP_PutPixel;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_16BPP_PutPixel;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_24BPP_PutPixel;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DbgPrint("BltMask: unsupported DIB format %u (bitsPerPixel:%u)\n", Dest->iBitmapFormat,
|
|
||||||
BitsPerFormat(Dest->iBitmapFormat));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dx = DestRect->right - DestRect->left;
|
dx = DestRect->right - DestRect->left;
|
||||||
dy = DestRect->bottom - DestRect->top;
|
dy = DestRect->bottom - DestRect->top;
|
||||||
|
|
||||||
|
@ -95,7 +69,7 @@ BltMask(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
{
|
{
|
||||||
if (0 != (*lMask & maskbit[c8]))
|
if (0 != (*lMask & maskbit[c8]))
|
||||||
{
|
{
|
||||||
DIB_PutPixel(Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
|
DestGDI->DIB_PutPixel(Dest, DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
|
||||||
}
|
}
|
||||||
c8++;
|
c8++;
|
||||||
if (8 == c8)
|
if (8 == c8)
|
||||||
|
@ -121,37 +95,13 @@ BltPatCopy(SURFOBJ *Dest, PSURFGDI DestGDI, SURFOBJ *Mask,
|
||||||
{
|
{
|
||||||
// These functions are assigned if we're working with a DIB
|
// These functions are assigned if we're working with a DIB
|
||||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
// The assigned functions depend on the bitsPerPixel of the DIB
|
||||||
PFN_DIB_HLine DIB_HLine;
|
|
||||||
LONG y;
|
LONG y;
|
||||||
ULONG LineWidth;
|
ULONG LineWidth;
|
||||||
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
|
||||||
DPRINT("BPF: %d\n", BitsPerFormat(Dest->iBitmapFormat));
|
|
||||||
switch(BitsPerFormat(Dest->iBitmapFormat))
|
|
||||||
{
|
|
||||||
case 4:
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_4BPP_HLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_16BPP_HLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_24BPP_HLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DbgPrint("BltPatCopy: unsupported DIB format %u (bitsPerPixel:%u)\n", Dest->iBitmapFormat,
|
|
||||||
BitsPerFormat(Dest->iBitmapFormat));
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LineWidth = DestRect->right - DestRect->left;
|
LineWidth = DestRect->right - DestRect->left;
|
||||||
for (y = DestRect->top; y < DestRect->bottom; y++)
|
for (y = DestRect->top; y < DestRect->bottom; y++)
|
||||||
{
|
{
|
||||||
DIB_HLine(Dest, DestRect->left, DestRect->right, y, Brush->iSolidColor);
|
DestGDI->DIB_HLine(Dest, DestRect->left, DestRect->right, y, Brush->iSolidColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -284,7 +234,7 @@ EngBitBlt(SURFOBJ *DestObj,
|
||||||
switch(clippingType)
|
switch(clippingType)
|
||||||
{
|
{
|
||||||
case DC_TRIVIAL:
|
case DC_TRIVIAL:
|
||||||
CopyBitsCopy(OutputObj, InputObj, OutputGDI, InputGDI, &OutputRect, &InputPoint, InputObj->lDelta, ColorTranslation);
|
OutputGDI->DIB_BitBlt(OutputObj, InputObj, OutputGDI, InputGDI, &OutputRect, &InputPoint, ColorTranslation);
|
||||||
|
|
||||||
IntEngLeave(&EnterLeaveDest);
|
IntEngLeave(&EnterLeaveDest);
|
||||||
IntEngLeave(&EnterLeaveSource);
|
IntEngLeave(&EnterLeaveSource);
|
||||||
|
|
|
@ -16,51 +16,6 @@
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/eng.h>
|
#include <include/eng.h>
|
||||||
|
|
||||||
BOOLEAN CopyBitsCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|
||||||
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
|
||||||
PRECTL DestRect, POINTL *SourcePoint,
|
|
||||||
LONG Delta, XLATEOBJ *ColorTranslation)
|
|
||||||
{
|
|
||||||
LONG DestWidth, DestHeight, CurrentDestLine, CurrentSourceLine, CurrentDestCol, CurrentSourceCol, i, TranslationPixel;
|
|
||||||
|
|
||||||
PFN_DIB_GetPixel Source_DIB_GetPixel;
|
|
||||||
PFN_DIB_PutPixel Dest_DIB_PutPixel;
|
|
||||||
|
|
||||||
DestWidth = DestRect->right - DestRect->left;
|
|
||||||
DestHeight = DestRect->bottom - DestRect->top;
|
|
||||||
CurrentSourceCol = SourcePoint->x;
|
|
||||||
CurrentSourceLine = SourcePoint->y;
|
|
||||||
|
|
||||||
// Assign GetPixel DIB function according to bytes per pixel
|
|
||||||
switch(DestGDI->BitsPerPixel)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
return DIB_To_1BPP_Bitblt(DestSurf, SourceSurf, DestGDI, SourceGDI,
|
|
||||||
DestRect, SourcePoint, Delta, ColorTranslation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
return DIB_To_4BPP_Bitblt(DestSurf, SourceSurf, DestGDI, SourceGDI,
|
|
||||||
DestRect, SourcePoint, Delta, ColorTranslation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
return DIB_To_16BPP_Bitblt(DestSurf, SourceSurf, DestGDI, SourceGDI,
|
|
||||||
DestRect, SourcePoint, Delta, ColorTranslation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
return DIB_To_24BPP_Bitblt(DestSurf, SourceSurf, DestGDI, SourceGDI,
|
|
||||||
DestRect, SourcePoint, Delta, ColorTranslation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
EngCopyBits(SURFOBJ *Dest,
|
EngCopyBits(SURFOBJ *Dest,
|
||||||
SURFOBJ *Source,
|
SURFOBJ *Source,
|
||||||
|
@ -151,7 +106,7 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
switch(clippingType)
|
switch(clippingType)
|
||||||
{
|
{
|
||||||
case DC_TRIVIAL:
|
case DC_TRIVIAL:
|
||||||
CopyBitsCopy(Dest, Source, DestGDI, SourceGDI, DestRect, SourcePoint, Source->lDelta, ColorTranslation);
|
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, DestRect, SourcePoint, ColorTranslation);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
||||||
|
@ -165,7 +120,7 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
|
ptlTmp.x = SourcePoint->x + rclTmp.left - DestRect->left;
|
||||||
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
|
ptlTmp.y = SourcePoint->y + rclTmp.top - DestRect->top;
|
||||||
|
|
||||||
CopyBitsCopy(Dest, Source, DestGDI, SourceGDI, &rclTmp, &ptlTmp, Source->lDelta, ColorTranslation);
|
DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI, &rclTmp, &ptlTmp, ColorTranslation);
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
MouseSafetyOnDrawEnd(Source, SourceGDI);
|
||||||
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
MouseSafetyOnDrawEnd(Dest, DestGDI);
|
||||||
|
@ -190,8 +145,8 @@ EngCopyBits(SURFOBJ *Dest,
|
||||||
ptlTmp.x = SourcePoint->x + prcl->left - DestRect->left;
|
ptlTmp.x = SourcePoint->x + prcl->left - DestRect->left;
|
||||||
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
|
ptlTmp.y = SourcePoint->y + prcl->top - DestRect->top;
|
||||||
|
|
||||||
if(!CopyBitsCopy(Dest, Source, DestGDI, SourceGDI,
|
if(!DestGDI->DIB_BitBlt(Dest, Source, DestGDI, SourceGDI,
|
||||||
prcl, &ptlTmp, Source->lDelta, ColorTranslation)) return FALSE;
|
prcl, &ptlTmp, ColorTranslation)) return FALSE;
|
||||||
|
|
||||||
prcl++;
|
prcl++;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ ULONG CreateGDIHandle(ULONG InternalSize, ULONG UserSize)
|
||||||
pObj->hObj = i;
|
pObj->hObj = i;
|
||||||
GDIHandles[ i ].pEngObj = pObj;
|
GDIHandles[ i ].pEngObj = pObj;
|
||||||
DPRINT("CreateGDIHandle: obj: %x, handle: %d, usersize: %d\n", pObj, i, UserSize );
|
DPRINT("CreateGDIHandle: obj: %x, handle: %d, usersize: %d\n", pObj, i, UserSize );
|
||||||
|
if (15 == i)
|
||||||
|
i = 15;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +111,6 @@ VOID InitEngHandleTable( void )
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
for( i=1; i < MAX_GDI_HANDLES; i++ ){
|
for( i=1; i < MAX_GDI_HANDLES; i++ ){
|
||||||
GDIHandles[ i ].pEngObj == NULL;
|
GDIHandles[ i ].pEngObj = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,11 @@ EngLineTo(SURFOBJ *DestObj,
|
||||||
LONG x, y, deltax, deltay, i, xchange, ychange, error, hx, vy;
|
LONG x, y, deltax, deltay, i, xchange, ychange, error, hx, vy;
|
||||||
ULONG Pixel = Brush->iSolidColor;
|
ULONG Pixel = Brush->iSolidColor;
|
||||||
SURFOBJ *OutputObj;
|
SURFOBJ *OutputObj;
|
||||||
|
SURFGDI *OutputGDI;
|
||||||
RECTL DestRect;
|
RECTL DestRect;
|
||||||
POINTL Translate;
|
POINTL Translate;
|
||||||
INTENG_ENTER_LEAVE EnterLeave;
|
INTENG_ENTER_LEAVE EnterLeave;
|
||||||
|
|
||||||
// These functions are assigned if we're working with a DIB
|
|
||||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
|
||||||
PFN_DIB_PutPixel DIB_PutPixel;
|
|
||||||
PFN_DIB_HLine DIB_HLine;
|
|
||||||
PFN_DIB_VLine DIB_VLine;
|
|
||||||
|
|
||||||
DestRect.left = x1;
|
DestRect.left = x1;
|
||||||
if (x1 != x2)
|
if (x1 != x2)
|
||||||
{
|
{
|
||||||
|
@ -62,38 +57,7 @@ EngLineTo(SURFOBJ *DestObj,
|
||||||
y1 += Translate.y;
|
y1 += Translate.y;
|
||||||
y2 += Translate.y;
|
y2 += Translate.y;
|
||||||
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
OutputGDI = AccessInternalObjectFromUserObject(OutputObj);
|
||||||
switch(BitsPerFormat(OutputObj->iBitmapFormat))
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_1BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_1BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_1BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_4BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_4BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_4BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_16BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_16BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_16BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_24BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_24BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_24BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DbgPrint("EngLineTo: unsupported DIB format %u (bitsPerPixel:%u)\n", OutputObj->iBitmapFormat,
|
|
||||||
BitsPerFormat(OutputObj->iBitmapFormat));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Implement clipping
|
// FIXME: Implement clipping
|
||||||
x = x1;
|
x = x1;
|
||||||
|
@ -129,11 +93,11 @@ EngLineTo(SURFOBJ *DestObj,
|
||||||
|
|
||||||
if (y1 == y2)
|
if (y1 == y2)
|
||||||
{
|
{
|
||||||
DIB_HLine(OutputObj, hx, hx + deltax, y1, Pixel);
|
OutputGDI->DIB_HLine(OutputObj, hx, hx + deltax, y1, Pixel);
|
||||||
}
|
}
|
||||||
else if (x1 == x2)
|
else if (x1 == x2)
|
||||||
{
|
{
|
||||||
DIB_VLine(OutputObj, x1, vy, vy + deltay, Pixel);
|
OutputGDI->DIB_VLine(OutputObj, x1, vy, vy + deltay, Pixel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -143,7 +107,7 @@ EngLineTo(SURFOBJ *DestObj,
|
||||||
{
|
{
|
||||||
for (i = 0; i < deltay; i++)
|
for (i = 0; i < deltay; i++)
|
||||||
{
|
{
|
||||||
DIB_PutPixel(OutputObj, x, y, Pixel);
|
OutputGDI->DIB_PutPixel(OutputObj, x, y, Pixel);
|
||||||
y = y + ychange;
|
y = y + ychange;
|
||||||
error = error + deltax;
|
error = error + deltax;
|
||||||
|
|
||||||
|
@ -158,7 +122,7 @@ EngLineTo(SURFOBJ *DestObj,
|
||||||
{
|
{
|
||||||
for (i = 0; i < deltax; i++)
|
for (i = 0; i < deltax; i++)
|
||||||
{
|
{
|
||||||
DIB_PutPixel(OutputObj, x, y, Pixel);
|
OutputGDI->DIB_PutPixel(OutputObj, x, y, Pixel);
|
||||||
x = x + xchange;
|
x = x + xchange;
|
||||||
error = error + deltay;
|
error = error + deltay;
|
||||||
if (deltax <= error)
|
if (deltax <= error)
|
||||||
|
|
|
@ -138,12 +138,25 @@ typedef HBITMAP STDCALL (*PFN_CreateDeviceBitmap)(DHPDEV, SIZEL, ULONG);
|
||||||
|
|
||||||
typedef BOOL STDCALL (*PFN_SetPalette)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
|
typedef BOOL STDCALL (*PFN_SetPalette)(DHPDEV, PALOBJ*, ULONG, ULONG, ULONG);
|
||||||
|
|
||||||
|
/* Forward declare (circular reference) */
|
||||||
|
typedef struct _SURFGDI *PSURFGDI;
|
||||||
|
|
||||||
|
typedef VOID (*PFN_DIB_PutPixel)(PSURFOBJ, LONG, LONG, ULONG);
|
||||||
|
typedef ULONG (*PFN_DIB_GetPixel)(PSURFOBJ, LONG, LONG);
|
||||||
|
typedef VOID (*PFN_DIB_HLine) (PSURFOBJ, LONG, LONG, LONG, ULONG);
|
||||||
|
typedef VOID (*PFN_DIB_VLine) (PSURFOBJ, LONG, LONG, LONG, ULONG);
|
||||||
|
typedef BOOLEAN (*PFN_DIB_BitBlt) (PSURFOBJ DestSurf, PSURFOBJ SourceSurf,
|
||||||
|
PSURFGDI DestGDI, PSURFGDI SourceGDI,
|
||||||
|
PRECTL DestRect, PPOINTL SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation);
|
||||||
|
|
||||||
typedef struct _SURFGDI {
|
typedef struct _SURFGDI {
|
||||||
ENGOBJ Header;
|
ENGOBJ Header;
|
||||||
SURFOBJ SurfObj;
|
SURFOBJ SurfObj;
|
||||||
|
|
||||||
INT BitsPerPixel;
|
INT BitsPerPixel;
|
||||||
|
|
||||||
|
/* Driver functions */
|
||||||
PFN_BitBlt BitBlt;
|
PFN_BitBlt BitBlt;
|
||||||
PFN_TransparentBlt TransparentBlt;
|
PFN_TransparentBlt TransparentBlt;
|
||||||
PFN_StretchBlt StretchBlt;
|
PFN_StretchBlt StretchBlt;
|
||||||
|
@ -160,7 +173,13 @@ typedef struct _SURFGDI {
|
||||||
PFN_SetPalette SetPalette;
|
PFN_SetPalette SetPalette;
|
||||||
PFN_MovePointer MovePointer;
|
PFN_MovePointer MovePointer;
|
||||||
PFN_SetPointerShape SetPointerShape;
|
PFN_SetPointerShape SetPointerShape;
|
||||||
} SURFGDI, *PSURFGDI;
|
|
||||||
|
/* DIB functions */
|
||||||
|
PFN_DIB_PutPixel DIB_PutPixel;
|
||||||
|
PFN_DIB_HLine DIB_HLine;
|
||||||
|
PFN_DIB_VLine DIB_VLine;
|
||||||
|
PFN_DIB_BitBlt DIB_BitBlt;
|
||||||
|
} SURFGDI;
|
||||||
|
|
||||||
typedef struct _XFORMGDI {
|
typedef struct _XFORMGDI {
|
||||||
ENGOBJ Header;
|
ENGOBJ Header;
|
||||||
|
|
|
@ -25,62 +25,17 @@
|
||||||
|
|
||||||
BOOL FillSolid(SURFOBJ *Surface, PRECTL pRect, ULONG iColor)
|
BOOL FillSolid(SURFOBJ *Surface, PRECTL pRect, ULONG iColor)
|
||||||
{
|
{
|
||||||
// These functions are assigned if we're working with a DIB
|
|
||||||
// The assigned functions depend on the bitsPerPixel of the DIB
|
|
||||||
PFN_DIB_PutPixel DIB_PutPixel;
|
|
||||||
PFN_DIB_HLine DIB_HLine;
|
|
||||||
PFN_DIB_VLine DIB_VLine;
|
|
||||||
LONG y;
|
LONG y;
|
||||||
ULONG x, LineWidth, leftOfBitmap;
|
ULONG LineWidth;
|
||||||
SURFGDI *SurfaceGDI;
|
SURFGDI *SurfaceGDI;
|
||||||
|
|
||||||
SurfaceGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
SurfaceGDI = (SURFGDI*)AccessInternalObjectFromUserObject(Surface);
|
||||||
MouseSafetyOnDrawStart(Surface, SurfaceGDI, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
MouseSafetyOnDrawStart(Surface, SurfaceGDI, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
||||||
/*
|
|
||||||
if(Surface->iType!=STYPE_BITMAP)
|
|
||||||
{
|
|
||||||
// Call the driver's DrvLineTo
|
|
||||||
ret = SurfGDI->LineTo(Surface, Clip, Brush, x1, y1, x2, y2, RectBounds, mix);
|
|
||||||
MouseSafetyOnDrawEnd(Surface, SurfGDI);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Assign DIB functions according to bytes per pixel
|
|
||||||
DPRINT("BPF: %d\n", BitsPerFormat(Surface->iBitmapFormat));
|
|
||||||
switch(BitsPerFormat(Surface->iBitmapFormat))
|
|
||||||
{
|
|
||||||
case 4:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_4BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_4BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_4BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_16BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_16BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_16BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
DIB_PutPixel = (PFN_DIB_PutPixel)DIB_24BPP_PutPixel;
|
|
||||||
DIB_HLine = (PFN_DIB_HLine)DIB_24BPP_HLine;
|
|
||||||
DIB_VLine = (PFN_DIB_VLine)DIB_24BPP_VLine;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
DbgPrint("FillSolid: unsupported DIB format %u (bitsPerPixel:%u)\n", Surface->iBitmapFormat,
|
|
||||||
BitsPerFormat(Surface->iBitmapFormat));
|
|
||||||
|
|
||||||
MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
LineWidth = pRect->right - pRect->left;
|
LineWidth = pRect->right - pRect->left;
|
||||||
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
DPRINT(" LineWidth: %d, top: %d, bottom: %d\n", LineWidth, pRect->top, pRect->bottom);
|
||||||
for (y = pRect->top; y < pRect->bottom; y++)
|
for (y = pRect->top; y < pRect->bottom; y++)
|
||||||
{
|
{
|
||||||
//EngLineTo(Surface, SurfaceGDI, Dimensions->left, y, LineWidth, iColor);
|
SurfaceGDI->DIB_HLine(Surface, pRect->left, pRect->right, y, iColor);
|
||||||
DIB_HLine(Surface, pRect->left, pRect->right, y, iColor);
|
|
||||||
}
|
}
|
||||||
MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
|
MouseSafetyOnDrawEnd(Surface, SurfaceGDI);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ EngCreatePalette(ULONG Mode,
|
||||||
if( !ValidEngHandle( NewPalette ) )
|
if( !ValidEngHandle( NewPalette ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
PalGDI = (PALGDI*) AccessInternalObject( NewPalette );
|
PalGDI = (PALGDI*) AccessInternalObject( (ULONG) NewPalette );
|
||||||
ASSERT( PalGDI );
|
ASSERT( PalGDI );
|
||||||
|
|
||||||
PalGDI->Mode = Mode;
|
PalGDI->Mode = Mode;
|
||||||
|
@ -68,7 +68,7 @@ PALOBJ_cGetColors(PALOBJ *PalObj,
|
||||||
ULONG Colors,
|
ULONG Colors,
|
||||||
ULONG *PaletteEntry)
|
ULONG *PaletteEntry)
|
||||||
{
|
{
|
||||||
ULONG i, entry;
|
ULONG i;
|
||||||
PALGDI *PalGDI;
|
PALGDI *PalGDI;
|
||||||
|
|
||||||
PalGDI = (PALGDI*)AccessInternalObjectFromUserObject(PalObj);
|
PalGDI = (PALGDI*)AccessInternalObjectFromUserObject(PalObj);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <include/object.h>
|
#include <include/object.h>
|
||||||
#include <include/paint.h>
|
#include <include/paint.h>
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
#include "../dib/dib.h"
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
@ -60,13 +61,94 @@ ULONG BitmapFormat(WORD Bits, DWORD Compression)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID InitializeHooks(SURFGDI *SurfGDI)
|
static VOID Dummy_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID Dummy_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static VOID Dummy_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||||
|
SURFGDI *DestGDI, SURFGDI *SourceGDI,
|
||||||
|
PRECTL DestRect, POINTL *SourcePoint,
|
||||||
|
XLATEOBJ *ColorTranslation)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
|
||||||
{
|
{
|
||||||
SurfGDI->BitBlt = NULL;
|
SurfGDI->BitBlt = NULL;
|
||||||
SurfGDI->CopyBits = NULL;
|
SurfGDI->CopyBits = NULL;
|
||||||
SurfGDI->CreateDeviceBitmap = NULL;
|
SurfGDI->CreateDeviceBitmap = NULL;
|
||||||
SurfGDI->SetPalette = NULL;
|
SurfGDI->SetPalette = NULL;
|
||||||
SurfGDI->TransparentBlt = NULL;
|
SurfGDI->TransparentBlt = NULL;
|
||||||
|
|
||||||
|
switch(BitmapFormat)
|
||||||
|
{
|
||||||
|
case BMF_1BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_1BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_1BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_1BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_1BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_4BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_4BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_4BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_4BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_4BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_8BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_8BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_8BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_8BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_8BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_16BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_16BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_16BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_16BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_16BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_24BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_24BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_24BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_24BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_24BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_32BPP:
|
||||||
|
SurfGDI->DIB_PutPixel = DIB_32BPP_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = DIB_32BPP_HLine;
|
||||||
|
SurfGDI->DIB_VLine = DIB_32BPP_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = DIB_32BPP_BitBlt;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BMF_4RLE:
|
||||||
|
case BMF_8RLE:
|
||||||
|
/* Not supported yet, fall through to unrecognized case */
|
||||||
|
default:
|
||||||
|
DPRINT1("InitializeFuncs: unsupported DIB format %d\n",
|
||||||
|
BitmapFormat);
|
||||||
|
|
||||||
|
SurfGDI->DIB_PutPixel = Dummy_PutPixel;
|
||||||
|
SurfGDI->DIB_HLine = Dummy_HLine;
|
||||||
|
SurfGDI->DIB_VLine = Dummy_VLine;
|
||||||
|
SurfGDI->DIB_BitBlt = Dummy_BitBlt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HBITMAP STDCALL
|
HBITMAP STDCALL
|
||||||
|
@ -100,13 +182,11 @@ EngCreateBitmap(IN SIZEL Size,
|
||||||
if( !ValidEngHandle( NewBitmap ) )
|
if( !ValidEngHandle( NewBitmap ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SurfObj = (SURFOBJ*) AccessUserObject( NewBitmap );
|
SurfObj = (SURFOBJ*) AccessUserObject( (ULONG) NewBitmap );
|
||||||
SurfGDI = (SURFGDI*) AccessInternalObject( NewBitmap );
|
SurfGDI = (SURFGDI*) AccessInternalObject( (ULONG) NewBitmap );
|
||||||
ASSERT( SurfObj );
|
ASSERT( SurfObj );
|
||||||
ASSERT( SurfGDI );
|
ASSERT( SurfGDI );
|
||||||
|
|
||||||
InitializeHooks(SurfGDI);
|
|
||||||
|
|
||||||
SurfGDI->BitsPerPixel = BitsPerFormat(Format);
|
SurfGDI->BitsPerPixel = BitsPerFormat(Format);
|
||||||
SurfObj->lDelta = Width;
|
SurfObj->lDelta = Width;
|
||||||
SurfObj->cjBits = SurfObj->lDelta * Size.cy;
|
SurfObj->cjBits = SurfObj->lDelta * Size.cy;
|
||||||
|
@ -136,6 +216,8 @@ EngCreateBitmap(IN SIZEL Size,
|
||||||
SurfObj->iType = STYPE_BITMAP;
|
SurfObj->iType = STYPE_BITMAP;
|
||||||
SurfObj->pvScan0 = SurfObj->pvBits;
|
SurfObj->pvScan0 = SurfObj->pvBits;
|
||||||
|
|
||||||
|
InitializeFuncs(SurfGDI, Format);
|
||||||
|
|
||||||
// Use flags to determine bitmap type -- TOP_DOWN or whatever
|
// Use flags to determine bitmap type -- TOP_DOWN or whatever
|
||||||
|
|
||||||
return NewBitmap;
|
return NewBitmap;
|
||||||
|
@ -154,13 +236,11 @@ EngCreateDeviceSurface(IN DHSURF dhsurf,
|
||||||
if( !ValidEngHandle( NewSurface ) )
|
if( !ValidEngHandle( NewSurface ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
SurfObj = (SURFOBJ*) AccessUserObject( NewSurface );
|
SurfObj = (SURFOBJ*) AccessUserObject( (ULONG) NewSurface );
|
||||||
SurfGDI = (SURFGDI*) AccessInternalObject( NewSurface );
|
SurfGDI = (SURFGDI*) AccessInternalObject( (ULONG) NewSurface );
|
||||||
ASSERT( SurfObj );
|
ASSERT( SurfObj );
|
||||||
ASSERT( SurfGDI );
|
ASSERT( SurfGDI );
|
||||||
|
|
||||||
InitializeHooks(SurfGDI);
|
|
||||||
|
|
||||||
SurfGDI->BitsPerPixel = BitsPerFormat(Format);
|
SurfGDI->BitsPerPixel = BitsPerFormat(Format);
|
||||||
SurfObj->dhsurf = dhsurf;
|
SurfObj->dhsurf = dhsurf;
|
||||||
SurfObj->hsurf = dhsurf; // FIXME: Is this correct??
|
SurfObj->hsurf = dhsurf; // FIXME: Is this correct??
|
||||||
|
@ -169,6 +249,8 @@ EngCreateDeviceSurface(IN DHSURF dhsurf,
|
||||||
SurfObj->lDelta = DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format));
|
SurfObj->lDelta = DIB_GetDIBWidthBytes(Size.cx, BitsPerFormat(Format));
|
||||||
SurfObj->iType = STYPE_DEVICE;
|
SurfObj->iType = STYPE_DEVICE;
|
||||||
|
|
||||||
|
InitializeFuncs(SurfGDI, Format);
|
||||||
|
|
||||||
return NewSurface;
|
return NewSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,13 @@ ULONG BGRtoULONG(BYTE Blue, BYTE Green, BYTE Red)
|
||||||
// then we should cache more than one value. Same with the source.
|
// then we should cache more than one value. Same with the source.
|
||||||
|
|
||||||
// Takes indexed palette and a
|
// Takes indexed palette and a
|
||||||
ULONG ClosestColorMatch(ULONG SourceColor, ULONG *DestColors,
|
ULONG ClosestColorMatch(XLATEOBJ *XlateObj, ULONG SourceColor, ULONG *DestColors,
|
||||||
ULONG NumColors)
|
ULONG NumColors)
|
||||||
{
|
{
|
||||||
PVIDEO_CLUTDATA cSourceColor;
|
PVIDEO_CLUTDATA cSourceColor;
|
||||||
PVIDEO_CLUTDATA cDestColors;
|
PVIDEO_CLUTDATA cDestColors;
|
||||||
LONG idx = 0, i, rt;
|
LONG idx = 0, i, rt;
|
||||||
|
ULONG SourceRed, SourceGreen, SourceBlue;
|
||||||
ULONG cxRed, cxGreen, cxBlue, BestMatch = 16777215;
|
ULONG cxRed, cxGreen, cxBlue, BestMatch = 16777215;
|
||||||
|
|
||||||
// Simple cache -- only one value because we don't want to waste time
|
// Simple cache -- only one value because we don't want to waste time
|
||||||
|
@ -53,16 +54,29 @@ ULONG ClosestColorMatch(ULONG SourceColor, ULONG *DestColors,
|
||||||
return CCMLastColorMatch;
|
return CCMLastColorMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
cSourceColor = (PVIDEO_CLUTDATA)&SourceColor;
|
if (PAL_BITFIELDS == XlateObj->iSrcType)
|
||||||
|
{
|
||||||
|
/* FIXME: must use bitfields */
|
||||||
|
SourceRed = (SourceColor >> 7) & 0xff;
|
||||||
|
SourceGreen = (SourceColor >> 2) & 0xff;
|
||||||
|
SourceBlue = (SourceColor << 3) & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cSourceColor = (PVIDEO_CLUTDATA)&SourceColor;
|
||||||
|
SourceRed = cSourceColor->Red;
|
||||||
|
SourceGreen = cSourceColor->Green;
|
||||||
|
SourceBlue = cSourceColor->Blue;
|
||||||
|
}
|
||||||
for (i=0; i<NumColors; i++)
|
for (i=0; i<NumColors; i++)
|
||||||
{
|
{
|
||||||
cDestColors = (PVIDEO_CLUTDATA)&DestColors[i];
|
cDestColors = (PVIDEO_CLUTDATA)&DestColors[i];
|
||||||
|
|
||||||
cxRed = (cSourceColor->Red - cDestColors->Red);
|
cxRed = (SourceRed - cDestColors->Red);
|
||||||
cxRed *= cxRed; //compute cxRed squared
|
cxRed *= cxRed; //compute cxRed squared
|
||||||
cxGreen = (cSourceColor->Green - cDestColors->Green);
|
cxGreen = (SourceGreen - cDestColors->Green);
|
||||||
cxGreen *= cxGreen;
|
cxGreen *= cxGreen;
|
||||||
cxBlue = (cSourceColor->Blue - cDestColors->Blue);
|
cxBlue = (SourceBlue - cDestColors->Blue);
|
||||||
cxBlue *= cxBlue;
|
cxBlue *= cxBlue;
|
||||||
|
|
||||||
rt = /* sqrt */ (cxRed + cxGreen + cxBlue);
|
rt = /* sqrt */ (cxRed + cxGreen + cxBlue);
|
||||||
|
@ -80,14 +94,14 @@ ULONG ClosestColorMatch(ULONG SourceColor, ULONG *DestColors,
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IndexedToIndexedTranslationTable(ULONG *TranslationTable,
|
VOID IndexedToIndexedTranslationTable(XLATEOBJ *XlateObj, ULONG *TranslationTable,
|
||||||
PALGDI *PalDest, PALGDI *PalSource)
|
PALGDI *PalDest, PALGDI *PalSource)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
for(i=0; i<PalSource->NumColors; i++)
|
for(i=0; i<PalSource->NumColors; i++)
|
||||||
{
|
{
|
||||||
TranslationTable[i] = ClosestColorMatch(PalSource->IndexedColors[i], PalDest->IndexedColors, PalDest->NumColors);
|
TranslationTable[i] = ClosestColorMatch(XlateObj, PalSource->IndexedColors[i], PalDest->IndexedColors, PalDest->NumColors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +269,7 @@ XLATEOBJ *EngCreateXlate(USHORT DestPalType, USHORT SourcePalType,
|
||||||
if(XlateObj->iDstType == PAL_INDEXED)
|
if(XlateObj->iDstType == PAL_INDEXED)
|
||||||
{
|
{
|
||||||
// Converting from indexed to indexed
|
// Converting from indexed to indexed
|
||||||
IndexedToIndexedTranslationTable(XlateGDI->translationTable, DestPalGDI, SourcePalGDI);
|
IndexedToIndexedTranslationTable(XlateObj, XlateGDI->translationTable, DestPalGDI, SourcePalGDI);
|
||||||
} else
|
} else
|
||||||
if (PAL_RGB == XlateObj->iDstType || PAL_BITFIELDS == XlateObj->iDstType )
|
if (PAL_RGB == XlateObj->iDstType || PAL_BITFIELDS == XlateObj->iDstType )
|
||||||
{
|
{
|
||||||
|
@ -340,7 +354,7 @@ XLATEOBJ_iXlate(XLATEOBJ *XlateObj,
|
||||||
{
|
{
|
||||||
return ShiftAndMask(XlateGDI, Color);
|
return ShiftAndMask(XlateGDI, Color);
|
||||||
} else
|
} else
|
||||||
if(XlateObj->iSrcType == PAL_RGB)
|
if(PAL_RGB == XlateObj->iSrcType || PAL_BITFIELDS == XlateObj->iSrcType)
|
||||||
{
|
{
|
||||||
// FIXME: should we cache colors used often?
|
// FIXME: should we cache colors used often?
|
||||||
// FIXME: won't work if destination isn't indexed
|
// FIXME: won't work if destination isn't indexed
|
||||||
|
@ -348,8 +362,8 @@ XLATEOBJ_iXlate(XLATEOBJ *XlateObj,
|
||||||
// Extract the destination palette
|
// Extract the destination palette
|
||||||
PalGDI = (PALGDI*)AccessInternalObject((ULONG)XlateGDI->DestPal);
|
PalGDI = (PALGDI*)AccessInternalObject((ULONG)XlateGDI->DestPal);
|
||||||
|
|
||||||
// Return closest match for the given RGB color
|
// Return closest match for the given color
|
||||||
return ClosestColorMatch(Color, PalGDI->IndexedColors, PalGDI->NumColors);
|
return ClosestColorMatch(XlateObj, Color, PalGDI->IndexedColors, PalGDI->NumColors);
|
||||||
} else
|
} else
|
||||||
if(XlateObj->iSrcType == PAL_INDEXED)
|
if(XlateObj->iSrcType == PAL_INDEXED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -278,23 +278,20 @@ const unsigned char font_8x8[2048] =
|
||||||
static PSURFOBJ CharCellSurfObj;
|
static PSURFOBJ CharCellSurfObj;
|
||||||
static HBITMAP hCharCellBitmap;
|
static HBITMAP hCharCellBitmap;
|
||||||
|
|
||||||
VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap);
|
HBITMAP BitmapToSurf(PBITMAPOBJ Bitmap);
|
||||||
|
|
||||||
// Set things up for a character cell surface
|
// Set things up for a character cell surface
|
||||||
void CreateCellCharSurface()
|
void CreateCellCharSurface()
|
||||||
{
|
{
|
||||||
PSURFGDI surfgdi;
|
|
||||||
PBITMAPOBJ pbo;
|
PBITMAPOBJ pbo;
|
||||||
|
HBITMAP bm;
|
||||||
CharCellSurfObj = ExAllocatePool(NonPagedPool, sizeof(SURFOBJ));
|
|
||||||
surfgdi = ExAllocatePool(NonPagedPool, sizeof(SURFGDI));
|
|
||||||
|
|
||||||
hCharCellBitmap = W32kCreateBitmap(8, 8, 1, 8, NULL); // 8x8, 1 plane, 8 bits per pel
|
hCharCellBitmap = W32kCreateBitmap(8, 8, 1, 8, NULL); // 8x8, 1 plane, 8 bits per pel
|
||||||
|
|
||||||
pbo = BITMAPOBJ_HandleToPtr(hCharCellBitmap);
|
pbo = BITMAPOBJ_HandleToPtr(hCharCellBitmap);
|
||||||
ASSERT( pbo );
|
ASSERT( pbo );
|
||||||
// VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap)
|
bm = BitmapToSurf(pbo); // Make the bitmap a surface
|
||||||
BitmapToSurf(0, surfgdi, CharCellSurfObj, pbo); // Make the bitmap a surface
|
CharCellSurfObj = (PSURFOBJ) AccessUserObject((ULONG) bm);
|
||||||
BITMAPOBJ_ReleasePtr( hCharCellBitmap );
|
BITMAPOBJ_ReleasePtr( hCharCellBitmap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.57 2003/03/02 12:03:59 gvg Exp $
|
# $Id: makefile,v 1.58 2003/03/04 10:09:00 gvg Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
|
||||||
objects/region.o objects/text.o objects/wingl.o \
|
objects/region.o objects/text.o objects/wingl.o \
|
||||||
objects/bezier.o objects/objconv.o objects/dib.o \
|
objects/bezier.o objects/objconv.o objects/dib.o \
|
||||||
objects/palette.o objects/rect.o
|
objects/palette.o objects/rect.o
|
||||||
DIB_OBJECTS = dib/dib.o dib/dib1bpp.o dib/dib4bpp.o dib/dib16bpp.o dib/dib24bpp.o
|
DIB_OBJECTS = dib/dib.o dib/dib1bpp.o dib/dib4bpp.o dib/dib8bpp.o dib/dib16bpp.o \
|
||||||
|
dib/dib24bpp.o dib/dib32bpp.o
|
||||||
FREETYPE_OBJECTS = freetype/ctype.o freetype/grfont.o \
|
FREETYPE_OBJECTS = freetype/ctype.o freetype/grfont.o \
|
||||||
freetype/src/base/ftsystem.o freetype/src/base/ftdebug.o \
|
freetype/src/base/ftsystem.o freetype/src/base/ftdebug.o \
|
||||||
freetype/src/base/ftinit.o freetype/src/base/ftbase.o \
|
freetype/src/base/ftinit.o freetype/src/base/ftbase.o \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dc.c,v 1.47 2003/02/25 23:08:54 gvg Exp $
|
/* $Id: dc.c,v 1.48 2003/03/04 10:09:01 gvg Exp $
|
||||||
*
|
*
|
||||||
* DC.C - Device context functions
|
* DC.C - Device context functions
|
||||||
*
|
*
|
||||||
|
@ -85,8 +85,6 @@ INT STDCALL func_name( HDC hdc, INT mode ) \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap);
|
|
||||||
|
|
||||||
// --------------------------------------------------------- File Statics
|
// --------------------------------------------------------- File Statics
|
||||||
|
|
||||||
static void W32kSetDCState16(HDC hDC, HDC hDCSave);
|
static void W32kSetDCState16(HDC hDC, HDC hDCSave);
|
||||||
|
@ -1083,12 +1081,7 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
|
|
||||||
// setup mem dc for drawing into bitmap
|
// setup mem dc for drawing into bitmap
|
||||||
pb = BITMAPOBJ_HandleToPtr (hGDIObj);
|
pb = BITMAPOBJ_HandleToPtr (hGDIObj);
|
||||||
dc->w.hBitmap = CreateGDIHandle(sizeof( SURFGDI ), sizeof( SURFOBJ )); // Assign the DC's bitmap
|
dc->w.hBitmap = BitmapToSurf(pb);
|
||||||
|
|
||||||
surfobj = (PSURFOBJ) AccessUserObject( dc->w.hBitmap );
|
|
||||||
surfgdi = (PSURFGDI) AccessInternalObject( dc->w.hBitmap );
|
|
||||||
BitmapToSurf(hDC, surfgdi, surfobj, pb); // Put the bitmap in a surface
|
|
||||||
|
|
||||||
dc->Surface = dc->w.hBitmap;
|
dc->Surface = dc->w.hBitmap;
|
||||||
|
|
||||||
// if we're working with a DIB, get the palette [fixme: only create if the selected palette is null]
|
// if we're working with a DIB, get the palette [fixme: only create if the selected palette is null]
|
||||||
|
@ -1104,9 +1097,9 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj)
|
||||||
|
|
||||||
dc->w.hPalette = EngCreatePalette(PAL_INDEXED, NumColors, pb->ColorMap, 0, 0, 0);
|
dc->w.hPalette = EngCreatePalette(PAL_INDEXED, NumColors, pb->ColorMap, 0, 0, 0);
|
||||||
} else
|
} else
|
||||||
if((pb->dib->dsBmih.biBitCount > 8) && (pb->dib->dsBmih.biBitCount < 24))
|
if(16 == pb->dib->dsBmih.biBitCount)
|
||||||
{
|
{
|
||||||
dc->w.hPalette = EngCreatePalette(PAL_BITFIELDS, pb->dib->dsBmih.biClrUsed, NULL, 0, 0, 0);
|
dc->w.hPalette = EngCreatePalette(PAL_BITFIELDS, pb->dib->dsBmih.biClrUsed, NULL, 0x7c00, 0x03e0, 0x001f);
|
||||||
} else
|
} else
|
||||||
if(pb->dib->dsBmih.biBitCount >= 24)
|
if(pb->dib->dsBmih.biBitCount >= 24)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include "../eng/handle.h"
|
#include "../eng/handle.h"
|
||||||
#include <ntos/minmax.h>
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap);
|
|
||||||
|
|
||||||
UINT STDCALL W32kSetDIBColorTable(HDC hDC,
|
UINT STDCALL W32kSetDIBColorTable(HDC hDC,
|
||||||
UINT StartIndex,
|
UINT StartIndex,
|
||||||
UINT Entries,
|
UINT Entries,
|
||||||
|
@ -97,13 +95,11 @@ INT STDCALL W32kSetDIBits(HDC hDC,
|
||||||
lpRGB = &bmi->bmiColors[0];
|
lpRGB = &bmi->bmiColors[0];
|
||||||
|
|
||||||
// Create a temporary surface for the destination bitmap
|
// Create a temporary surface for the destination bitmap
|
||||||
DestBitmap = (HBITMAP)CreateGDIHandle(sizeof(SURFGDI), sizeof(SURFOBJ));
|
DestBitmap = BitmapToSurf(bitmap);
|
||||||
|
|
||||||
DestSurf = (PSURFOBJ) AccessUserObject( DestBitmap );
|
DestSurf = (PSURFOBJ) AccessUserObject( DestBitmap );
|
||||||
DestGDI = (PSURFGDI) AccessInternalObject( DestBitmap );
|
DestGDI = (PSURFGDI) AccessInternalObject( DestBitmap );
|
||||||
|
|
||||||
BitmapToSurf(hDC, DestGDI, DestSurf, bitmap);
|
|
||||||
|
|
||||||
// Create source surface
|
// Create source surface
|
||||||
SourceSize.cx = bmi->bmiHeader.biWidth;
|
SourceSize.cx = bmi->bmiHeader.biWidth;
|
||||||
SourceSize.cy = abs(bmi->bmiHeader.biHeight);
|
SourceSize.cy = abs(bmi->bmiHeader.biHeight);
|
||||||
|
|
|
@ -30,32 +30,22 @@ PBRUSHOBJ PenToBrushObj(PDC dc, PENOBJ *pen)
|
||||||
return BrushObj;
|
return BrushObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap)
|
HBITMAP BitmapToSurf(PBITMAPOBJ BitmapObj)
|
||||||
{
|
{
|
||||||
ASSERT( SurfGDI );
|
HBITMAP BitmapHandle;
|
||||||
if( Bitmap ){
|
|
||||||
if(Bitmap->dib)
|
|
||||||
{
|
|
||||||
SurfGDI->BitsPerPixel = Bitmap->dib->dsBm.bmBitsPixel;
|
|
||||||
SurfObj->lDelta = Bitmap->dib->dsBm.bmWidthBytes;
|
|
||||||
SurfObj->pvBits = Bitmap->dib->dsBm.bmBits;
|
|
||||||
SurfObj->cjBits = Bitmap->dib->dsBm.bmHeight * Bitmap->dib->dsBm.bmWidthBytes;
|
|
||||||
} else {
|
|
||||||
SurfGDI->BitsPerPixel = Bitmap->bitmap.bmBitsPixel;
|
|
||||||
SurfObj->lDelta = Bitmap->bitmap.bmWidthBytes;
|
|
||||||
SurfObj->pvBits = Bitmap->bitmap.bmBits;
|
|
||||||
SurfObj->cjBits = Bitmap->bitmap.bmHeight * Bitmap->bitmap.bmWidthBytes;
|
|
||||||
}
|
|
||||||
SurfObj->sizlBitmap = Bitmap->size; // FIXME: alloc memory for our own struct?
|
|
||||||
}
|
|
||||||
|
|
||||||
SurfObj->dhsurf = NULL;
|
if (NULL != BitmapObj->dib)
|
||||||
SurfObj->hsurf = NULL;
|
{
|
||||||
SurfObj->dhpdev = NULL;
|
BitmapHandle = EngCreateBitmap(BitmapObj->size, BitmapObj->dib->dsBm.bmWidthBytes,
|
||||||
SurfObj->hdev = NULL;
|
BitmapFormat(BitmapObj->dib->dsBm.bmBitsPixel, BI_RGB),
|
||||||
SurfObj->pvScan0 = SurfObj->pvBits; // start of bitmap
|
0, BitmapObj->dib->dsBm.bmBits);
|
||||||
SurfObj->iUniq = 0; // not sure..
|
}
|
||||||
SurfObj->iBitmapFormat = BitmapFormat(SurfGDI->BitsPerPixel, BI_RGB);
|
else
|
||||||
SurfObj->iType = STYPE_BITMAP;
|
{
|
||||||
SurfObj->fjBitmap = BMF_TOPDOWN;
|
BitmapHandle = EngCreateBitmap(BitmapObj->size, BitmapObj->bitmap.bmWidthBytes,
|
||||||
|
BitmapFormat(BitmapObj->bitmap.bmBitsPixel, BI_RGB),
|
||||||
|
0, BitmapObj->bitmap.bmBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
return BitmapHandle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue