ReactOS 0.4.15-dev-8100-g1887773
vgavideo.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _VideoMode
 

Macros

#define SCREEN_X   640
 
#define SCREEN_Y   480
 
#define SCREEN_STRIDE   80
 
#define VGA_NORMAL   0
 
#define VGA_AND   8
 
#define VGA_OR   16
 
#define VGA_XOR   24
 
#define MISC   0x3c2
 
#define SEQ   0x3c4
 
#define CRTC   0x3d4
 
#define GRAPHICS   0x3ce
 
#define FEATURE   0x3da
 
#define ATTRIB   0x3c0
 
#define STATUS   0x3da
 
#define SEQ_I   0x3C4 /* Sequencer Index */
 
#define SEQ_D   0x3C5 /* Sequencer Data Register */
 
#define GRA_I   0x3CE /* Graphics Controller Index */
 
#define GRA_D   0x3CF /* Graphics Controller Data Register */
 
#define LowByte(w)   (*((unsigned char *)&(w) + 0))
 
#define HighByte(w)   (*((unsigned char *)&(w) + 1))
 
#define ASSIGNVP4(x, y, vp)   vp = vidmem /* VBUF */ + (((x) + (y)*SCREEN_X) >> 3);
 
#define ASSIGNMK4(x, y, mask)   mask = 0x80 >> ((x) & 7);
 
#define mod8(n)   ((n)&7)
 
#define mod2(n)   ((n)&1)
 

Typedefs

typedef struct _VideoMode VideoMode
 

Functions

VOID vgaPreCalc (VOID)
 
VOID vgaPutPixel (INT x, INT y, UCHAR c)
 
VOID vgaPutByte (INT x, INT y, UCHAR c)
 
VOID vgaGetByte (ULONG offset, UCHAR *b, UCHAR *g, UCHAR *r, UCHAR *i)
 
INT vgaGetPixel (INT x, INT y)
 
BOOL vgaHLine (INT x, INT y, INT len, UCHAR c)
 
BOOL vgaVLine (INT x, INT y, INT len, UCHAR c)
 
INT __cdecl abs (INT nm)
 
BOOL VGADDIIntersectRect (PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
 
void get_masks (int x, int w)
 
void DIB_BltFromVGA (int x, int y, int w, int h, void *b, int Dest_lDelta)
 
void DIB_BltToVGA (int x, int y, int w, int h, void *b, int Source_lDelta, int StartMod)
 
void DIB_BltToVGAWithXlate (int x, int y, int w, int h, void *b, int Source_lDelta, XLATEOBJ *Xlate)
 
void DIB_TransparentBltToVGA (int x, int y, int w, int h, void *b, int Source_lDelta, ULONG trans)
 

Variables

int maskbit [640]
 
int y80 [480]
 
int xconv [640]
 
int bit8 [640]
 
int startmasks [8]
 
int endmasks [8]
 
UCHAR PreCalcReverseByte [256]
 
PBYTE vidmem
 

Macro Definition Documentation

◆ ASSIGNMK4

#define ASSIGNMK4 (   x,
  y,
  mask 
)    mask = 0x80 >> ((x) & 7);

Definition at line 66 of file vgavideo.h.

◆ ASSIGNVP4

#define ASSIGNVP4 (   x,
  y,
  vp 
)    vp = vidmem /* VBUF */ + (((x) + (y)*SCREEN_X) >> 3);

Definition at line 65 of file vgavideo.h.

◆ ATTRIB

#define ATTRIB   0x3c0

Definition at line 31 of file vgavideo.h.

◆ CRTC

#define CRTC   0x3d4

Definition at line 28 of file vgavideo.h.

◆ FEATURE

#define FEATURE   0x3da

Definition at line 30 of file vgavideo.h.

◆ GRA_D

#define GRA_D   0x3CF /* Graphics Controller Data Register */

Definition at line 60 of file vgavideo.h.

◆ GRA_I

#define GRA_I   0x3CE /* Graphics Controller Index */

Definition at line 59 of file vgavideo.h.

◆ GRAPHICS

#define GRAPHICS   0x3ce

Definition at line 29 of file vgavideo.h.

◆ HighByte

#define HighByte (   w)    (*((unsigned char *)&(w) + 1))

Definition at line 63 of file vgavideo.h.

