3 #include "../vgavideo/vgavideo.h"
8 BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
10 int x, y, x2, y2, w, h;
11 ULONG offset, i, j, pre1;
12 ULONG orgpre1, orgx, midpre1, tmppre1;
13 ULONG ileftpix, imidpix, irightpix;
14 double leftpix, midpix, rightpix, temp;
17 DPRINT("VGADDIFillSolid: x:%d, y:%d, w:%d, h:%d\n", x, y, w, h);
19 // Swap dimensions so that x, y are at topmost left
20 if(Dimensions.right < Dimensions.left) {
24 x2 = Dimensions.right;
27 if(Dimensions.bottom < Dimensions.top) {
28 y = Dimensions.bottom;
31 y2 = Dimensions.bottom;
35 // Calculate the width and height
39 // Calculate the starting offset
40 offset = xconv[x]+y80[y];
42 // Make a note of original x
45 // If width is less than 8, draw using vertical lines
49 vgaVLine(i, y, h, iColor);
51 // Otherwise, use the optimized code
54 // Calculate the left mask pixels, middle bytes and right mask pixel
55 leftpix = 8-mod(x, 8);
56 rightpix = mod(x+w, 8);
57 midpix = (w-leftpix-rightpix) / 8;
63 pre1=xconv[x-(8-ileftpix)]+y80[y];
69 WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask
70 WRITE_PORT_UCHAR((PUCHAR)0x3cf,startmasks[ileftpix]);
75 a = READ_REGISTER_UCHAR(vidmem + tmppre1);
76 WRITE_REGISTER_UCHAR(vidmem + tmppre1, iColor);
80 // Prepare new x for the middle
86 midpre1=xconv[x]+y80[y];
88 // Set mask to all pixels in byte
89 WRITE_PORT_UCHAR((PUCHAR)0x3ce, 0x08);
91 WRITE_PORT_UCHAR((PUCHAR)0x3cf, 0xff);
95 memset(vidmem+midpre1, iColor, imidpix); // write middle pixels, no need to read in latch because of the width
101 pre1=xconv[x]+y80[y];
103 // Write right pixels
104 WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask bits
105 WRITE_PORT_UCHAR((PUCHAR)0x3cf,endmasks[irightpix]);
107 for (j=y; j<y+h; j++)
109 a = READ_REGISTER_UCHAR(vidmem + pre1);
110 WRITE_REGISTER_UCHAR(vidmem + pre1, iColor);
118 BOOL VGADDIPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
119 BRUSHINST *BrushInst, POINTL *BrushPoint)
124 DPRINT("VGADDIPaintRgn: iMode: %d, iDComplexity: %d\n Color:%d\n", ClipRegion->iMode, ClipRegion->iDComplexity, iColor);
125 switch(ClipRegion->iMode) {
129 /* Rectangular clipping can be handled without enumeration.
130 Note that trivial clipping is not possible, since the clipping
131 region defines the area to fill */
133 if (ClipRegion->iDComplexity == DC_RECT)
135 DPRINT("VGADDIPaintRgn Rect:%d %d %d %d\n", ClipRegion->rclBounds.left, ClipRegion->rclBounds.top, ClipRegion->rclBounds.right, ClipRegion->rclBounds.bottom);
136 VGADDIFillSolid(Surface, ClipRegion->rclBounds, iColor);
138 /* Enumerate all the rectangles and draw them */
140 CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY,
145 EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum);
146 DPRINT("EnumMore: %d, count: %d\n", EnumMore, RectEnum.c);
147 for( i=0; i<RectEnum.c; i++){
148 DPRINT("VGADDI enum Rect:%d %d %d %d\n", RectEnum.arcl[i].left, RectEnum.arcl[i].top, RectEnum.arcl[i].right, RectEnum.arcl[i].bottom);
149 VGADDIFillSolid(Surface, RectEnum.arcl[i], iColor);
165 DrvPaint(IN SURFOBJ *Surface,
166 IN CLIPOBJ *ClipRegion,
168 IN POINTL *BrushOrigin,
173 iSolidColor = Brush->iSolidColor; // FIXME: Realizations and the like
175 // If the foreground and background Mixes are the same,
176 // (LATER or if there's no brush mask)
177 // then see if we can use the solid brush accelerators
179 // FIXME: Put in the mix switch below
180 // Brush color parameter doesn't matter for these rops
181 return(VGADDIPaintRgn(Surface, ClipRegion, iSolidColor, Mix, NULL, BrushOrigin));
183 if ((Mix & 0xFF) == ((Mix >> 8) & 0xFF))
190 // FIXME: Implement all these millions of ROPs
191 // For now we don't support brushes -- everything is solid
206 // Rops that are implicit solid colors
212 // FIXME: The Paint region belongs HERE
224 // If VGADDIPaint can't do it, VGADDIBitBlt can.. or it might just loop back
225 // here and we have a nice infinite loop
227 /* return( VGADDIBitBlt(Surface, (SURFOBJ *)NULL, (SURFOBJ *)NULL, ClipRegion,
228 (XLATEOBJ *)NULL, &ClipRegion->rclBounds,
229 NULL, (POINTL *)NULL, Brush, BrushOrigin,
230 NULL) ); UNIMPLEMENTED */