mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
fixed several bugs, simplified some calculations. This appears to have broken framerect drawing ( zoomin on min/max buttons ), but I think that was expecting the wrong behavior.
svn path=/trunk/; revision=5519
This commit is contained in:
parent
83399f1ec0
commit
4e4e603189
3 changed files with 57 additions and 61 deletions
|
@ -17,17 +17,23 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
|||
DPRINT("VGADDIFillSolid: x:%d, y:%d, w:%d, h:%d\n", x, y, w, h);
|
||||
|
||||
// Swap dimensions so that x, y are at topmost left
|
||||
if(Dimensions.right < Dimensions.left) {
|
||||
if ( Dimensions.right < Dimensions.left )
|
||||
{
|
||||
x = Dimensions.right;
|
||||
x2 = Dimensions.left;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
x2 = Dimensions.right;
|
||||
x = Dimensions.left;
|
||||
}
|
||||
if(Dimensions.bottom < Dimensions.top) {
|
||||
if ( Dimensions.bottom < Dimensions.top )
|
||||
{
|
||||
y = Dimensions.bottom;
|
||||
y2 = Dimensions.top;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
y2 = Dimensions.bottom;
|
||||
y = Dimensions.top;
|
||||
}
|
||||
|
@ -49,18 +55,20 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
|||
vgaVLine(i, y, h, iColor);
|
||||
|
||||
// Otherwise, use the optimized code
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Calculate the left mask pixels, middle bytes and right mask pixel
|
||||
leftpix = 8-mod(x, 8);
|
||||
rightpix = mod(x+w, 8);
|
||||
ileftpix = 7 - mod8(x-1);
|
||||
rightpix = mod8(x+w);
|
||||
midpix = (w-leftpix-rightpix) / 8;
|
||||
|
||||
ileftpix = leftpix;
|
||||
irightpix = rightpix;
|
||||
imidpix = midpix;
|
||||
|
||||
pre1=xconv[x-(8-ileftpix)]+y80[y];
|
||||
pre1 = xconv[(x-1)&~7] + y80[y];
|
||||
orgpre1=pre1;
|
||||
|
||||
if ( ileftpix > 0 )
|
||||
|
|
|
@ -58,11 +58,11 @@ div_t div(int num, int denom)
|
|||
return r;
|
||||
}
|
||||
|
||||
int mod(int num, int denom)
|
||||
/*int mod(int num, int denom)
|
||||
{
|
||||
div_t dvt = div(num, denom);
|
||||
return dvt.rem;
|
||||
}
|
||||
}*/
|
||||
|
||||
BYTE bytesPerPixel(ULONG Format)
|
||||
{
|
||||
|
@ -109,17 +109,15 @@ VOID vgaPreCalc()
|
|||
startmasks[5] = 31;
|
||||
startmasks[6] = 63;
|
||||
startmasks[7] = 127;
|
||||
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;
|
||||
endmasks[0] = 0;
|
||||
endmasks[1] = 128;
|
||||
endmasks[2] = 192;
|
||||
endmasks[3] = 224;
|
||||
endmasks[4] = 240;
|
||||
endmasks[5] = 248;
|
||||
endmasks[6] = 252;
|
||||
endmasks[7] = 254;
|
||||
|
||||
for(j=0; j<80; j++)
|
||||
{
|
||||
|
@ -287,17 +285,11 @@ BOOL vgaHLine(INT x, INT y, INT len, UCHAR c)
|
|||
}
|
||||
|
||||
// Calculate the left mask pixels, middle bytes and right mask pixel
|
||||
ileftpix = 8-mod(x, 8);
|
||||
irightpix = mod(x+len, 8);
|
||||
ileftpix = 7 - mod8(x-1);
|
||||
irightpix = mod8(x+len);
|
||||
imidpix = (len-ileftpix-irightpix) / 8;
|
||||
|
||||
if(ileftpix == 8)
|
||||
{
|
||||
ileftpix = 0;
|
||||
imidpix++;
|
||||
}
|
||||
|
||||
pre1=xconv[x-(8-ileftpix)]+y80[y];
|
||||
pre1 = xconv[(x-1)&~7] + y80[y];
|
||||
orgpre1=pre1;
|
||||
|
||||
// Left
|
||||
|
@ -327,12 +319,6 @@ BOOL vgaHLine(INT x, INT y, INT len, UCHAR c)
|
|||
if ( irightpix > 0 )
|
||||
{
|
||||
x = orgx + len - irightpix;
|
||||
#if 0
|
||||
for(i=x; i<x+irightpix; i++)
|
||||
{
|
||||
vgaPutPixel(i, y, c);
|
||||
}
|
||||
#else
|
||||
pre1 = xconv[x] + y80[y];
|
||||
|
||||
// Write right pixels
|
||||
|
@ -340,7 +326,6 @@ BOOL vgaHLine(INT x, INT y, INT len, UCHAR c)
|
|||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, endmasks[irightpix]);
|
||||
a = READ_REGISTER_UCHAR(vidmem + pre1);
|
||||
WRITE_REGISTER_UCHAR(vidmem + pre1, c);
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -499,7 +484,7 @@ void DIB_BltFromVGA(int x, int y, int w, int h, void *b, int Dest_lDelta)
|
|||
BYTE b1, b2;
|
||||
|
||||
// Check if the width is odd
|
||||
if(mod(w, 2)>0)
|
||||
if(mod2(w)>0)
|
||||
{
|
||||
edgePixel = TRUE;
|
||||
x2 -= 1;
|
||||
|
@ -587,7 +572,7 @@ void DIB_TransparentBltToVGA(int x, int y, int w, int h, void *b, int Source_lDe
|
|||
BYTE b1, b2;
|
||||
|
||||
// Check if the width is odd
|
||||
if(mod(w, 2)>0)
|
||||
if(mod2(w)>0)
|
||||
{
|
||||
edgePixel = TRUE;
|
||||
x2 -= 1;
|
||||
|
@ -949,7 +934,7 @@ void DFB_BltToDIB(int x, int y, int w, int h, void *b, int bw, void *bdib, int d
|
|||
for (i=w; i>0; i--) {
|
||||
|
||||
// determine the bit shift for the DIB pixel
|
||||
dib_shift = mod(w-i, 2);
|
||||
dib_shift = mod2(w-i);
|
||||
if(dib_shift > 0) dib_shift = 4;
|
||||
dibTmp = dib;
|
||||
|
||||
|
@ -978,7 +963,7 @@ void DIB_BltToDFB(int x, int y, int w, int h, void *b, int bw, void *bdib, int d
|
|||
for (i=w; i>0; i--) {
|
||||
|
||||
// determine the bit shift for the DIB pixel
|
||||
dib_shift = mod(w-i, 2);
|
||||
dib_shift = mod2(w-i);
|
||||
if(dib_shift > 0) {
|
||||
dib_shift = 0;
|
||||
dib_and = 0x0f;
|
||||
|
|
|
@ -66,3 +66,6 @@ BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2);
|
|||
#define ASSIGNMK4(x, y, mask) mask = 0x80 >> ((x) & 7);
|
||||
|
||||
void get_masks(int x, int w);
|
||||
|
||||
#define mod8(n) ((n)&7)
|
||||
#define mod2(n) ((n)&1)
|
||||
|
|
Loading…
Reference in a new issue