[FORMATTING]

Fix indentation, no code change

svn path=/trunk/; revision=63090
This commit is contained in:
Timo Kreuzer 2014-05-01 09:48:40 +00:00
parent 779f0311f1
commit a45e440cac
7 changed files with 1138 additions and 1069 deletions

View file

@ -38,7 +38,8 @@ const LONG LINC[2] = {-1, 1};
/* FUNCTIONS ******************************************************************/ /* FUNCTIONS ******************************************************************/
BOOL FASTCALL BOOL
FASTCALL
IntEngGradientFillRect( IntEngGradientFillRect(
IN SURFOBJ *psoDest, IN SURFOBJ *psoDest,
IN CLIPOBJ *pco, IN CLIPOBJ *pco,
@ -50,129 +51,137 @@ IntEngGradientFillRect(
IN POINTL *pptlDitherOrg, IN POINTL *pptlDitherOrg,
IN BOOL Horizontal) IN BOOL Horizontal)
{ {
SURFOBJ *psoOutput; SURFOBJ *psoOutput;
TRIVERTEX *v1, *v2; TRIVERTEX *v1, *v2;
RECTL rcGradient, rcSG; RECTL rcGradient, rcSG;
RECT_ENUM RectEnum; RECT_ENUM RectEnum;
BOOL EnumMore; BOOL EnumMore;
ULONG i; ULONG i;
POINTL Translate; POINTL Translate;
INTENG_ENTER_LEAVE EnterLeave; INTENG_ENTER_LEAVE EnterLeave;
LONG y, dy, c[3], dc[3], ec[3], ic[3]; LONG y, dy, c[3], dc[3], ec[3], ic[3];
v1 = (pVertex + gRect->UpperLeft); v1 = (pVertex + gRect->UpperLeft);
v2 = (pVertex + gRect->LowerRight); v2 = (pVertex + gRect->LowerRight);
rcGradient.left = min(v1->x, v2->x); rcGradient.left = min(v1->x, v2->x);
rcGradient.right = max(v1->x, v2->x); rcGradient.right = max(v1->x, v2->x);
rcGradient.top = min(v1->y, v2->y); rcGradient.top = min(v1->y, v2->y);
rcGradient.bottom = max(v1->y, v2->y); rcGradient.bottom = max(v1->y, v2->y);
rcSG = rcGradient; rcSG = rcGradient;
RECTL_vOffsetRect(&rcSG, pptlDitherOrg->x, pptlDitherOrg->y); RECTL_vOffsetRect(&rcSG, pptlDitherOrg->x, pptlDitherOrg->y);
if(Horizontal) if(Horizontal)
{ {
dy = abs(rcGradient.right - rcGradient.left); dy = abs(rcGradient.right - rcGradient.left);
} }
else else
{ {
dy = abs(rcGradient.bottom - rcGradient.top); dy = abs(rcGradient.bottom - rcGradient.top);
} }
if(!IntEngEnter(&EnterLeave, psoDest, &rcSG, FALSE, &Translate, &psoOutput)) if(!IntEngEnter(&EnterLeave, psoDest, &rcSG, FALSE, &Translate, &psoOutput))
{ {
return FALSE; return FALSE;
} }
if((v1->Red != v2->Red || v1->Green != v2->Green || v1->Blue != v2->Blue) && dy > 1) if((v1->Red != v2->Red || v1->Green != v2->Green || v1->Blue != v2->Blue) && dy > 1)
{ {
CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
do
{
RECTL FillRect;
ULONG Color;
if (Horizontal)
{
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
{
if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
{
HVINITCOL(Red, 0);
HVINITCOL(Green, 1);
HVINITCOL(Blue, 2);
for (y = rcSG.left; y < FillRect.right; y++)
{
if (y >= FillRect.left)
{
Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2]));
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_VLine(
psoOutput, y + Translate.x, FillRect.top + Translate.y, FillRect.bottom + Translate.y, Color);
}
HVSTEPCOL(0);
HVSTEPCOL(1);
HVSTEPCOL(2);
}
}
}
continue;
}
/* vertical */
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
{
if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
{
HVINITCOL(Red, 0);
HVINITCOL(Green, 1);
HVINITCOL(Blue, 2);
for (y = rcSG.top; y < FillRect.bottom; y++)
{
if (y >= FillRect.top)
{
Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2]));
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput,
FillRect.left + Translate.x,
FillRect.right + Translate.x,
y + Translate.y,
Color);
}
HVSTEPCOL(0);
HVSTEPCOL(1);
HVSTEPCOL(2);
}
}
}
}
while (EnumMore);
return IntEngLeave(&EnterLeave);
}
/* rectangle has only one color, no calculation required */
CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0); CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
do do
{ {
RECTL FillRect; RECTL FillRect;
ULONG Color; ULONG Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red, v1->Green, v1->Blue));
if(Horizontal)
{
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum); EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++) for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
{ {
if(RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG)) if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
{
HVINITCOL(Red, 0);
HVINITCOL(Green, 1);
HVINITCOL(Blue, 2);
for(y = rcSG.left; y < FillRect.right; y++)
{ {
if(y >= FillRect.left) for (; FillRect.top < FillRect.bottom; FillRect.top++)
{ {
Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2])); DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput,
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_VLine( FillRect.left + Translate.x,
psoOutput, y + Translate.x, FillRect.top + Translate.y, FillRect.bottom + Translate.y, Color); FillRect.right + Translate.x,
} FillRect.top + Translate.y,
HVSTEPCOL(0); Color);
HVSTEPCOL(1); }
HVSTEPCOL(2);
} }
}
} }
}
continue; while (EnumMore);
}
/* vertical */
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
{
if(RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
{
HVINITCOL(Red, 0);
HVINITCOL(Green, 1);
HVINITCOL(Blue, 2);
for(y = rcSG.top; y < FillRect.bottom; y++)
{
if(y >= FillRect.top)
{
Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2]));
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(
psoOutput, FillRect.left + Translate.x, FillRect.right + Translate.x, y + Translate.y, Color);
}
HVSTEPCOL(0);
HVSTEPCOL(1);
HVSTEPCOL(2);
}
}
}
} while(EnumMore);
return IntEngLeave(&EnterLeave); return IntEngLeave(&EnterLeave);
}
/* rectangle has only one color, no calculation required */
CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
do
{
RECTL FillRect;
ULONG Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red, v1->Green, v1->Blue));
EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
{
if(RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
{
for(; FillRect.top < FillRect.bottom; FillRect.top++)
{
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(
psoOutput, FillRect.left + Translate.x, FillRect.right + Translate.x, FillRect.top + Translate.y, Color);
}
}
}
} while(EnumMore);
return IntEngLeave(&EnterLeave);
} }
/* Fill triangle with solid color */ /* Fill triangle with solid color */
@ -181,6 +190,7 @@ IntEngGradientFillRect(
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[lineto], FillRect.left), min(sx[linefrom], FillRect.right), sy, Color); \ DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[lineto], FillRect.left), min(sx[linefrom], FillRect.right), sy, Color); \
else \ else \
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[linefrom], FillRect.left), min(sx[lineto], FillRect.right), sy, Color); DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[linefrom], FillRect.left), min(sx[lineto], FillRect.right), sy, Color);
#define S_DOLINE(a,b,line) \ #define S_DOLINE(a,b,line) \
ex[line] += dx[line]; \ ex[line] += dx[line]; \
while(ex[line] > 0 && x[line] != destx[line]) \ while(ex[line] > 0 && x[line] != destx[line]) \
@ -189,11 +199,14 @@ IntEngGradientFillRect(
sx[line] += incx[line]; \ sx[line] += incx[line]; \
ex[line] -= dy[line]; \ ex[line] -= dy[line]; \
} }
#define S_GOLINE(a,b,line) \ #define S_GOLINE(a,b,line) \
if(y >= a->y && y <= b->y) \ if(y >= a->y && y <= b->y) \
{ {
#define S_ENDLINE(a,b,line) \ #define S_ENDLINE(a,b,line) \
} }
#define S_INITLINE(a,b,line) \ #define S_INITLINE(a,b,line) \
x[line] = a->x; \ x[line] = a->x; \
sx[line] = a->x + pptlDitherOrg->x; \ sx[line] = a->x + pptlDitherOrg->x; \
@ -209,6 +222,7 @@ IntEngGradientFillRect(
dc[line][id] = abs((b->col >> 8) - c[line][id]); \ dc[line][id] = abs((b->col >> 8) - c[line][id]); \
ec[line][id] = -(dy[line]>>1); \ ec[line][id] = -(dy[line]>>1); \
ic[line][id] = LINC[(b->col >> 8) > c[line][id]] ic[line][id] = LINC[(b->col >> 8) > c[line][id]]
#define STEPCOL(a,b,line,col,id) \ #define STEPCOL(a,b,line,col,id) \
ec[line][id] += dc[line][id]; \ ec[line][id] += dc[line][id]; \
while(ec[line][id] > 0) \ while(ec[line][id] > 0) \
@ -216,11 +230,13 @@ IntEngGradientFillRect(
c[line][id] += ic[line][id]; \ c[line][id] += ic[line][id]; \
ec[line][id] -= dy[line]; \ ec[line][id] -= dy[line]; \
} }
#define FINITCOL(linefrom,lineto,colid) \ #define FINITCOL(linefrom,lineto,colid) \
gc[colid] = c[linefrom][colid]; \ gc[colid] = c[linefrom][colid]; \
gd[colid] = abs(c[lineto][colid] - gc[colid]); \ gd[colid] = abs(c[lineto][colid] - gc[colid]); \
ge[colid] = -(gx >> 1); \ ge[colid] = -(gx >> 1); \
gi[colid] = LINC[c[lineto][colid] > gc[colid]] gi[colid] = LINC[c[lineto][colid] > gc[colid]]
#define FDOCOL(linefrom,lineto,colid) \ #define FDOCOL(linefrom,lineto,colid) \
ge[colid] += gd[colid]; \ ge[colid] += gd[colid]; \
while(ge[colid] > 0) \ while(ge[colid] > 0) \
@ -228,6 +244,7 @@ IntEngGradientFillRect(
gc[colid] += gi[colid]; \ gc[colid] += gi[colid]; \
ge[colid] -= gx; \ ge[colid] -= gx; \
} }
#define FILLLINE(linefrom,lineto) \ #define FILLLINE(linefrom,lineto) \
gx = abs(sx[lineto] - sx[linefrom]); \ gx = abs(sx[lineto] - sx[linefrom]); \
gxi = LINC[sx[linefrom] < sx[lineto]]; \ gxi = LINC[sx[linefrom] < sx[lineto]]; \
@ -245,6 +262,7 @@ IntEngGradientFillRect(
FDOCOL(linefrom, lineto, 1); \ FDOCOL(linefrom, lineto, 1); \
FDOCOL(linefrom, lineto, 2); \ FDOCOL(linefrom, lineto, 2); \
} }
#define DOLINE(a,b,line) \ #define DOLINE(a,b,line) \
STEPCOL(a, b, line, Red, 0); \ STEPCOL(a, b, line, Red, 0); \
STEPCOL(a, b, line, Green, 1); \ STEPCOL(a, b, line, Green, 1); \
@ -256,11 +274,14 @@ IntEngGradientFillRect(
sx[line] += incx[line]; \ sx[line] += incx[line]; \
ex[line] -= dy[line]; \ ex[line] -= dy[line]; \
} }
#define GOLINE(a,b,line) \ #define GOLINE(a,b,line) \
if(y >= a->y && y <= b->y) \ if(y >= a->y && y <= b->y) \
{ {
#define ENDLINE(a,b,line) \ #define ENDLINE(a,b,line) \
} }
#define INITLINE(a,b,line) \ #define INITLINE(a,b,line) \
x[line] = a->x; \ x[line] = a->x; \
sx[line] = a->x + pptlDitherOrg->x; \ sx[line] = a->x + pptlDitherOrg->x; \
@ -269,17 +290,23 @@ IntEngGradientFillRect(
incx[line] = LINC[b->x > a->x]; \ incx[line] = LINC[b->x > a->x]; \
ex[line] = -(dy[line]>>1); \ ex[line] = -(dy[line]>>1); \
destx[line] = b->x destx[line] = b->x
#define DOINIT(a, b, line) \ #define DOINIT(a, b, line) \
INITLINE(a, b, line); \ INITLINE(a, b, line); \
INITCOL(a, b, line, Red, 0); \ INITCOL(a, b, line, Red, 0); \
INITCOL(a, b, line, Green, 1); \ INITCOL(a, b, line, Green, 1); \
INITCOL(a, b, line, Blue, 2); INITCOL(a, b, line, Blue, 2);
#define SMALLER(a,b) (a->y < b->y) || (a->y == b->y && a->x < b->x) #define SMALLER(a,b) (a->y < b->y) || (a->y == b->y && a->x < b->x)
#define SWAP(a,b,c) c = a;\ #define SWAP(a,b,c) c = a;\
a = b;\ a = b;\
b = c b = c
#define NLINES 3 #define NLINES 3
BOOL FASTCALL
BOOL
FASTCALL
IntEngGradientFillTriangle( IntEngGradientFillTriangle(
IN SURFOBJ *psoDest, IN SURFOBJ *psoDest,
IN CLIPOBJ *pco, IN CLIPOBJ *pco,
@ -290,158 +317,161 @@ IntEngGradientFillTriangle(
IN RECTL *prclExtents, IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg) IN POINTL *pptlDitherOrg)
{ {
SURFOBJ *psoOutput; SURFOBJ *psoOutput;
PTRIVERTEX v1, v2, v3; PTRIVERTEX v1, v2, v3;
//RECT_ENUM RectEnum; //RECT_ENUM RectEnum;
//BOOL EnumMore; //BOOL EnumMore;
//ULONG i; //ULONG i;
POINTL Translate; POINTL Translate;
INTENG_ENTER_LEAVE EnterLeave; INTENG_ENTER_LEAVE EnterLeave;
RECTL FillRect = { 0, 0, 0, 0 }; RECTL FillRect = { 0, 0, 0, 0 };
//ULONG Color; //ULONG Color;
//BOOL sx[NLINES]; //BOOL sx[NLINES];
//LONG x[NLINES], dx[NLINES], dy[NLINES], incx[NLINES], ex[NLINES], destx[NLINES]; //LONG x[NLINES], dx[NLINES], dy[NLINES], incx[NLINES], ex[NLINES], destx[NLINES];
//LONG c[NLINES][3], dc[NLINES][3], ec[NLINES][3], ic[NLINES][3]; /* colors on lines */ //LONG c[NLINES][3], dc[NLINES][3], ec[NLINES][3], ic[NLINES][3]; /* colors on lines */
//LONG g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */ //LONG g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
//LONG sy, y, bt; //LONG sy, y, bt;
v1 = (pVertex + gTriangle->Vertex1); v1 = (pVertex + gTriangle->Vertex1);
v2 = (pVertex + gTriangle->Vertex2); v2 = (pVertex + gTriangle->Vertex2);
v3 = (pVertex + gTriangle->Vertex3); v3 = (pVertex + gTriangle->Vertex3);
/* bubble sort */ /* bubble sort */
if(SMALLER(v2,v1)) if (SMALLER(v2, v1))
{
TRIVERTEX *t;
SWAP(v1,v2,t);
}
if(SMALLER(v3,v2))
{
TRIVERTEX *t;
SWAP(v2,v3,t);
if(SMALLER(v2,v1))
{ {
SWAP(v1,v2,t); TRIVERTEX *t;
SWAP(v1, v2, t);
} }
}
DPRINT1("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y); if (SMALLER(v3, v2))
/* FIXME: commented out because of an endless loop - fix triangles first */ {
DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n"); TRIVERTEX *t;
SWAP(v2, v3, t);
if (SMALLER(v2, v1))
{
SWAP(v1, v2, t);
}
}
if(!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput)) DPRINT1("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y);
{ /* FIXME: commented out because of an endless loop - fix triangles first */
return FALSE; DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n");
}
//if(VCMPCLRS(v1, v2, v3)) if (!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput))
//{ {
// CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0); return FALSE;
// do }
// {
// EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
// for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
// {
// if(RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
// {
// BOOL InY;
// DOINIT(v1, v3, 0); //if (VCMPCLRS(v1, v2, v3))
// DOINIT(v1, v2, 1); //{
// DOINIT(v2, v3, 2); // CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
// do
// {
// EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
// for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
// {
// if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
// {
// BOOL InY;
// y = v1->y; // DOINIT(v1, v3, 0);
// sy = v1->y + pptlDitherOrg->y; // DOINIT(v1, v2, 1);
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom); // DOINIT(v2, v3, 2);
// while(sy < bt) // y = v1->y;
// { // sy = v1->y + pptlDitherOrg->y;
// InY = !(sy < FillRect.top || sy >= FillRect.bottom); // bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
// GOLINE(v1, v3, 0);
// DOLINE(v1, v3, 0);
// ENDLINE(v1, v3, 0);
// GOLINE(v1, v2, 1); // while (sy < bt)
// DOLINE(v1, v2, 1); // {
// FILLLINE(0, 1); // InY = !(sy < FillRect.top || sy >= FillRect.bottom);
// ENDLINE(v1, v2, 1); // GOLINE(v1, v3, 0);
// DOLINE(v1, v3, 0);
// ENDLINE(v1, v3, 0);
// GOLINE(v2, v3, 2); // GOLINE(v1, v2, 1);
// DOLINE(v2, v3, 2); // DOLINE(v1, v2, 1);
// FILLLINE(0, 2); // FILLLINE(0, 1);
// ENDLINE(23, v3, 2); // ENDLINE(v1, v2, 1);
// y++; // GOLINE(v2, v3, 2);
// sy++; // DOLINE(v2, v3, 2);
// } // FILLLINE(0, 2);
// } // ENDLINE(23, v3, 2);
// }
// } while(EnumMore);
// return IntEngLeave(&EnterLeave); // y++;
//} // sy++;
// }
// }
// }
// } while (EnumMore);
///* fill triangle with one solid color */ // return IntEngLeave(&EnterLeave);
//}
//Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8)); ///* fill triangle with one solid color */
//CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
//do
//{
// EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
// for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
// {
// if(RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
// {
// S_INITLINE(v1, v3, 0);
// S_INITLINE(v1, v2, 1);
// S_INITLINE(v2, v3, 2);
// y = v1->y; //Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
// sy = v1->y + pptlDitherOrg->y; //CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom); //do
//{
// EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
// for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
// {
// if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
// {
// S_INITLINE(v1, v3, 0);
// S_INITLINE(v1, v2, 1);
// S_INITLINE(v2, v3, 2);
// while(sy < bt) // y = v1->y;
// { // sy = v1->y + pptlDitherOrg->y;
// S_GOLINE(v1, v3, 0); // bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
// S_DOLINE(v1, v3, 0);
// S_ENDLINE(v1, v3, 0);
// S_GOLINE(v1, v2, 1); // while (sy < bt)
// S_DOLINE(v1, v2, 1); // {
// S_FILLLINE(0, 1); // S_GOLINE(v1, v3, 0);
// S_ENDLINE(v1, v2, 1); // S_DOLINE(v1, v3, 0);
// S_ENDLINE(v1, v3, 0);
// S_GOLINE(v2, v3, 2); // S_GOLINE(v1, v2, 1);
// S_DOLINE(v2, v3, 2); // S_DOLINE(v1, v2, 1);
// S_FILLLINE(0, 2); // S_FILLLINE(0, 1);
// S_ENDLINE(23, v3, 2); // S_ENDLINE(v1, v2, 1);
// y++; // S_GOLINE(v2, v3, 2);
// sy++; // S_DOLINE(v2, v3, 2);
// } // S_FILLLINE(0, 2);
// } // S_ENDLINE(23, v3, 2);
// }
//} while(EnumMore);
return IntEngLeave(&EnterLeave); // y++;
// sy++;
// }
// }
// }
//} while (EnumMore);
return IntEngLeave(&EnterLeave);
} }
static BOOL static
BOOL
IntEngIsNULLTriangle(TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt) IntEngIsNULLTriangle(TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt)
{ {
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2))) if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))
return TRUE; return TRUE;
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3))) if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3)))
return TRUE; return TRUE;
if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3))) if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3)))
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
BOOL APIENTRY BOOL
APIENTRY
EngGradientFill( EngGradientFill(
_Inout_ SURFOBJ *psoDest, _Inout_ SURFOBJ *psoDest,
_In_ CLIPOBJ *pco, _In_ CLIPOBJ *pco,
@ -454,90 +484,119 @@ EngGradientFill(
_In_ POINTL *pptlDitherOrg, _In_ POINTL *pptlDitherOrg,
_In_ ULONG ulMode) _In_ ULONG ulMode)
{ {
ULONG i; ULONG i;
BOOL ret = FALSE; BOOL ret = FALSE;
if (!pco)
{
pco = IntEngCreateClipRegion(0, 0, prclExtents);
if (!pco) if (!pco)
{ {
return FALSE; pco = IntEngCreateClipRegion(0, 0, prclExtents);
if (!pco)
{
return FALSE;
}
} }
}
switch(ulMode) switch(ulMode)
{
case GRADIENT_FILL_RECT_H:
case GRADIENT_FILL_RECT_V:
{ {
PGRADIENT_RECT gr = (PGRADIENT_RECT)pMesh; case GRADIENT_FILL_RECT_H:
for(i = 0; i < nMesh; i++, gr++) case GRADIENT_FILL_RECT_V:
{
if(!IntEngGradientFillRect(psoDest, pco, pxlo, pVertex, nVertex, gr, prclExtents,
pptlDitherOrg, (ulMode == GRADIENT_FILL_RECT_H)))
{ {
break; PGRADIENT_RECT gr = (PGRADIENT_RECT)pMesh;
for (i = 0; i < nMesh; i++, gr++)
{
if (!IntEngGradientFillRect(psoDest,
pco,
pxlo,
pVertex,
nVertex,
gr,
prclExtents,
pptlDitherOrg,
(ulMode == GRADIENT_FILL_RECT_H)))
{
break;
}
}
ret = TRUE;
break;
}
case GRADIENT_FILL_TRIANGLE:
{
PGRADIENT_TRIANGLE gt = (PGRADIENT_TRIANGLE)pMesh;
for (i = 0; i < nMesh; i++, gt++)
{
if (IntEngIsNULLTriangle(pVertex, gt))
{
/* skip empty triangles */
continue;
}
if (!IntEngGradientFillTriangle(psoDest,
pco,
pxlo,
pVertex,
nVertex,
gt,
prclExtents,
pptlDitherOrg))
{
break;
}
}
ret = TRUE;
break;
} }
}
ret = TRUE;
break;
} }
case GRADIENT_FILL_TRIANGLE:
{
PGRADIENT_TRIANGLE gt = (PGRADIENT_TRIANGLE)pMesh;
for(i = 0; i < nMesh; i++, gt++)
{
if(IntEngIsNULLTriangle(pVertex, gt))
{
/* skip empty triangles */
continue;
}
if(!IntEngGradientFillTriangle(psoDest, pco, pxlo, pVertex, nVertex, gt, prclExtents,
pptlDitherOrg))
{
break;
}
}
ret = TRUE;
break;
}
}
return ret; return ret;
} }
BOOL APIENTRY BOOL
APIENTRY
IntEngGradientFill( IntEngGradientFill(
IN SURFOBJ *psoDest, IN SURFOBJ *psoDest,
IN CLIPOBJ *pco, IN CLIPOBJ *pco,
IN XLATEOBJ *pxlo, IN XLATEOBJ *pxlo,
IN TRIVERTEX *pVertex, IN TRIVERTEX *pVertex,
IN ULONG nVertex, IN ULONG nVertex,
IN PVOID pMesh, IN PVOID pMesh,
IN ULONG nMesh, IN ULONG nMesh,
IN RECTL *prclExtents, IN RECTL *prclExtents,
IN POINTL *pptlDitherOrg, IN POINTL *pptlDitherOrg,
IN ULONG ulMode) IN ULONG ulMode)
{ {
BOOL Ret; BOOL Ret;
SURFACE *psurf; SURFACE *psurf;
ASSERT(psoDest); ASSERT(psoDest);
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
ASSERT(psurf); ASSERT(psurf);
if(psurf->flags & HOOK_GRADIENTFILL) if (psurf->flags & HOOK_GRADIENTFILL)
{ {
Ret = GDIDEVFUNCS(psoDest).GradientFill( Ret = GDIDEVFUNCS(psoDest).GradientFill(psoDest,
psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, pco,
prclExtents, pptlDitherOrg, ulMode); pxlo,
} pVertex,
else nVertex,
{ pMesh,
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents, nMesh,
pptlDitherOrg, ulMode); prclExtents,
} pptlDitherOrg,
ulMode);
}
else
{
Ret = EngGradientFill(psoDest,
pco,
pxlo,
pVertex,
nVertex,
pMesh,
nMesh,
prclExtents,
pptlDitherOrg,
ulMode);
}
return Ret; return Ret;
} }

