/*
* entry.c
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
* $Author: jfilby $
- * $Date: 2000/03/17 21:02:57 $
+ * $Date: 2000/04/01 12:31:28 $
*
*/
#include "gdiinfo.h"
+#include "..\vgavideo\vgavideo.h"
#include <internal/debug.h>
#define DBG_PREFIX "VGADDI: "
ULONG VGADDIGetModes(IN HANDLE Driver,
IN ULONG DataSize,
OUT PDEVMODEW DM);
+BOOL VGADDILineTo(SURFOBJ *Surface, CLIPOBJ *Clip, BRUSHOBJ *Brush,
+ LONG x1, LONG y1, LONG x2, LONG y2,
+ RECTL *RectBounds, MIX mix);
DRVFN FuncList[] =
{
{INDEX_DrvEnablePDEV, (PFN) VGADDIEnablePDEV},
{INDEX_DrvEnableSurface, (PFN) VGADDIEnableSurface},
{INDEX_DrvGetModes, (PFN) VGADDIGetModes},
+ {INDEX_DrvLineTo, (PFN) VGADDILineTo},
#if 0
/* Optional Display driver functions */
{
EngDebugPrint("VGADDI", "DrvEnableDriver called...\n", 0);
+ vgaPreCalc();
+ // FIXME: Use Vidport to map the memory properly
+ vidmem = (char *)(0xd0000000 + 0xa0000);
+
DriveEnableData->pdrvfn = FuncList;
DriveEnableData->c = sizeof(FuncList) / sizeof(DRVFN);
DriveEnableData->iDriverVersion = DDI_DRIVER_VERSION;
DHSURF dhsurf;
HSURF hsurf;
+ DbgPrint("DrvEnableSurface..\n");
+
// Initialize the VGA
if (!InitVGA(ppdev, TRUE))
{
goto error_clean;
} BANKING CODE UNIMPLEMENTED */
+ DbgPrint("Calling EngCreateDeviceSurface..\n");
+
if ((hsurf = EngCreateDeviceSurface(dhsurf, ppdev->sizeSurf, BMF_4BPP)) ==
(HSURF)0)
{
EngDebugPrint("VGADDI:", "EngCreateDeviceSurface call failed\n", 0);
goto error_clean;
}
-
+DbgPrint("init saved bits.. ");
InitSavedBits(ppdev);
+DbgPrint("successful\n");
if (EngAssociateSurface(hsurf, ppdev->GDIDevHandle, HOOK_BITBLT | HOOK_PAINT | HOOK_LINETO))
{
-# $Id: makefile,v 1.2 2000/03/17 21:02:57 jfilby Exp $
+# $Id: makefile,v 1.3 2000/04/01 12:31:28 jfilby Exp $
#
# Makefile for ReactOS vgaddi.dll
#
all: $(DLLTARGET)
MAIN_OBJECTS = main/enable.o
-OTHER_OBJECTS = objects/screen.o
+OTHER_OBJECTS = objects/screen.o objects/lineto.o vgavideo/vgavideo.o
RESOURCE_OBJECTS = $(TARGET).coff
OBJECTS = $(MAIN_OBJECTS) $(OTHER_OBJECTS) $(RESOURCE_OBJECTS)
--- /dev/null
+#include "..\vgaddi.h"
+#include "..\vgavideo\vgavideo.h"
+
+#include <internal/i386/io.h>
+
+BOOL VGADDILineTo(SURFOBJ *Surface, CLIPOBJ *Clip, BRUSHOBJ *Brush,
+ LONG x1, LONG y1, LONG x2, LONG y2,
+ RECTL *RectBounds, MIX mix)
+{
+ ULONG x, y, d, i, length, xchange, ychange, error,
+ iSolidColor, hx, vy;
+ LONG deltax, deltay;
+
+ iSolidColor = Brush->iSolidColor; // FIXME: Brush Realization...
+
+ // FIXME: Implement clipping
+
+ x=x1;
+ y=y1;
+ deltax=x2-x1;
+ deltay=y2-y1;
+
+ if(deltax<0)
+ {
+ xchange=-1;
+ deltax=-deltax;
+ hx = x2;
+ } else
+ {
+ xchange=1;
+ hx = x1;
+ }
+
+ if(deltay<0)
+ {
+ ychange=-1;
+ deltay=-deltay;
+ vy = y2;
+ } else
+ {
+ ychange=1;
+ vy = y1;
+ };
+
+ if(y1==y2)
+ {
+ return vgaHLine(hx, y1, deltax, iSolidColor);
+ }
+ if(x1==x2)
+ {
+ return vgaVLine(x1, vy, deltay, iSolidColor);
+ }
+
+ error=0;
+ i=0;
+
+ if(deltax<deltay)
+ {
+ length=deltay+1;
+ while(i<length)
+ {
+ vgaPutPixel(x, y, iSolidColor);
+ y=y+ychange;
+ error=error+deltax;
+
+ if(error>deltay)
+ {
+ x=x+xchange;
+ error=error-deltay;
+ }
+ i=i+1;
+ }
+ } else
+ {
+ length=deltax+1;
+ while(i<length)
+ {
+ vgaPutPixel(x, y, iSolidColor);
+ x=x+xchange;
+ error=error+deltay;
+ if(error>deltax)
+ {
+ y=y+ychange;
+ error=error-deltax;
+ }
+ i=i+1;
+ }
+ }
+
+ return TRUE;
+}
VIDEO_MEMORY VideoMemory;
VIDEO_MEMORY_INFORMATION VideoMemoryInfo;
+char* vidmem;
+
ppdev->ModeNum = 12;
// Set the mode that was requested
return(FALSE);
}
- if (bFirst) {
+/*
+
+gotta fix this up.. it prevents drawing to vidmem right now
+ if (bFirst) {
// map video memory into virtual memory
VideoMemory.RequestedVirtualAddress = NULL;
ppdev->fbScreen = VideoMemoryInfo.FrameBufferBase;
}
-
+*/
return TRUE;
}
--- /dev/null
+#include <ddk/ntddk.h>
+#include <ddk/ntddvid.h>
+
+#include "vgavideo.h"
+
+#include <internal/i386/io.h>
+
+div_t div(int num, int denom)
+{
+ div_t r;
+ if (num > 0 && denom < 0) {
+ num = -num;
+ denom = -denom;
+ }
+ r.quot = num / denom;
+ r.rem = num % denom;
+ if (num < 0 && denom > 0)
+ {
+ if (r.rem > 0)
+ {
+ r.quot++;
+ r.rem -= denom;
+ }
+ }
+ return r;
+}
+
+int mod(int num, int denom)
+{
+ div_t dvt = div(num, denom);
+ return dvt.rem;
+}
+
+VOID vgaPreCalc()
+{
+ ULONG j;
+
+ startmasks[1] = 127;
+ startmasks[2] = 63;
+ startmasks[3] = 31;
+ startmasks[4] = 15;
+ startmasks[5] = 7;
+ startmasks[6] = 3;
+ startmasks[7] = 1;
+ startmasks[8] = 255;
+
+ endmasks[0] = 128;
+ endmasks[1] = 192;
+ endmasks[2] = 224;
+ endmasks[3] = 240;
+ endmasks[4] = 248;
+ endmasks[5] = 252;
+ endmasks[6] = 254;
+ endmasks[7] = 255;
+ endmasks[8] = 255;
+
+ for(j=0; j<80; j++)
+ {
+ maskbit[j*8] = 128;
+ maskbit[j*8+1] = 64;
+ maskbit[j*8+2] = 32;
+ maskbit[j*8+3] = 16;
+ maskbit[j*8+4] = 8;
+ maskbit[j*8+5] = 4;
+ maskbit[j*8+6] = 2;
+ maskbit[j*8+7] = 1;
+
+ bit8[j*8] = 7;
+ bit8[j*8+1] = 6;
+ bit8[j*8+2] = 5;
+ bit8[j*8+3] = 4;
+ bit8[j*8+4] = 3;
+ bit8[j*8+5] = 2;
+ bit8[j*8+6] = 1;
+ bit8[j*8+7] = 0;
+ }
+ for(j=0; j<480; j++)
+ {
+ y80[j] = j*80;
+ }
+ for(j=0; j<640; j++)
+ {
+ xconv[j] = j >> 3;
+ }
+}
+
+void vgaPutPixel(int x, int y, unsigned char c)
+{
+ unsigned offset;
+ unsigned char a;
+
+ offset = xconv[x]+y80[y];
+
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08);
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf,maskbit[x]);
+
+ a = READ_REGISTER_UCHAR(vidmem + offset);
+ WRITE_REGISTER_UCHAR(vidmem + offset, c);
+}
+
+void vgaPutByte(int x, int y, unsigned char c)
+{
+ unsigned offset;
+
+ offset = xconv[x]+y80[y];
+
+ // Set the write mode
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08);
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf,0xff);
+
+ WRITE_REGISTER_UCHAR(vidmem + offset, c);
+}
+
+void vgaGetByte(unsigned offset,
+ unsigned char *b, unsigned char *g,
+ unsigned char *r, unsigned char *i)
+{
+// fixme: use READ_REGISTER_UCHAR
+
+ WRITE_PORT_USHORT((PUSHORT)0x03ce, 0x0304);
+ *i = vidmem[offset];
+ WRITE_PORT_USHORT((PUSHORT)0x03ce, 0x0204);
+ *r = vidmem[offset];
+ WRITE_PORT_USHORT((PUSHORT)0x03ce, 0x0104);
+ *g = vidmem[offset];
+ WRITE_PORT_USHORT((PUSHORT)0x03ce, 0x0004);
+ *b = vidmem[offset];
+}
+
+int vgaGetPixel(int x, int y)
+{
+ unsigned char mask, b, g, r, i;
+ unsigned offset;
+
+ offset = xconv[x]+y80[y];
+ mask=maskbit[x];
+ vgaGetByte(offset, &b, &g, &r, &i);
+ b=b&mask;
+ g=g&mask;
+ r=r&mask;
+ i=i&mask;
+
+ mask=bit8[x];
+ g=g>>mask;
+ b=b>>mask;
+ r=r>>mask;
+ i=i>>mask;
+
+ return(b+2*g+4*r+8*i);
+}
+
+BOOL vgaHLine(int x, int y, int len, unsigned char c)
+{
+ unsigned char a;
+ unsigned int pre1, i;
+ unsigned int orgpre1, orgx, midpre1;
+ unsigned long leftpixs, midpixs, rightpixs, temp;
+
+ orgx=x;
+
+ if(len<8)
+ {
+ for (i=x; i<x+len; i++)
+ vgaPutPixel(i, y, c);
+ } else {
+
+ leftpixs=x;
+ while(leftpixs>8) leftpixs-=8;
+ temp = len;
+ midpixs = 0;
+
+ while(temp>7)
+ {
+ temp-=8;
+ midpixs++;
+ }
+ if((temp>=0) && (midpixs>0)) midpixs--;
+
+ pre1=xconv[x]+y80[y];
+ orgpre1=pre1;
+
+ // Left
+ if(leftpixs==8) {
+ // Left edge should be an entire middle bar
+ x=orgx;
+ leftpixs=0;
+ }
+ else if(leftpixs>0)
+ {
+ // Write left pixels
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf,startmasks[leftpixs]);
+
+ a = READ_REGISTER_UCHAR(vidmem + pre1);
+ WRITE_REGISTER_UCHAR(vidmem + pre1, c);
+
+ // Middle
+ x=orgx+(8-leftpixs)+leftpixs;
+
+ } else {
+ // leftpixs == 0
+ midpixs+=1;
+ }
+
+ if(midpixs>0)
+ {
+ midpre1=xconv[x]+y80[y];
+
+ // Set mask to all pixels in byte
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce, 0x08);
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf, 0xff);
+ memset(vidmem+midpre1, c, midpixs); // write middle pixels, no need to read in latch because of the width
+ }
+
+ rightpixs = len - ((midpixs*8) + leftpixs);
+
+ if((rightpixs>0))
+ {
+ x=(orgx+len)-rightpixs;
+
+ // Go backwards till we reach the 8-byte boundary
+ while(mod(x, 8)!=0) { x--; rightpixs++; }
+
+ while(rightpixs>7)
+ {
+ // This is a BAD case as this should have been a midpixs
+
+ vgaPutByte(x, y, c);
+ rightpixs-=8;
+ x+=8;
+ }
+
+ pre1=xconv[x]+y80[y];
+
+ // Write right pixels
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask bits
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf,endmasks[rightpixs]);
+
+ a = READ_REGISTER_UCHAR(vidmem + pre1);
+ WRITE_REGISTER_UCHAR(vidmem + pre1, c);
+ }
+ }
+
+ return TRUE;
+}
+
+BOOL vgaVLine(int x, int y, int len, unsigned char c)
+{
+ unsigned offset, i;
+ unsigned char a;
+
+ offset = xconv[x]+y80[y];
+
+ WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask
+ WRITE_PORT_UCHAR((PUCHAR)0x3cf,maskbit[x]);
+
+ len++;
+
+ for(i=y; i<y+len; i++)
+ {
+ a = READ_REGISTER_UCHAR(vidmem + offset);
+ WRITE_REGISTER_UCHAR(vidmem + offset, c);
+ offset+=80;
+ }
+
+ return TRUE;
+}
--- /dev/null
+#define VGA_NORMAL 0
+#define VGA_AND 8
+#define VGA_OR 16
+#define VGA_XOR 24
+
+typedef struct { int quot, rem; } div_t;
+
+int maskbit[640], y80[480], xconv[640], bit8[640], startmasks[8], endmasks[8];
+
+char* vidmem;
+
+#define MISC 0x3c2
+#define SEQ 0x3c4
+#define CRTC 0x3d4
+#define GRAPHICS 0x3ce
+#define FEATURE 0x3da
+#define ATTRIB 0x3c0
+#define STATUS 0x3da
+
+typedef struct _VideoMode {
+ unsigned short VidSeg;
+ unsigned char Misc;
+ unsigned char Feature;
+ unsigned char Seq[5];
+ unsigned char Crtc[25];
+ unsigned char Gfx[9];
+ unsigned char Attrib[21];
+} VideoMode;
+
+VOID vgaPreCalc();
#include "vgaVideo.h"
-void outxay(unsigned short ad, unsigned char x, unsigned char y)
+void outxay(USHORT ad, UCHAR x, UCHAR y)
{
- unsigned short xy = (x << 8) + y;
- VideoPortWritePortUshort(ad, xy);
+ USHORT xy = (x << 8) + y;
+
+ VideoPortWritePortUshort((PUSHORT)ad, xy);
}
void setMode(VideoMode mode)
{
unsigned char x;
+ unsigned int y, c, a, m, n;
VideoPortWritePortUchar((PUCHAR)MISC, mode.Misc);
VideoPortWritePortUchar((PUCHAR)STATUS, 0);
outxay(SEQ, mode.Seq[x], x);
}
- VideoPortWritePortUshort((USHORT)CRTC, 0x11);
- VideoPortWritePortUshort((USHORT)CRTC, (mode.Crtc[0x11] & 0x7f));
+ VideoPortWritePortUshort((PUSHORT)CRTC, 0x11);
+ VideoPortWritePortUshort((PUSHORT)CRTC, (mode.Crtc[0x11] & 0x7f));
for(x=0; x<25; x++)
{
outxay(GRAPHICS, mode.Gfx[x], x);
}
- x=VideoPortReadPortUchar(FEATURE);
+ x=VideoPortReadPortUchar((PUCHAR)FEATURE);
for(x=0; x<21; x++)
{
VideoPortWritePortUchar((PUCHAR)ATTRIB, mode.Attrib[x]);
}
- x=VideoPortReadPortUchar(STATUS);
+ x=VideoPortReadPortUchar((PUCHAR)STATUS);
- VideoPortWritePortUchar(ATTRIB, 0x20);
+ VideoPortWritePortUchar((PUCHAR)ATTRIB, 0x20);
}
VideoMode Mode12 = {
- 0xa000, 0xe3, 0x00,
+ 0xa000, /* 0xe3, */ 0xc3, 0x00,
- {0x02, 0x01, 0x0f, 0x00, 0x06},
+ {0x02, 0x01, 0x0f, 0x00, 0x06 },
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x59, 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
0x0c, 0x0d, 0x0e, 0x0f, 0x41, 0x00, 0x0f, 0x00, 0x00}
};
-void myvgaPutPixel(int x, int y, unsigned char c)
+void InitVGAMode()
{
- unsigned offset;
- unsigned char a;
+ int i;
- offset = xconv[x]+y80[y];
+ // FIXME: Use Vidport to map the memory properly
+ vidmem = (char *)(0xd0000000 + 0xa0000);
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08); // Set
- VideoPortWritePortUchar((PUCHAR)0x3cf,maskbit[x]); // the MASK
- VideoPortWritePortUshort((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1)
- // read mode = 0 (bit 3
- a = vidmem[offset]; // Update bit buffer
- vidmem[offset] = c; // Write the pixel
-}
+ setMode(Mode12);
-void InitVGAMode()
-{
-// vidmem += __djgpp_conventional_base;
+ WRITE_PORT_USHORT((PUSHORT)0x3C4, 0x0f02); // index=MASK MAP, write to all bitplanes
+ i = vidmem[0];
+// RtlZeroMemory(vidmem, 38400);
+ RtlZeroMemory(vidmem, 64000);
- setMode(Mode12);
- RtlZeroMemory(vidmem, 38400);
vgaPreCalc();
}
#include "vgavideo.h"
-#define VIDMEM_BASE 0xa0000
-char* vidmem = (char *)(VIDMEM_BASE);
-
div_t div(int num, int denom)
{
div_t r;
VideoPortWritePortUchar((PUCHAR)0x03c9, green);
VideoPortWritePortUchar((PUCHAR)0x03c9, blue);
}
-
-void vgaPutPixel(int x, int y, unsigned char c)
-{
- unsigned offset;
- unsigned char a;
-
- offset = xconv[x]+y80[y];
-
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08); // Set
- VideoPortWritePortUchar((PUCHAR)0x3cf,maskbit[x]); // the MASK
- VideoPortWritePortUshort((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1)
- // read mode = 0 (bit 3
- a = vidmem[offset]; // Update bit buffer
- vidmem[offset] = c; // Write the pixel
-}
-
-void vgaPutByte(int x, int y, unsigned char c)
-{
- unsigned offset;
-
- offset = xconv[x]+y80[y];
-
- // Set mask to all pixels in byte
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08);
- VideoPortWritePortUchar((PUCHAR)0x3cf,0xff);
-
- vidmem[offset]=c;
-}
-
-void vgaGetByte(unsigned offset,
- unsigned char *b, unsigned char *g,
- unsigned char *r, unsigned char *i)
-{
- VideoPortWritePortUshort((PUSHORT)0x03ce, 0x0304);
- *i = vidmem[offset];
- VideoPortWritePortUshort((PUSHORT)0x03ce, 0x0204);
- *r = vidmem[offset];
- VideoPortWritePortUshort((PUSHORT)0x03ce, 0x0104);
- *g = vidmem[offset];
- VideoPortWritePortUshort((PUSHORT)0x03ce, 0x0004);
- *b = vidmem[offset];
-}
-
-int vgaGetPixel(int x, int y)
-{
- unsigned char mask, b, g, r, i;
- unsigned offset;
-
- offset = xconv[x]+y80[y];
- mask=maskbit[x];
- vgaGetByte(offset, &b, &g, &r, &i);
- b=b&mask;
- g=g&mask;
- r=r&mask;
- i=i&mask;
-
- mask=bit8[x];
- g=g>>mask;
- b=b>>mask;
- r=r>>mask;
- i=i>>mask;
-
- return(b+2*g+4*r+8*i);
-}
-
-BOOL vgaHLine(int x, int y, int len, unsigned char c)
-{
- unsigned char a;
- unsigned int pre1, i;
- unsigned int orgpre1, orgx, midpre1;
- unsigned long leftpixs, midpixs, rightpixs, temp;
-
- orgx=x;
-
- if(len<8)
- {
- for (i=x; i<x+len; i++)
- vgaPutPixel(i, y, c);
- } else {
-
- leftpixs=x;
- while(leftpixs>8) leftpixs-=8;
- temp = len;
- midpixs = 0;
-
- while(temp>7)
- {
- temp-=8;
- midpixs++;
- }
- if((temp>=0) && (midpixs>0)) midpixs--;
-
- pre1=xconv[x]+y80[y];
- orgpre1=pre1;
-
- // Left
- if(leftpixs==8) {
- // Left edge should be an entire middle bar
- x=orgx;
- leftpixs=0;
- }
- else if(leftpixs>0)
- {
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08); // Set
- VideoPortWritePortUchar((PUCHAR)0x3cf,startmasks[leftpixs]); // the MASK
- VideoPortWritePortUshort((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1)
- // read mode = 0 (bit 3
- a = vidmem[pre1]; // Update bit buffer
- vidmem[pre1] = c; // Write the pixel
-
- // Middle
- x=orgx+(8-leftpixs)+leftpixs;
-
- } else {
- // leftpixs == 0
- midpixs+=1;
- }
-
- if(midpixs>0)
- {
- midpre1=xconv[x]+y80[y];
-
- // Set mask to all pixels in byte
- VideoPortWritePortUchar((PUCHAR)0x3ce, 0x08);
- VideoPortWritePortUchar((PUCHAR)0x3cf, 0xff);
- memset(vidmem+midpre1, c, midpixs);
- }
-
- rightpixs = len - ((midpixs*8) + leftpixs);
-
- if((rightpixs>0))
- {
- x=(orgx+len)-rightpixs;
-
- // Go backwards till we reach the 8-byte boundary
- while(mod(x, 8)!=0) { x--; rightpixs++; }
-
- while(rightpixs>7)
- {
- // This is a BAD case as this should have been a midpixs
-
- vgaPutByte(x, y, c);
- rightpixs-=8;
- x+=8;
- }
-
- pre1=xconv[x]+y80[y];
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08); // Set
- VideoPortWritePortUchar((PUCHAR)0x3cf,endmasks[rightpixs]); // the MASK
- VideoPortWritePortUshort((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1)
- // read mode = 0 (bit 3
- a = vidmem[pre1]; // Update bit buffer
- vidmem[pre1] = c; // Write the pixel
- }
- }
-
- return TRUE;
-}
-
-BOOL vgaVLine(int x, int y, int len, unsigned char c)
-{
- unsigned offset, i;
- unsigned char a;
-
- offset = xconv[x]+y80[y];
-
- VideoPortWritePortUchar((PUCHAR)0x3ce,0x08); // Set
- VideoPortWritePortUchar((PUCHAR)0x3cf,maskbit[x]); // the MASK
- VideoPortWritePortUshort((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1)
- // read mode = 0 (bit 3)
- len++;
-
- for(i=y; i<y+len; i++)
- {
- a = vidmem[offset]; // Update bit buffer
- vidmem[offset] = c; // Write the pixel
- offset+=80;
- }
-
- return TRUE;
-}
unsigned short VidSeg;
unsigned char Misc;
unsigned char Feature;
- unsigned char Seq[5];
- unsigned char Crtc[25];
- unsigned char Gfx[9];
+ unsigned short Seq[6];
+ unsigned short Crtc[25];
+ unsigned short Gfx[9];
unsigned char Attrib[21];
} VideoMode;
*/
#include <ddk/winddi.h>
+#include <win32k/dc.h>
#include "objects.h"
BYTE bytesPerPixel(ULONG Format)
NewBitmap = CreateGDIHandle(SurfGDI, SurfObj);
InitializeHooks(SurfGDI);
+
SurfGDI->BytesPerPixel = bytesPerPixel(Format);
SurfObj->dhsurf = dhsurf;
NewSurface = CreateGDIHandle(SurfGDI, SurfObj);
InitializeHooks(SurfGDI);
+
SurfGDI->BytesPerPixel = bytesPerPixel(Format);
SurfObj->dhsurf = dhsurf;
SURFOBJ *SurfObj;
SURFGDI *SurfGDI;
- DRVENABLEDATA *DED;
+// it looks like this Dev is actually a pointer to the DC!
+ PDC Dc = (PDC)Dev;
+
+// DRVENABLEDATA *DED;
SurfGDI = AccessInternalObject(Surface);
SurfObj = AccessUserObject(Surface);
- DED = AccessInternalObject(Dev);
+// DED = AccessInternalObject(Dev);
// Associate the hdev
SurfObj->hdev = Dev;
// Hook up specified functions
- if(Hooks & HOOK_BITBLT)
- SurfGDI->BitBlt = DriverFunction(DED, INDEX_DrvBitBlt);
- if(Hooks & HOOK_STRETCHBLT)
- SurfGDI->StretchBlt = DriverFunction(DED, INDEX_DrvStretchBlt);
- if(Hooks & HOOK_TEXTOUT)
- SurfGDI->TextOut = DriverFunction(DED, INDEX_DrvTextOut);
- if(Hooks & HOOK_PAINT)
- SurfGDI->Paint = DriverFunction(DED, INDEX_DrvPaint);
- if(Hooks & HOOK_STROKEPATH)
- SurfGDI->StrokePath = DriverFunction(DED, INDEX_DrvStrokePath);
- if(Hooks & HOOK_FILLPATH)
- SurfGDI->FillPath = DriverFunction(DED, INDEX_DrvFillPath);
- if(Hooks & HOOK_STROKEANDFILLPATH)
- SurfGDI->StrokeAndFillPath = DriverFunction(DED, INDEX_DrvStrokeAndFillPath);
- if(Hooks & HOOK_LINETO)
- SurfGDI->LineTo = DriverFunction(DED, INDEX_DrvLineTo);
- if(Hooks & HOOK_COPYBITS)
- SurfGDI->CopyBits = DriverFunction(DED, INDEX_DrvCopyBits);
- if(Hooks & HOOK_SYNCHRONIZE)
- SurfGDI->Synchronize = DriverFunction(DED, INDEX_DrvSynchronize);
- if(Hooks & HOOK_SYNCHRONIZEACCESS)
- SurfGDI->SynchronizeAccess = TRUE;
+ if(Hooks & HOOK_BITBLT) SurfGDI->BitBlt = Dc->DriverFunctions.BitBlt;
+ if(Hooks & HOOK_STRETCHBLT) SurfGDI->StretchBlt = Dc->DriverFunctions.StretchBlt;
+ if(Hooks & HOOK_TEXTOUT) SurfGDI->TextOut = Dc->DriverFunctions.TextOut;
+ if(Hooks & HOOK_PAINT) SurfGDI->Paint = Dc->DriverFunctions.Paint;
+ if(Hooks & HOOK_STROKEPATH) SurfGDI->StrokePath = Dc->DriverFunctions.StrokePath;
+ if(Hooks & HOOK_FILLPATH) SurfGDI->FillPath = Dc->DriverFunctions.FillPath;
+ if(Hooks & HOOK_STROKEANDFILLPATH) SurfGDI->StrokeAndFillPath = Dc->DriverFunctions.StrokeAndFillPath;
+ if(Hooks & HOOK_LINETO) { SurfGDI->LineTo = Dc->DriverFunctions.LineTo;
+DbgPrint("associating LineTo is now %08x\n", SurfGDI->LineTo);
+}
+ if(Hooks & HOOK_COPYBITS) SurfGDI->CopyBits = Dc->DriverFunctions.CopyBits;
+ if(Hooks & HOOK_SYNCHRONIZE) SurfGDI->Synchronize = Dc->DriverFunctions.Synchronize;
+ if(Hooks & HOOK_SYNCHRONIZEACCESS) SurfGDI->SynchronizeAccess = TRUE;
return TRUE;
}
-/* $Id: dc.c,v 1.13 2000/03/17 21:02:59 jfilby Exp $
+/* $Id: dc.c,v 1.14 2000/04/01 12:31:29 jfilby Exp $
*
* DC.C - Device context functions
*
// #define NDEBUG
#include <internal/debug.h>
+void TestEngXxx(PDC Dc)
+{
+ BRUSHOBJ brushobj;
+ SURFOBJ *SurfObj;
+
+DbgPrint("testing.. ");
+ brushobj.iSolidColor = 1;
+ SurfObj = AccessUserObject(Dc->Surface);
+
+ /* Diagonals */
+ EngLineTo(SurfObj, NULL, &brushobj, 0, 0, 639, 479, NULL, NULL);
+ EngLineTo(SurfObj, NULL, &brushobj, 639, 0, 0, 479, NULL, NULL);
+
+ /* Border */
+ EngLineTo(SurfObj, NULL, &brushobj, 0, 0, 639, 0, NULL, NULL);
+ EngLineTo(SurfObj, NULL, &brushobj, 639, 0, 639, 479, NULL, NULL);
+ EngLineTo(SurfObj, NULL, &brushobj, 639, 479, 0, 479, NULL, NULL);
+ EngLineTo(SurfObj, NULL, &brushobj, 0, 479, 0, 0, NULL, NULL);
+}
+
/* FIXME: DCs should probably be thread safe */
/*
DRIVER_ReferenceDriver (Driver);
/* Enable the drawing surface */
- NewDC->Surface = NewDC->DriverFunctions.EnableSurface(NewDC->PDev);
+ NewDC->Surface = NewDC->DriverFunctions.EnableSurface(NewDC->PDev); // hsurf
+
+ /* Test EngXxx functions */
+ TestEngXxx(NewDC);
/* Initialize the DC state */
DC_InitDC(NewDC);