◆ LowByte

#define LowByte (   w)    (*((unsigned char *)&(w) + 0))

Definition at line 62 of file vgavideo.h.

◆ MISC

#define MISC   0x3c2

Definition at line 26 of file vgavideo.h.

◆ mod2

#define mod2 (   n)    ((n)&1)

Definition at line 71 of file vgavideo.h.

◆ mod8

#define mod8 (   n)    ((n)&7)

Definition at line 70 of file vgavideo.h.

◆ SCREEN_STRIDE

#define SCREEN_STRIDE   80

Definition at line 5 of file vgavideo.h.

◆ SCREEN_X

#define SCREEN_X   640

Definition at line 2 of file vgavideo.h.

◆ SCREEN_Y

#define SCREEN_Y   480

Definition at line 3 of file vgavideo.h.

◆ SEQ

#define SEQ   0x3c4

Definition at line 27 of file vgavideo.h.

◆ SEQ_D

#define SEQ_D   0x3C5 /* Sequencer Data Register */

Definition at line 57 of file vgavideo.h.

◆ SEQ_I

#define SEQ_I   0x3C4 /* Sequencer Index */

Definition at line 56 of file vgavideo.h.

◆ STATUS

#define STATUS   0x3da

Definition at line 32 of file vgavideo.h.

◆ VGA_AND

#define VGA_AND   8

Definition at line 8 of file vgavideo.h.

◆ VGA_NORMAL

#define VGA_NORMAL   0

Definition at line 7 of file vgavideo.h.

◆ VGA_OR

#define VGA_OR   16

Definition at line 9 of file vgavideo.h.

◆ VGA_XOR

#define VGA_XOR   24

Definition at line 10 of file vgavideo.h.

Typedef Documentation

◆ VideoMode

Function Documentation

◆ abs()

INT __cdecl abs ( INT  nm)

◆ DIB_BltFromVGA()

void DIB_BltFromVGA ( int  x,
int  y,
int  w,
int  h,
void b,
int  Dest_lDelta 
)

Definition at line 352 of file vgavideo.c.

353{
354 ULONG plane;
355 ULONG left = x >> 3;
356 ULONG shift = x - (x & ~0x7);
357 UCHAR pixel, nextpixel;
358 LONG rightcount;
359 INT i, j;
360 LONG stride = w >> 3;
361
362 /* Calculate the number of rightmost bytes not in a dword block. */
363 if (w >= 8)
364 {
365 rightcount = w % 8;
366 }
367 else
368 {
369 stride = 0;
370 rightcount = w;
371 }
372 rightcount = (rightcount + 1) / 2;
373
374 /* Reset the destination. */
375 for (j = 0; j < h; j++)
376 memset((PVOID)((ULONG_PTR)b + (j * Dest_lDelta)), 0, abs(Dest_lDelta));
377
378 for (plane = 0; plane < 4; plane++)
379 {
380 PUCHAR dest = b;
381
382 /* Select the plane we are reading in this iteration. */
385
386 for (j = 0; j < h; j++)
387 {
388 PULONG destline = (PULONG)dest;
389 PUCHAR src = vidmem + (y + j) * SCREEN_STRIDE + left;
390 /* Read the data for one plane for an eight aligned pixel block. */
392 for (i = 0; i < stride; i++, src++, destline++)
393 {
394 /* Form the data for one plane for an aligned block in the destination. */
395 pixel = nextpixel;
396 pixel >>= shift;
397
399 pixel |= (nextpixel << (8 - shift));
400
401 /* Expand the plane data to 'chunky' format and store. */
402 *destline |= (UnpackPixel[pixel] << plane);
403 }
404 /* Handle any pixels not falling into a full block. */
405 if (rightcount != 0)
406 {
407 ULONG row;
408
409 /* Form the data for a complete block. */
410 pixel = nextpixel;
411 pixel >>= shift;
412
414 pixel |= (nextpixel << (8 - shift));
415
416 row = UnpackPixel[pixel] << plane;
417
418 /* Store the data for each byte in the destination. */
419 for (i = 0; i < rightcount; i++)
420 {
421 ((PUCHAR)destline)[i] |= (row & 0xFF);
422 row >>= 8;
423 }
424 }
425 dest += Dest_lDelta;
426 }
427 }
428
429#ifdef VGA_VERIFY
430 for (j = 0; j < h; j++)
431 {
432 for (i = 0; i < w; i += 2)
433 {
434 UCHAR c1, c2;
435 ULONG mask = (i < (w - 1)) ? 0xFF : 0xF0;
436
437 c1 = (vgaGetPixel(x + i, y + j) << 4) | (vgaGetPixel(x + i + 1, y + j));
438 c2 = ((PUCHAR)b)[(j * Dest_lDelta) + (i >> 1)];
439 if ((c1 & mask) != (c2 & mask))
441 }
442 }
443#endif /* VGA_VERIFY */
444}
#define GRA_D
Definition: vgavideo.h:60
#define SCREEN_STRIDE
Definition: vgavideo.h:5
#define GRA_I
Definition: vgavideo.h:59
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
#define ULONG_PTR
Definition: config.h:101
#define abs(i)
Definition: fconv.c:206
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei stride
Definition: glext.h:5848
GLenum src
Definition: glext.h:6340
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLint left
Definition: glext.h:7726
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
#define b
Definition: ke_i.h:79
static char * dest
Definition: rtl.c:135
#define shift
Definition: input.c:1755
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
long LONG
Definition: pedump.c:60
#define memset(x, y, z)
Definition: compat.h:39
uint32_t * PULONG
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
static ULONG UnpackPixel[256]
Definition: vgavideo.c:19
INT vgaGetPixel(IN INT x, IN INT y)
Definition: vgavideo.c:206
PBYTE vidmem
Definition: vgavideo.c:18
UCHAR PreCalcReverseByte[256]
Definition: vgavideo.c:11
_Analysis_noreturn_ ENGAPI VOID APIENTRY EngDebugBreak(VOID)
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DrvCopyBits(), and VGAtoDIB().