View file

@ -1,4 +1,4 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: GDI Driver Performance Counter Functions * PURPOSE: GDI Driver Performance Counter Functions
@ -17,10 +17,10 @@
VOID APIENTRY VOID APIENTRY
EngQueryPerformanceFrequency(LONGLONG *Frequency) EngQueryPerformanceFrequency(LONGLONG *Frequency)
{ {
LARGE_INTEGER Freq; LARGE_INTEGER Freq;
KeQueryPerformanceCounter(&Freq); KeQueryPerformanceCounter(&Freq);
*Frequency = Freq.QuadPart; *Frequency = Freq.QuadPart;
} }
/* /*
@ -29,8 +29,8 @@ EngQueryPerformanceFrequency(LONGLONG *Frequency)
VOID APIENTRY VOID APIENTRY
EngQueryPerformanceCounter(LONGLONG *Count) EngQueryPerformanceCounter(LONGLONG *Count)
{ {
LARGE_INTEGER PerfCount; LARGE_INTEGER PerfCount;
PerfCount = KeQueryPerformanceCounter(NULL); PerfCount = KeQueryPerformanceCounter(NULL);
*Count = PerfCount.QuadPart; *Count = PerfCount.QuadPart;
} }

View file

@ -8,26 +8,28 @@
*/ */
HSEMAPHORE HSEMAPHORE
APIENTRY APIENTRY
EngCreateSemaphore ( VOID ) EngCreateSemaphore(VOID)
{ {
// www.osr.com/ddk/graphics/gdifncs_95lz.htm // www.osr.com/ddk/graphics/gdifncs_95lz.htm
PERESOURCE psem = ExAllocatePoolWithTag( NonPagedPool, sizeof(ERESOURCE), GDITAG_SEMAPHORE ); PERESOURCE psem = ExAllocatePoolWithTag(NonPagedPool, sizeof(ERESOURCE), GDITAG_SEMAPHORE);
if ( !psem ) if (!psem)
return NULL; return NULL;
if ( !NT_SUCCESS(ExInitializeResourceLite ( psem )) )
{ if (!NT_SUCCESS(ExInitializeResourceLite(psem)))
ExFreePoolWithTag ( psem, GDITAG_SEMAPHORE ); {
return NULL; ExFreePoolWithTag ( psem, GDITAG_SEMAPHORE );
} return NULL;
return (HSEMAPHORE)psem; }
return (HSEMAPHORE)psem;
} }
VOID VOID
FASTCALL FASTCALL
IntGdiAcquireSemaphore ( HSEMAPHORE hsem ) IntGdiAcquireSemaphore(HSEMAPHORE hsem)
{ {
KeEnterCriticalRegion(); KeEnterCriticalRegion();
ExAcquireResourceExclusiveLite ( (PERESOURCE)hsem, TRUE ); ExAcquireResourceExclusiveLite ((PERESOURCE)hsem, TRUE);
} }
/* /*
@ -35,14 +37,14 @@ IntGdiAcquireSemaphore ( HSEMAPHORE hsem )
*/ */
VOID VOID
APIENTRY APIENTRY
EngAcquireSemaphore ( IN HSEMAPHORE hsem ) EngAcquireSemaphore(IN HSEMAPHORE hsem)
{ {
// www.osr.com/ddk/graphics/gdifncs_14br.htm // www.osr.com/ddk/graphics/gdifncs_14br.htm
PTHREADINFO W32Thread; PTHREADINFO W32Thread;
ASSERT(hsem); ASSERT(hsem);
IntGdiAcquireSemaphore ( hsem ); IntGdiAcquireSemaphore(hsem);
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread()); W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
if (W32Thread) W32Thread->dwEngAcquireCount++; if (W32Thread) W32Thread->dwEngAcquireCount++;
} }
@ -50,8 +52,8 @@ VOID
FASTCALL FASTCALL
IntGdiReleaseSemaphore ( HSEMAPHORE hsem ) IntGdiReleaseSemaphore ( HSEMAPHORE hsem )
{ {
ExReleaseResourceLite ( (PERESOURCE)hsem ); ExReleaseResourceLite((PERESOURCE)hsem);
KeLeaveCriticalRegion(); KeLeaveCriticalRegion();
} }
/* /*
@ -61,12 +63,12 @@ VOID
APIENTRY APIENTRY
EngReleaseSemaphore ( IN HSEMAPHORE hsem ) EngReleaseSemaphore ( IN HSEMAPHORE hsem )
{ {
// www.osr.com/ddk/graphics/gdifncs_5u3r.htm // www.osr.com/ddk/graphics/gdifncs_5u3r.htm
PTHREADINFO W32Thread; PTHREADINFO W32Thread;
ASSERT(hsem); ASSERT(hsem);
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread()); W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
if (W32Thread) --W32Thread->dwEngAcquireCount; if (W32Thread) --W32Thread->dwEngAcquireCount;
IntGdiReleaseSemaphore ( hsem ); IntGdiReleaseSemaphore(hsem);
} }
VOID VOID
@ -89,12 +91,11 @@ VOID
APIENTRY APIENTRY
EngDeleteSemaphore ( IN HSEMAPHORE hsem ) EngDeleteSemaphore ( IN HSEMAPHORE hsem )
{ {
// www.osr.com/ddk/graphics/gdifncs_13c7.htm // www.osr.com/ddk/graphics/gdifncs_13c7.htm
ASSERT ( hsem ); ASSERT(hsem);
ExDeleteResourceLite((PERESOURCE)hsem); ExDeleteResourceLite((PERESOURCE)hsem);
ExFreePoolWithTag((PVOID)hsem, GDITAG_SEMAPHORE);
ExFreePoolWithTag( (PVOID)hsem, GDITAG_SEMAPHORE);
} }
/* /*
@ -104,9 +105,9 @@ BOOL
APIENTRY APIENTRY
EngIsSemaphoreOwned ( IN HSEMAPHORE hsem ) EngIsSemaphoreOwned ( IN HSEMAPHORE hsem )
{ {
// www.osr.com/ddk/graphics/gdifncs_6wmf.htm // www.osr.com/ddk/graphics/gdifncs_6wmf.htm
ASSERT(hsem); ASSERT(hsem);
return (((PERESOURCE)hsem)->ActiveCount > 0); return (((PERESOURCE)hsem)->ActiveCount > 0);
} }
/* /*
@ -116,9 +117,9 @@ BOOL
APIENTRY APIENTRY
EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem ) EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem )
{ {
// www.osr.com/ddk/graphics/gdifncs_9yxz.htm // www.osr.com/ddk/graphics/gdifncs_9yxz.htm
ASSERT(hsem); ASSERT(hsem);
return ExIsResourceAcquiredExclusiveLite ( (PERESOURCE)hsem ); return ExIsResourceAcquiredExclusiveLite((PERESOURCE)hsem);
} }
/* /*
@ -126,32 +127,32 @@ EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem )
*/ */
BOOL APIENTRY BOOL APIENTRY
EngInitializeSafeSemaphore( EngInitializeSafeSemaphore(
OUT ENGSAFESEMAPHORE *Semaphore) OUT ENGSAFESEMAPHORE *Semaphore)
{ {
HSEMAPHORE hSem; HSEMAPHORE hSem;
if (InterlockedIncrement(&Semaphore->lCount) == 1) if (InterlockedIncrement(&Semaphore->lCount) == 1)
{ {
/* Create the semaphore */ /* Create the semaphore */
hSem = EngCreateSemaphore(); hSem = EngCreateSemaphore();
if (hSem == 0) if (hSem == 0)
{ {
InterlockedDecrement(&Semaphore->lCount); InterlockedDecrement(&Semaphore->lCount);
return FALSE; return FALSE;
} }
/* FIXME: Not thread-safe! Check result of InterlockedCompareExchangePointer /* FIXME: Not thread-safe! Check result of InterlockedCompareExchangePointer
and delete semaphore if already initialized! */ and delete semaphore if already initialized! */
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, hSem); (void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, hSem);
} }
else else
{ {
/* Wait for the other thread to create the semaphore */ /* Wait for the other thread to create the semaphore */
ASSERT(Semaphore->lCount > 1); ASSERT(Semaphore->lCount > 1);
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL); ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
while (Semaphore->hsem == NULL); while (Semaphore->hsem == NULL);
} }
return TRUE; return TRUE;
} }
/* /*
@ -159,14 +160,14 @@ EngInitializeSafeSemaphore(
*/ */
VOID APIENTRY VOID APIENTRY
EngDeleteSafeSemaphore( EngDeleteSafeSemaphore(
IN OUT ENGSAFESEMAPHORE *Semaphore) IN OUT ENGSAFESEMAPHORE *Semaphore)
{ {
if (InterlockedDecrement(&Semaphore->lCount) == 0) if (InterlockedDecrement(&Semaphore->lCount) == 0)
{ {
/* FIXME: Not thread-safe! Use result of InterlockedCompareExchangePointer! */ /* FIXME: Not thread-safe! Use result of InterlockedCompareExchangePointer! */
EngDeleteSemaphore(Semaphore->hsem); EngDeleteSemaphore(Semaphore->hsem);
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, NULL); (void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, NULL);
} }
} }
/* EOF */ /* EOF */

View file

@ -1,7 +1,7 @@
/* /*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS win32 subsystem * PROJECT: ReactOS win32 subsystem
* PURPOSE: * PURPOSE:
* FILE: subsystems/win32k/eng/sort.c * FILE: subsystems/win32k/eng/sort.c
* PROGRAMER: ReactOS Team * PROGRAMER: ReactOS Team
*/ */
@ -14,10 +14,11 @@
/* /*
* @implemented * @implemented
*/ */
void APIENTRY void
APIENTRY
EngSort(IN OUT PBYTE Buf, IN ULONG ElemSize, IN ULONG ElemCount, IN SORTCOMP CompFunc) EngSort(IN OUT PBYTE Buf, IN ULONG ElemSize, IN ULONG ElemCount, IN SORTCOMP CompFunc)
{ {
qsort(Buf, ElemCount, ElemSize, CompFunc); qsort(Buf, ElemCount, ElemSize, CompFunc);
} }
/* EOF */ /* EOF */

View file

@ -8,82 +8,87 @@
BOOL BOOL
APIENTRY APIENTRY
STROBJ_bEnum( STROBJ_bEnum(
IN STROBJ *pstro, IN STROBJ *pstro,
OUT ULONG *pc, OUT ULONG *pc,
OUT PGLYPHPOS *ppgpos OUT PGLYPHPOS *ppgpos)
)
{ {
// www.osr.com/ddk/graphics/gdifncs_65uv.htm // www.osr.com/ddk/graphics/gdifncs_65uv.htm
UNIMPLEMENTED; UNIMPLEMENTED;
return FALSE; return FALSE;
} }
DWORD DWORD
APIENTRY APIENTRY
STROBJ_dwGetCodePage ( IN STROBJ *pstro ) STROBJ_dwGetCodePage(
IN STROBJ *pstro)
{ {
// www.osr.com/ddk/graphics/gdifncs_9jmv.htm // www.osr.com/ddk/graphics/gdifncs_9jmv.htm
PSTRGDI pStrGdi = (PSTRGDI) pstro; PSTRGDI pStrGdi = (PSTRGDI) pstro;
return pStrGdi->dwCodePage; return pStrGdi->dwCodePage;
} }
VOID VOID
APIENTRY APIENTRY
STROBJ_vEnumStart ( IN STROBJ *pstro ) STROBJ_vEnumStart(
IN STROBJ *pstro)
{ {
// www.osr.com/ddk/graphics/gdifncs_32uf.htm // www.osr.com/ddk/graphics/gdifncs_32uf.htm
UNIMPLEMENTED; UNIMPLEMENTED;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL APIENTRY BOOL
APIENTRY
STROBJ_bEnumPositionsOnly( STROBJ_bEnumPositionsOnly(
IN STROBJ *StringObj, IN STROBJ *StringObj,
OUT ULONG *Count, OUT ULONG *Count,
OUT PGLYPHPOS *Pos) OUT PGLYPHPOS *Pos)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return (BOOL) DDI_ERROR; return (BOOL) DDI_ERROR;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
BOOL APIENTRY BOOL
APIENTRY
STROBJ_bGetAdvanceWidths( STROBJ_bGetAdvanceWidths(
IN STROBJ *StringObj, IN STROBJ *StringObj,
IN ULONG First, IN ULONG First,
IN ULONG Count, IN ULONG Count,
OUT POINTQF *Widths) OUT POINTQF *Widths)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return FALSE; return FALSE;
} }
/* /*
* @implemented * @implemented
*/ */
FIX APIENTRY FIX
APIENTRY
STROBJ_fxBreakExtra( STROBJ_fxBreakExtra(
IN STROBJ *StringObj) IN STROBJ *StringObj)
{ {
PSTRGDI pStrGdi = (PSTRGDI) StringObj; PSTRGDI pStrGdi = (PSTRGDI) StringObj;
if (pStrGdi->StrObj.flAccel & SO_BREAK_EXTRA) return pStrGdi->fxBreakExtra; if (pStrGdi->StrObj.flAccel & SO_BREAK_EXTRA) return pStrGdi->fxBreakExtra;
return (FIX) 0; return (FIX) 0;
} }
/* /*
* @implemented * @implemented
*/ */
FIX APIENTRY FIX
APIENTRY
STROBJ_fxCharacterExtra( STROBJ_fxCharacterExtra(
IN STROBJ *StringObj) IN STROBJ *StringObj)
{ {
PSTRGDI pStrGdi = (PSTRGDI) StringObj; PSTRGDI pStrGdi = (PSTRGDI) StringObj;
if (pStrGdi->StrObj.flAccel & SO_CHARACTER_EXTRA) return pStrGdi->fxExtra; if (pStrGdi->StrObj.flAccel & SO_CHARACTER_EXTRA) return pStrGdi->fxExtra;
return (FIX) 0; return (FIX)0;
} }
/* EOF */ /* EOF */