◆ DIB_BltToVGA()

void DIB_BltToVGA ( int  x,
int  y,
int  w,
int  h,
void b,
int  Source_lDelta,
int  StartMod 
)

Definition at line 447 of file vgavideo.c.

448{
449 PUCHAR pb, opb = b;
450 LONG i, j;
451 LONG x2 = x + w;
452 LONG y2 = y + h;
454
455 for (i = x; i < x2; i++)
456 {
457 pb = opb;
458 offset = xconv[i] + y80[y];
459
460 WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); // set the mask
462
463 if (StartMod == ((i - x) % 2))
464 {
465 for (j = y; j < y2; j++)
466 {
468 WRITE_REGISTER_UCHAR(vidmem + offset, (*pb & 0xf0) >> 4);
469 offset += 80;
470 pb += Source_lDelta;
471 }
472 }
473 else
474 {
475 for (j = y; j < y2; j++)
476 {
478 WRITE_REGISTER_UCHAR(vidmem + offset, *pb & 0x0f);
479 offset += 80;
480 pb += Source_lDelta;
481 }
482 }
483
484 if (StartMod != ((i - x) % 2))
485 opb++;
486 }
487}
GLintptr offset
Definition: glext.h:5920
int xconv[640]
Definition: vgavideo.c:14
int maskbit[640]
Definition: vgavideo.c:12
int y80[480]
Definition: vgavideo.c:13
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)

Referenced by DIBtoVGA(), and DrvCopyBits().

◆ DIB_BltToVGAWithXlate()

void DIB_BltToVGAWithXlate ( int  x,
int  y,
int  w,
int  h,
void b,
int  Source_lDelta,
XLATEOBJ Xlate 
)

Definition at line 491 of file vgavideo.c.

492{
493 PUCHAR pb, opb = b;
494 ULONG i, j;
495 ULONG x2 = x + w;
496 ULONG y2 = y + h;
498
499 for (i = x; i < x2; i++)
500 {
501 pb = opb;
502 offset = xconv[i] + y80[y];
503
504 WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); // set the mask
506
507 if (0 == ((i - x) % 2))
508 {
509 for (j = y; j < y2; j++)
510 {
512 WRITE_REGISTER_UCHAR(vidmem + offset, XLATEOBJ_iXlate(Xlate, (*pb & 0xf0) >> 4));
513 offset += 80;
514 pb += Source_lDelta;
515 }
516 }
517 else
518 {
519 for (j = y; j < y2; j++)
520 {
522 WRITE_REGISTER_UCHAR(vidmem + offset, XLATEOBJ_iXlate(Xlate, *pb & 0x0f));
523 offset += 80;
524 pb += Source_lDelta;
525 }
526 }
527
528 if (0 != ((i - x) % 2))
529 opb++;
530 }
531}
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664

Referenced by DIBtoVGA().

◆ DIB_TransparentBltToVGA()

void DIB_TransparentBltToVGA ( int  x,
int  y,
int  w,
int  h,
void b,
int  Source_lDelta,
ULONG  trans 
)

Definition at line 536 of file vgavideo.c.

538{
539 PUCHAR pb = b, opb = b;
540 BOOLEAN edgePixel = FALSE;
541 ULONG i, j;
542 ULONG x2 = x + w;
543 ULONG y2 = y + h;
544 UCHAR b1, b2;
545
546 /* Check if the width is odd */
547 if(mod2(w) > 0)
548 {
549 edgePixel = TRUE;
550 x2 -= 1;
551 }
552
553 for (j=y; j<y2; j++)
554 {
555 for (i=x; i<x2; i+=2)
556 {
557 b1 = (*pb & 0xf0) >> 4;
558 b2 = *pb & 0x0f;
559 if(b1 != trans) vgaPutPixel(i, j, b1);
560 if(b2 != trans) vgaPutPixel(i+1, j, b2);
561 pb++;
562 }
563
564 if (edgePixel)
565 {
566 b1 = *pb;
567 if(b1 != trans) vgaPutPixel(x2, j, b1);
568 pb++;
569 }
570
571 opb += Source_lDelta;
572 pb = opb; // new test code
573 }
574}
unsigned char BOOLEAN
#define mod2(n)
Definition: vgavideo.h:71
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
VOID vgaPutPixel(INT x, INT y, UCHAR c)
Definition: vgavideo.c:163

Referenced by DrvTransparentBlt().

◆ get_masks()

void get_masks ( int  x,
int  w 
)

Definition at line 133 of file vgavideo.c.

134{
135 register int tmp;
136
137 leftMask = rightMask = 0;
138 byteCounter = w;
139 /* right margin */
140 tmp = (x+w) & 7;
141 if (tmp)
142 {
143 byteCounter -= tmp;
144 rightMask = (unsigned char)(0xff00 >> tmp);
145 }
146 /* left margin */
147 tmp = x & 7;
148 if (tmp)
149 {
150 byteCounter -= (8 - tmp);
151 leftMask = (0xff >> tmp);
152 }
153 /* too small ? */
154 if (byteCounter < 0)
155 {
157 rightMask = 0;
158 byteCounter = 0;
159 }
160 byteCounter /= 8;
161}
unsigned char
Definition: typeof.h:29
static unsigned char rightMask
Definition: vgavideo.c:23
static int byteCounter
Definition: vgavideo.c:22
static unsigned char leftMask
Definition: vgavideo.c:21

Referenced by DFB_BltFromVGA(), and vgaReadScan().

◆ VGADDIIntersectRect()

BOOL VGADDIIntersectRect ( PRECTL  prcDst,
PRECTL  prcSrc1,
PRECTL  prcSrc2 
)

Definition at line 333 of file vgavideo.c.

334{
335 prcDst->left = max(prcSrc1->left, prcSrc2->left);
336 prcDst->right = min(prcSrc1->right, prcSrc2->right);
337
338 if (prcDst->left < prcDst->right)
339 {
340 prcDst->top = max(prcSrc1->top, prcSrc2->top);
341 prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
342
343 if (prcDst->top < prcDst->bottom)
344 return TRUE;
345 }
346
347 *prcDst = rclEmpty;
348
349 return FALSE;
350}
#define min(a, b)
Definition: monoChain.cc:55
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
#define max(a, b)
Definition: svc.c:63
static const RECTL rclEmpty
Definition: vgavideo.c:331

◆ vgaGetByte()

VOID vgaGetByte ( ULONG  offset,
UCHAR b,
UCHAR g,
UCHAR r,
UCHAR i 
)

◆ vgaGetPixel()

INT vgaGetPixel ( INT  x,
INT  y 
)

◆ vgaHLine()

BOOL vgaHLine ( INT  x,
INT  y,
INT  len,
UCHAR  c 
)