File diff suppressed because it is too large Load diff

View file

@ -11,277 +11,293 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
BOOL APIENTRY BOOL
EngTransparentBlt(SURFOBJ *psoDest, APIENTRY
SURFOBJ *psoSource, EngTransparentBlt(
CLIPOBJ *Clip, SURFOBJ *psoDest,
XLATEOBJ *ColorTranslation, SURFOBJ *psoSource,
PRECTL DestRect, CLIPOBJ *Clip,
PRECTL SourceRect, XLATEOBJ *ColorTranslation,
ULONG iTransColor, PRECTL DestRect,
ULONG Reserved) PRECTL SourceRect,
ULONG iTransColor,
ULONG Reserved)
{ {
BOOL Ret = TRUE; BOOL Ret = TRUE;
BYTE ClippingType; BYTE ClippingType;
INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest; INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest;
SURFOBJ *InputObj, *OutputObj; SURFOBJ *InputObj, *OutputObj;
RECTL OutputRect, InputRect; RECTL OutputRect, InputRect;
POINTL Translate; POINTL Translate;
LONG DstHeight; LONG DstHeight;
LONG DstWidth; LONG DstWidth;
LONG SrcHeight; LONG SrcHeight;
LONG SrcWidth; LONG SrcWidth;
InputRect = *SourceRect; InputRect = *SourceRect;
if(!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj)) if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
{
return FALSE;
}
InputRect.left += Translate.x;
InputRect.right += Translate.x;
InputRect.top += Translate.y;
InputRect.bottom += Translate.y;
OutputRect = *DestRect;
if (OutputRect.right < OutputRect.left)
{
OutputRect.left = DestRect->right;
OutputRect.right = DestRect->left;
}
if (OutputRect.bottom < OutputRect.top)
{
OutputRect.top = DestRect->bottom;
OutputRect.bottom = DestRect->top;
}
if(Clip)
{
if(OutputRect.left < Clip->rclBounds.left)
{ {
InputRect.left += Clip->rclBounds.left - OutputRect.left; return FALSE;
OutputRect.left = Clip->rclBounds.left;
} }
if(Clip->rclBounds.right < OutputRect.right) InputRect.left += Translate.x;
InputRect.right += Translate.x;
InputRect.top += Translate.y;
InputRect.bottom += Translate.y;
OutputRect = *DestRect;
if (OutputRect.right < OutputRect.left)
{ {
InputRect.right -= OutputRect.right - Clip->rclBounds.right; OutputRect.left = DestRect->right;
OutputRect.right = Clip->rclBounds.right; OutputRect.right = DestRect->left;
} }
if(OutputRect.top < Clip->rclBounds.top) if (OutputRect.bottom < OutputRect.top)
{ {
InputRect.top += Clip->rclBounds.top - OutputRect.top; OutputRect.top = DestRect->bottom;
OutputRect.top = Clip->rclBounds.top; OutputRect.bottom = DestRect->top;
} }
if(Clip->rclBounds.bottom < OutputRect.bottom)
if (Clip)
{ {
InputRect.bottom -= OutputRect.bottom - Clip->rclBounds.bottom; if (OutputRect.left < Clip->rclBounds.left)
OutputRect.bottom = Clip->rclBounds.bottom;
}
}
/* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
nothing to do */
if(OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
{
IntEngLeave(&EnterLeaveSource);
return TRUE;
}
if(!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
{
IntEngLeave(&EnterLeaveSource);
return FALSE;
}
OutputRect.left = DestRect->left + Translate.x;
OutputRect.right = DestRect->right + Translate.x;
OutputRect.top = DestRect->top + Translate.y;
OutputRect.bottom = DestRect->bottom + Translate.y;
ClippingType = (Clip ? Clip->iDComplexity : DC_TRIVIAL);
DstHeight = OutputRect.bottom - OutputRect.top;
DstWidth = OutputRect.right - OutputRect.left;
SrcHeight = InputRect.bottom - InputRect.top;
SrcWidth = InputRect.right - InputRect.left;
switch(ClippingType)
{
case DC_TRIVIAL:
{
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
OutputObj, InputObj, &OutputRect, &InputRect, ColorTranslation, iTransColor);
break;
}
case DC_RECT:
{
RECTL ClipRect, CombinedRect;
RECTL InputToCombinedRect;
ClipRect.left = Clip->rclBounds.left + Translate.x;
ClipRect.right = Clip->rclBounds.right + Translate.x;
ClipRect.top = Clip->rclBounds.top + Translate.y;
ClipRect.bottom = Clip->rclBounds.bottom + Translate.y;
if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
{
InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
OutputObj, InputObj, &CombinedRect, &InputToCombinedRect, ColorTranslation, iTransColor);
}
break;
}
case DC_COMPLEX:
{
ULONG Direction, i;
RECT_ENUM RectEnum;
BOOL EnumMore;
if(OutputObj == InputObj)
{
if(OutputRect.top < InputRect.top)
{ {
Direction = OutputRect.left < (InputRect.left ? CD_RIGHTDOWN : CD_LEFTDOWN); InputRect.left += Clip->rclBounds.left - OutputRect.left;
OutputRect.left = Clip->rclBounds.left;
} }
else if (Clip->rclBounds.right < OutputRect.right)
{ {
Direction = OutputRect.left < (InputRect.left ? CD_RIGHTUP : CD_LEFTUP); InputRect.right -= OutputRect.right - Clip->rclBounds.right;
OutputRect.right = Clip->rclBounds.right;
} }
} if (OutputRect.top < Clip->rclBounds.top)
else
{
Direction = CD_ANY;
}
CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, Direction, 0);
do
{
EnumMore = CLIPOBJ_bEnum(Clip, sizeof(RectEnum), (PVOID)&RectEnum);
for (i = 0; i < RectEnum.c; i++)
{ {
RECTL ClipRect, CombinedRect; InputRect.top += Clip->rclBounds.top - OutputRect.top;
RECTL InputToCombinedRect; OutputRect.top = Clip->rclBounds.top;
}
if (Clip->rclBounds.bottom < OutputRect.bottom)
{
InputRect.bottom -= OutputRect.bottom - Clip->rclBounds.bottom;
OutputRect.bottom = Clip->rclBounds.bottom;
}
}
ClipRect.left = RectEnum.arcl[i].left + Translate.x; /* Check for degenerate case: if height or width of OutputRect is 0 pixels there's
ClipRect.right = RectEnum.arcl[i].right + Translate.x; nothing to do */
ClipRect.top = RectEnum.arcl[i].top + Translate.y; if (OutputRect.right <= OutputRect.left || OutputRect.bottom <= OutputRect.top)
ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y; {
if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, &ClipRect)) IntEngLeave(&EnterLeaveSource);
{ return TRUE;
InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * SrcHeight / DstHeight; }
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
if (!IntEngEnter(&EnterLeaveDest, psoDest, &OutputRect, FALSE, &Translate, &OutputObj))
{
IntEngLeave(&EnterLeaveSource);
return FALSE;
}
OutputRect.left = DestRect->left + Translate.x;
OutputRect.right = DestRect->right + Translate.x;
OutputRect.top = DestRect->top + Translate.y;
OutputRect.bottom = DestRect->bottom + Translate.y;
ClippingType = (Clip ? Clip->iDComplexity : DC_TRIVIAL);
DstHeight = OutputRect.bottom - OutputRect.top;
DstWidth = OutputRect.right - OutputRect.left;
SrcHeight = InputRect.bottom - InputRect.top;
SrcWidth = InputRect.right - InputRect.left;
switch (ClippingType)
{
case DC_TRIVIAL:
{
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt( Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
OutputObj, InputObj, &CombinedRect, &InputToCombinedRect, ColorTranslation, iTransColor); OutputObj, InputObj, &OutputRect, &InputRect, ColorTranslation, iTransColor);
if(!Ret) break;
{
break;
}
}
} }
} while(EnumMore && Ret); case DC_RECT:
break; {
} RECTL ClipRect, CombinedRect;
default: RECTL InputToCombinedRect;
{
Ret = FALSE;
break;
}
}
IntEngLeave(&EnterLeaveDest); ClipRect.left = Clip->rclBounds.left + Translate.x;
IntEngLeave(&EnterLeaveSource); ClipRect.right = Clip->rclBounds.right + Translate.x;
ClipRect.top = Clip->rclBounds.top + Translate.y;
ClipRect.bottom = Clip->rclBounds.bottom + Translate.y;
if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
{
InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
OutputObj, InputObj, &CombinedRect, &InputToCombinedRect, ColorTranslation, iTransColor);
}
break;
}
case DC_COMPLEX:
{
ULONG Direction, i;
RECT_ENUM RectEnum;
BOOL EnumMore;
return Ret; if (OutputObj == InputObj)
{
if (OutputRect.top < InputRect.top)
{
Direction = OutputRect.left < (InputRect.left ? CD_RIGHTDOWN : CD_LEFTDOWN);
}
else
{
Direction = OutputRect.left < (InputRect.left ? CD_RIGHTUP : CD_LEFTUP);
}
}
else
{
Direction = CD_ANY;
}
CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, Direction, 0);
do
{
EnumMore = CLIPOBJ_bEnum(Clip, sizeof(RectEnum), (PVOID)&RectEnum);
for (i = 0; i < RectEnum.c; i++)
{
RECTL ClipRect, CombinedRect;
RECTL InputToCombinedRect;
ClipRect.left = RectEnum.arcl[i].left + Translate.x;
ClipRect.right = RectEnum.arcl[i].right + Translate.x;
ClipRect.top = RectEnum.arcl[i].top + Translate.y;
ClipRect.bottom = RectEnum.arcl[i].bottom + Translate.y;
if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
{
InputToCombinedRect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.bottom = InputRect.top + (CombinedRect.bottom - OutputRect.top) * SrcHeight / DstHeight;
InputToCombinedRect.left = InputRect.left + (CombinedRect.left - OutputRect.left) * SrcWidth / DstWidth;
InputToCombinedRect.right = InputRect.left + (CombinedRect.right - OutputRect.left) * SrcWidth / DstWidth;
Ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_TransparentBlt(
OutputObj, InputObj, &CombinedRect, &InputToCombinedRect, ColorTranslation, iTransColor);
if (!Ret)
{
break;
}
}
}
}
while (EnumMore && Ret);
break;
}
default:
{
Ret = FALSE;
break;
}
}
IntEngLeave(&EnterLeaveDest);
IntEngLeave(&EnterLeaveSource);
return Ret;
} }
BOOL FASTCALL BOOL
IntEngTransparentBlt(SURFOBJ *psoDest, FASTCALL
SURFOBJ *psoSource, IntEngTransparentBlt(
CLIPOBJ *Clip, SURFOBJ *psoDest,
XLATEOBJ *ColorTranslation, SURFOBJ *psoSource,
PRECTL DestRect, CLIPOBJ *Clip,
PRECTL SourceRect, XLATEOBJ *ColorTranslation,
ULONG iTransColor, PRECTL DestRect,
ULONG Reserved) PRECTL SourceRect,
ULONG iTransColor,
ULONG Reserved)
{ {
BOOL Ret; BOOL Ret;
RECTL OutputRect, InputClippedRect; RECTL OutputRect, InputClippedRect;
SURFACE *psurfDest; SURFACE *psurfDest;
SURFACE *psurfSource; SURFACE *psurfSource;
RECTL InputRect; RECTL InputRect;
LONG InputClWidth, InputClHeight, InputWidth, InputHeight; LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
ASSERT(psoDest); ASSERT(psoDest);
ASSERT(psoSource); ASSERT(psoSource);
ASSERT(DestRect); ASSERT(DestRect);
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj); psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
ASSERT(psurfDest); ASSERT(psurfDest);
ASSERT(psurfSource); ASSERT(psurfSource);
/* If no clip object is given, use trivial one */ /* If no clip object is given, use trivial one */
if (!Clip) Clip = &gxcoTrivial.ClipObj; if (!Clip) Clip = &gxcoTrivial.ClipObj;
InputClippedRect = *DestRect; InputClippedRect = *DestRect;
if(InputClippedRect.right < InputClippedRect.left) if (InputClippedRect.right < InputClippedRect.left)
{
InputClippedRect.left = DestRect->right;
InputClippedRect.right = DestRect->left;
}
if(InputClippedRect.bottom < InputClippedRect.top)
{
InputClippedRect.top = DestRect->bottom;
InputClippedRect.bottom = DestRect->top;
}
InputRect = *SourceRect;
/* Clip against the bounds of the clipping region so we won't try to write
* outside the surface */
if (Clip->iDComplexity != DC_TRIVIAL)
{
if(!RECTL_bIntersectRect(&OutputRect, &InputClippedRect, &Clip->rclBounds))
{ {
return TRUE; InputClippedRect.left = DestRect->right;
InputClippedRect.right = DestRect->left;
}
if (InputClippedRect.bottom < InputClippedRect.top)
{
InputClippedRect.top = DestRect->bottom;
InputClippedRect.bottom = DestRect->top;
} }
/* Update source rect */
InputClWidth = InputClippedRect.right - InputClippedRect.left;
InputClHeight = InputClippedRect.bottom - InputClippedRect.top;
InputWidth = InputRect.right - InputRect.left;
InputHeight = InputRect.bottom - InputRect.top;
InputRect.left += (InputWidth * (OutputRect.left - InputClippedRect.left)) / InputClWidth; InputRect = *SourceRect;
InputRect.right -= (InputWidth * (InputClippedRect.right - OutputRect.right)) / InputClWidth; /* Clip against the bounds of the clipping region so we won't try to write
InputRect.top += (InputHeight * (OutputRect.top - InputClippedRect.top)) / InputClHeight; * outside the surface */
InputRect.bottom -= (InputHeight * (InputClippedRect.bottom - OutputRect.bottom)) / InputClHeight; if (Clip->iDComplexity != DC_TRIVIAL)
} {
else if (!RECTL_bIntersectRect(&OutputRect, &InputClippedRect, &Clip->rclBounds))
{ {
OutputRect = InputClippedRect; return TRUE;
} }
/* Update source rect */
InputClWidth = InputClippedRect.right - InputClippedRect.left;
InputClHeight = InputClippedRect.bottom - InputClippedRect.top;
InputWidth = InputRect.right - InputRect.left;
InputHeight = InputRect.bottom - InputRect.top;
if(psurfDest->flags & HOOK_TRANSPARENTBLT) InputRect.left += (InputWidth * (OutputRect.left - InputClippedRect.left)) / InputClWidth;
{ InputRect.right -= (InputWidth * (InputClippedRect.right - OutputRect.right)) / InputClWidth;
Ret = GDIDEVFUNCS(psoDest).TransparentBlt( InputRect.top += (InputHeight * (OutputRect.top - InputClippedRect.top)) / InputClHeight;
psoDest, psoSource, Clip, ColorTranslation, &OutputRect, InputRect.bottom -= (InputHeight * (InputClippedRect.bottom - OutputRect.bottom)) / InputClHeight;
&InputRect, iTransColor, Reserved); }
} else
else {
Ret = FALSE; OutputRect = InputClippedRect;
}
if(!Ret) if (psurfDest->flags & HOOK_TRANSPARENTBLT)
{ {
Ret = EngTransparentBlt(psoDest, psoSource, Clip, ColorTranslation, Ret = GDIDEVFUNCS(psoDest).TransparentBlt(psoDest,
&OutputRect, &InputRect, iTransColor, Reserved); psoSource,
} Clip,
ColorTranslation,
&OutputRect,
&InputRect,
iTransColor,
Reserved);
}
else
Ret = FALSE;
return Ret; if (!Ret)
{
Ret = EngTransparentBlt(psoDest,
psoSource,
Clip,
ColorTranslation,
&OutputRect,
&InputRect,
iTransColor,
Reserved);
}
return Ret;
} }
/* EOF */ /* EOF */