Definition at line 231 of file vgavideo.c.

232{
233 ULONG orgx, pre1, midpre1;
234 //ULONG orgpre1;
235 LONG ileftpix, imidpix, irightpix;
236
237 orgx = x;
238
239 /*if ( len < 8 )
240 {
241 for (i = x; i < x+len; i++ )
242 vgaPutPixel ( i, y, c );
243
244 return TRUE;
245 }*/
246
247 /* Calculate the left mask pixels, middle bytes and right mask pixel */
248 ileftpix = 7 - mod8(x-1);
249 irightpix = mod8(x+len);
250 imidpix = (len-ileftpix-irightpix) / 8;
251
252 pre1 = xconv[(x-1)&~7] + y80[y];
253 //orgpre1=pre1;
254
255 /* check for overlap ( very short line ) */
256 if ( (ileftpix+irightpix) > len )
257 {
258 int mask = startmasks[ileftpix] & endmasks[irightpix];
259 /* Write left pixels */
260 WRITE_PORT_UCHAR((PUCHAR)GRA_I,0x08); // set the mask
262
265
266 return TRUE;
267 }
268
269 /* Left */
270 if ( ileftpix > 0 )
271 {
272 /* Write left pixels */
273 WRITE_PORT_UCHAR((PUCHAR)GRA_I,0x08); // set the mask
275
278
279 /* Prepare new x for the middle */
280 x = orgx + 8;
281 }
282
283 if ( imidpix > 0 )
284 {
285 midpre1 = xconv[x] + y80[y];
286
287 /* Set mask to all pixels in byte */
290 memset(vidmem+midpre1, c, imidpix); // write middle pixels, no need to read in latch because of the width
291 }
292
293 if ( irightpix > 0 )
294 {
295 x = orgx + len - irightpix;
296 pre1 = xconv[x] + y80[y];
297
298 /* Write right pixels */
299 WRITE_PORT_UCHAR((PUCHAR)GRA_I,0x08); // set the mask bits
303 }
304
305 return TRUE;
306}
#define mod8(n)
Definition: vgavideo.h:70
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
int endmasks[8]
Definition: vgavideo.c:17
int startmasks[8]
Definition: vgavideo.c:16

Referenced by DrvLineTo().

◆ vgaPreCalc()

VOID vgaPreCalc ( VOID  )

◆ vgaPutByte()

VOID vgaPutByte ( INT  x,
INT  y,
UCHAR  c 
)

Definition at line 176 of file vgavideo.c.

177{
179
180 offset = xconv[x]+y80[y];
181
182 /* Set the write mode */
185
187}

◆ vgaPutPixel()

VOID vgaPutPixel ( INT  x,
INT  y,
UCHAR  c 
)

◆ vgaVLine()

BOOL vgaVLine ( INT  x,
INT  y,
INT  len,
UCHAR  c 
)

Definition at line 308 of file vgavideo.c.

309{
310 INT offset, i;
311
312 offset = xconv[x]+y80[y];
313
314#ifdef VGA_PERF
315 vgaSetBitMaskRegister ( maskbit[x] );
316#else
317 WRITE_PORT_UCHAR((PUCHAR)GRA_I,0x08); // set the mask
319#endif
320
321 for(i=y; i<y+len; i++)
322 {
325 offset += 80;
326 }
327
328 return TRUE;
329}

Referenced by DrvLineTo().

Variable Documentation

◆ bit8

int bit8[640]
extern

Definition at line 15 of file vgavideo.c.

Referenced by vgaGetPixel(), and vgaPreCalc().

◆ endmasks

int endmasks[8]
extern

Definition at line 17 of file vgavideo.c.

Referenced by VGADDIFillSolid(), vgaHLine(), and vgaPreCalc().

◆ maskbit

int maskbit[640]
extern

◆ PreCalcReverseByte

UCHAR PreCalcReverseByte[256]
extern

Definition at line 11 of file vgavideo.c.

Referenced by DIB_BltFromVGA(), and vgaPreCalc().

◆ startmasks

int startmasks[8]
extern

Definition at line 16 of file vgavideo.c.

Referenced by VGADDIFillSolid(), vgaHLine(), and vgaPreCalc().

◆ vidmem

◆ xconv

◆ y80