mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
[FORMATTING]
Fix indentation, no code change svn path=/trunk/; revision=63090
This commit is contained in:
parent
779f0311f1
commit
a45e440cac
7 changed files with 1138 additions and 1069 deletions
|
@ -38,7 +38,8 @@ const LONG LINC[2] = {-1, 1};
|
|||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
BOOL FASTCALL
|
||||
BOOL
|
||||
FASTCALL
|
||||
IntEngGradientFillRect(
|
||||
IN SURFOBJ *psoDest,
|
||||
IN CLIPOBJ *pco,
|
||||
|
@ -50,129 +51,137 @@ IntEngGradientFillRect(
|
|||
IN POINTL *pptlDitherOrg,
|
||||
IN BOOL Horizontal)
|
||||
{
|
||||
SURFOBJ *psoOutput;
|
||||
TRIVERTEX *v1, *v2;
|
||||
RECTL rcGradient, rcSG;
|
||||
RECT_ENUM RectEnum;
|
||||
BOOL EnumMore;
|
||||
ULONG i;
|
||||
POINTL Translate;
|
||||
INTENG_ENTER_LEAVE EnterLeave;
|
||||
LONG y, dy, c[3], dc[3], ec[3], ic[3];
|
||||
SURFOBJ *psoOutput;
|
||||
TRIVERTEX *v1, *v2;
|
||||
RECTL rcGradient, rcSG;
|
||||
RECT_ENUM RectEnum;
|
||||
BOOL EnumMore;
|
||||
ULONG i;
|
||||
POINTL Translate;
|
||||
INTENG_ENTER_LEAVE EnterLeave;
|
||||
LONG y, dy, c[3], dc[3], ec[3], ic[3];
|
||||
|
||||
v1 = (pVertex + gRect->UpperLeft);
|
||||
v2 = (pVertex + gRect->LowerRight);
|
||||
v1 = (pVertex + gRect->UpperLeft);
|
||||
v2 = (pVertex + gRect->LowerRight);
|
||||
|
||||
rcGradient.left = min(v1->x, v2->x);
|
||||
rcGradient.right = max(v1->x, v2->x);
|
||||
rcGradient.top = min(v1->y, v2->y);
|
||||
rcGradient.bottom = max(v1->y, v2->y);
|
||||
rcSG = rcGradient;
|
||||
RECTL_vOffsetRect(&rcSG, pptlDitherOrg->x, pptlDitherOrg->y);
|
||||
rcGradient.left = min(v1->x, v2->x);
|
||||
rcGradient.right = max(v1->x, v2->x);
|
||||
rcGradient.top = min(v1->y, v2->y);
|
||||
rcGradient.bottom = max(v1->y, v2->y);
|
||||
rcSG = rcGradient;
|
||||
RECTL_vOffsetRect(&rcSG, pptlDitherOrg->x, pptlDitherOrg->y);
|
||||
|
||||
if(Horizontal)
|
||||
{
|
||||
dy = abs(rcGradient.right - rcGradient.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
dy = abs(rcGradient.bottom - rcGradient.top);
|
||||
}
|
||||
if(Horizontal)
|
||||
{
|
||||
dy = abs(rcGradient.right - rcGradient.left);
|
||||
}
|
||||
else
|
||||
{
|
||||
dy = abs(rcGradient.bottom - rcGradient.top);
|
||||
}
|
||||
|
||||
if(!IntEngEnter(&EnterLeave, psoDest, &rcSG, FALSE, &Translate, &psoOutput))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!IntEngEnter(&EnterLeave, psoDest, &rcSG, FALSE, &Translate, &psoOutput))
|
||||
{
|
||||
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);
|
||||
do
|
||||
{
|
||||
RECTL FillRect;
|
||||
ULONG Color;
|
||||
RECTL FillRect;
|
||||
ULONG Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red, v1->Green, v1->Blue));
|
||||
|
||||
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 (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
while (EnumMore);
|
||||
|
||||
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 */
|
||||
|
@ -181,6 +190,7 @@ IntEngGradientFillRect(
|
|||
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[lineto], FillRect.left), min(sx[linefrom], FillRect.right), sy, Color); \
|
||||
else \
|
||||
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_HLine(psoOutput, max(sx[linefrom], FillRect.left), min(sx[lineto], FillRect.right), sy, Color);
|
||||
|
||||
#define S_DOLINE(a,b,line) \
|
||||
ex[line] += dx[line]; \
|
||||
while(ex[line] > 0 && x[line] != destx[line]) \
|
||||
|
@ -189,11 +199,14 @@ IntEngGradientFillRect(
|
|||
sx[line] += incx[line]; \
|
||||
ex[line] -= dy[line]; \
|
||||
}
|
||||
|
||||
#define S_GOLINE(a,b,line) \
|
||||
if(y >= a->y && y <= b->y) \
|
||||
{
|
||||
|
||||
#define S_ENDLINE(a,b,line) \
|
||||
}
|
||||
|
||||
#define S_INITLINE(a,b,line) \
|
||||
x[line] = a->x; \
|
||||
sx[line] = a->x + pptlDitherOrg->x; \
|
||||
|
@ -209,6 +222,7 @@ IntEngGradientFillRect(
|
|||
dc[line][id] = abs((b->col >> 8) - c[line][id]); \
|
||||
ec[line][id] = -(dy[line]>>1); \
|
||||
ic[line][id] = LINC[(b->col >> 8) > c[line][id]]
|
||||
|
||||
#define STEPCOL(a,b,line,col,id) \
|
||||
ec[line][id] += dc[line][id]; \
|
||||
while(ec[line][id] > 0) \
|
||||
|
@ -216,11 +230,13 @@ IntEngGradientFillRect(
|
|||
c[line][id] += ic[line][id]; \
|
||||
ec[line][id] -= dy[line]; \
|
||||
}
|
||||
|
||||
#define FINITCOL(linefrom,lineto,colid) \
|
||||
gc[colid] = c[linefrom][colid]; \
|
||||
gd[colid] = abs(c[lineto][colid] - gc[colid]); \
|
||||
ge[colid] = -(gx >> 1); \
|
||||
gi[colid] = LINC[c[lineto][colid] > gc[colid]]
|
||||
|
||||
#define FDOCOL(linefrom,lineto,colid) \
|
||||
ge[colid] += gd[colid]; \
|
||||
while(ge[colid] > 0) \
|
||||
|
@ -228,6 +244,7 @@ IntEngGradientFillRect(
|
|||
gc[colid] += gi[colid]; \
|
||||
ge[colid] -= gx; \
|
||||
}
|
||||
|
||||
#define FILLLINE(linefrom,lineto) \
|
||||
gx = abs(sx[lineto] - sx[linefrom]); \
|
||||
gxi = LINC[sx[linefrom] < sx[lineto]]; \
|
||||
|
@ -245,6 +262,7 @@ IntEngGradientFillRect(
|
|||
FDOCOL(linefrom, lineto, 1); \
|
||||
FDOCOL(linefrom, lineto, 2); \
|
||||
}
|
||||
|
||||
#define DOLINE(a,b,line) \
|
||||
STEPCOL(a, b, line, Red, 0); \
|
||||
STEPCOL(a, b, line, Green, 1); \
|
||||
|
@ -256,11 +274,14 @@ IntEngGradientFillRect(
|
|||
sx[line] += incx[line]; \
|
||||
ex[line] -= dy[line]; \
|
||||
}
|
||||
|
||||
#define GOLINE(a,b,line) \
|
||||
if(y >= a->y && y <= b->y) \
|
||||
{
|
||||
|
||||
#define ENDLINE(a,b,line) \
|
||||
}
|
||||
|
||||
#define INITLINE(a,b,line) \
|
||||
x[line] = a->x; \
|
||||
sx[line] = a->x + pptlDitherOrg->x; \
|
||||
|
@ -269,17 +290,23 @@ IntEngGradientFillRect(
|
|||
incx[line] = LINC[b->x > a->x]; \
|
||||
ex[line] = -(dy[line]>>1); \
|
||||
destx[line] = b->x
|
||||
|
||||
#define DOINIT(a, b, line) \
|
||||
INITLINE(a, b, line); \
|
||||
INITCOL(a, b, line, Red, 0); \
|
||||
INITCOL(a, b, line, Green, 1); \
|
||||
INITCOL(a, b, line, Blue, 2);
|
||||
|
||||
#define SMALLER(a,b) (a->y < b->y) || (a->y == b->y && a->x < b->x)
|
||||
|
||||
#define SWAP(a,b,c) c = a;\
|
||||
a = b;\
|
||||
b = c
|
||||
|
||||
#define NLINES 3
|
||||
BOOL FASTCALL
|
||||
|
||||
BOOL
|
||||
FASTCALL
|
||||
IntEngGradientFillTriangle(
|
||||
IN SURFOBJ *psoDest,
|
||||
IN CLIPOBJ *pco,
|
||||
|
@ -290,158 +317,161 @@ IntEngGradientFillTriangle(
|
|||
IN RECTL *prclExtents,
|
||||
IN POINTL *pptlDitherOrg)
|
||||
{
|
||||
SURFOBJ *psoOutput;
|
||||
PTRIVERTEX v1, v2, v3;
|
||||
//RECT_ENUM RectEnum;
|
||||
//BOOL EnumMore;
|
||||
//ULONG i;
|
||||
POINTL Translate;
|
||||
INTENG_ENTER_LEAVE EnterLeave;
|
||||
RECTL FillRect = { 0, 0, 0, 0 };
|
||||
//ULONG Color;
|
||||
SURFOBJ *psoOutput;
|
||||
PTRIVERTEX v1, v2, v3;
|
||||
//RECT_ENUM RectEnum;
|
||||
//BOOL EnumMore;
|
||||
//ULONG i;
|
||||
POINTL Translate;
|
||||
INTENG_ENTER_LEAVE EnterLeave;
|
||||
RECTL FillRect = { 0, 0, 0, 0 };
|
||||
//ULONG Color;
|
||||
|
||||
//BOOL sx[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 g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
|
||||
//LONG sy, y, bt;
|
||||
//BOOL sx[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 g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
|
||||
//LONG sy, y, bt;
|
||||
|
||||
v1 = (pVertex + gTriangle->Vertex1);
|
||||
v2 = (pVertex + gTriangle->Vertex2);
|
||||
v3 = (pVertex + gTriangle->Vertex3);
|
||||
v1 = (pVertex + gTriangle->Vertex1);
|
||||
v2 = (pVertex + gTriangle->Vertex2);
|
||||
v3 = (pVertex + gTriangle->Vertex3);
|
||||
|
||||
/* bubble sort */
|
||||
if(SMALLER(v2,v1))
|
||||
{
|
||||
TRIVERTEX *t;
|
||||
SWAP(v1,v2,t);
|
||||
}
|
||||
if(SMALLER(v3,v2))
|
||||
{
|
||||
TRIVERTEX *t;
|
||||
SWAP(v2,v3,t);
|
||||
if(SMALLER(v2,v1))
|
||||
/* bubble sort */
|
||||
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);
|
||||
/* FIXME: commented out because of an endless loop - fix triangles first */
|
||||
DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n");
|
||||
if (SMALLER(v3, v2))
|
||||
{
|
||||
TRIVERTEX *t;
|
||||
SWAP(v2, v3, t);
|
||||
if (SMALLER(v2, v1))
|
||||
{
|
||||
SWAP(v1, v2, t);
|
||||
}
|
||||
}
|
||||
|
||||
if(!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
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 */
|
||||
DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n");
|
||||
|
||||
//if(VCMPCLRS(v1, v2, v3))
|
||||
//{
|
||||
// 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;
|
||||
if (!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// DOINIT(v1, v3, 0);
|
||||
// DOINIT(v1, v2, 1);
|
||||
// DOINIT(v2, v3, 2);
|
||||
//if (VCMPCLRS(v1, v2, v3))
|
||||
//{
|
||||
// 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;
|
||||
// sy = v1->y + pptlDitherOrg->y;
|
||||
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
|
||||
// DOINIT(v1, v3, 0);
|
||||
// DOINIT(v1, v2, 1);
|
||||
// DOINIT(v2, v3, 2);
|
||||
|
||||
// while(sy < bt)
|
||||
// {
|
||||
// InY = !(sy < FillRect.top || sy >= FillRect.bottom);
|
||||
// GOLINE(v1, v3, 0);
|
||||
// DOLINE(v1, v3, 0);
|
||||
// ENDLINE(v1, v3, 0);
|
||||
// y = v1->y;
|
||||
// sy = v1->y + pptlDitherOrg->y;
|
||||
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
|
||||
|
||||
// GOLINE(v1, v2, 1);
|
||||
// DOLINE(v1, v2, 1);
|
||||
// FILLLINE(0, 1);
|
||||
// ENDLINE(v1, v2, 1);
|
||||
// while (sy < bt)
|
||||
// {
|
||||
// InY = !(sy < FillRect.top || sy >= FillRect.bottom);
|
||||
// GOLINE(v1, v3, 0);
|
||||
// DOLINE(v1, v3, 0);
|
||||
// ENDLINE(v1, v3, 0);
|
||||
|
||||
// GOLINE(v2, v3, 2);
|
||||
// DOLINE(v2, v3, 2);
|
||||
// FILLLINE(0, 2);
|
||||
// ENDLINE(23, v3, 2);
|
||||
// GOLINE(v1, v2, 1);
|
||||
// DOLINE(v1, v2, 1);
|
||||
// FILLLINE(0, 1);
|
||||
// ENDLINE(v1, v2, 1);
|
||||
|
||||
// y++;
|
||||
// sy++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } while(EnumMore);
|
||||
// GOLINE(v2, v3, 2);
|
||||
// DOLINE(v2, v3, 2);
|
||||
// FILLLINE(0, 2);
|
||||
// ENDLINE(23, v3, 2);
|
||||
|
||||
// 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));
|
||||
//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);
|
||||
///* fill triangle with one solid color */
|
||||
|
||||
// y = v1->y;
|
||||
// sy = v1->y + pptlDitherOrg->y;
|
||||
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
|
||||
//Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
|
||||
//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);
|
||||
|
||||
// while(sy < bt)
|
||||
// {
|
||||
// S_GOLINE(v1, v3, 0);
|
||||
// S_DOLINE(v1, v3, 0);
|
||||
// S_ENDLINE(v1, v3, 0);
|
||||
// y = v1->y;
|
||||
// sy = v1->y + pptlDitherOrg->y;
|
||||
// bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
|
||||
|
||||
// S_GOLINE(v1, v2, 1);
|
||||
// S_DOLINE(v1, v2, 1);
|
||||
// S_FILLLINE(0, 1);
|
||||
// S_ENDLINE(v1, v2, 1);
|
||||
// while (sy < bt)
|
||||
// {
|
||||
// S_GOLINE(v1, v3, 0);
|
||||
// S_DOLINE(v1, v3, 0);
|
||||
// S_ENDLINE(v1, v3, 0);
|
||||
|
||||
// S_GOLINE(v2, v3, 2);
|
||||
// S_DOLINE(v2, v3, 2);
|
||||
// S_FILLLINE(0, 2);
|
||||
// S_ENDLINE(23, v3, 2);
|
||||
// S_GOLINE(v1, v2, 1);
|
||||
// S_DOLINE(v1, v2, 1);
|
||||
// S_FILLLINE(0, 1);
|
||||
// S_ENDLINE(v1, v2, 1);
|
||||
|
||||
// y++;
|
||||
// sy++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//} while(EnumMore);
|
||||
// S_GOLINE(v2, v3, 2);
|
||||
// S_DOLINE(v2, v3, 2);
|
||||
// S_FILLLINE(0, 2);
|
||||
// S_ENDLINE(23, v3, 2);
|
||||
|
||||
return IntEngLeave(&EnterLeave);
|
||||
// y++;
|
||||
// sy++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//} while (EnumMore);
|
||||
|
||||
return IntEngLeave(&EnterLeave);
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
static
|
||||
BOOL
|
||||
IntEngIsNULLTriangle(TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt)
|
||||
{
|
||||
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))
|
||||
return TRUE;
|
||||
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3)))
|
||||
return TRUE;
|
||||
if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))
|
||||
return TRUE;
|
||||
if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3)))
|
||||
return TRUE;
|
||||
if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL APIENTRY
|
||||
BOOL
|
||||
APIENTRY
|
||||
EngGradientFill(
|
||||
_Inout_ SURFOBJ *psoDest,
|
||||
_In_ CLIPOBJ *pco,
|
||||
|
@ -454,90 +484,119 @@ EngGradientFill(
|
|||
_In_ POINTL *pptlDitherOrg,
|
||||
_In_ ULONG ulMode)
|
||||
{
|
||||
ULONG i;
|
||||
BOOL ret = FALSE;
|
||||
ULONG i;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!pco)
|
||||
{
|
||||
pco = IntEngCreateClipRegion(0, 0, prclExtents);
|
||||
if (!pco)
|
||||
{
|
||||
return FALSE;
|
||||
pco = IntEngCreateClipRegion(0, 0, prclExtents);
|
||||
if (!pco)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(ulMode)
|
||||
{
|
||||
case GRADIENT_FILL_RECT_H:
|
||||
case GRADIENT_FILL_RECT_V:
|
||||
switch(ulMode)
|
||||
{
|
||||
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)))
|
||||
case GRADIENT_FILL_RECT_H:
|
||||
case GRADIENT_FILL_RECT_V:
|
||||
{
|
||||
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(
|
||||
IN SURFOBJ *psoDest,
|
||||
IN CLIPOBJ *pco,
|
||||
IN XLATEOBJ *pxlo,
|
||||
IN TRIVERTEX *pVertex,
|
||||
IN ULONG nVertex,
|
||||
IN PVOID pMesh,
|
||||
IN ULONG nMesh,
|
||||
IN RECTL *prclExtents,
|
||||
IN POINTL *pptlDitherOrg,
|
||||
IN ULONG ulMode)
|
||||
IN SURFOBJ *psoDest,
|
||||
IN CLIPOBJ *pco,
|
||||
IN XLATEOBJ *pxlo,
|
||||
IN TRIVERTEX *pVertex,
|
||||
IN ULONG nVertex,
|
||||
IN PVOID pMesh,
|
||||
IN ULONG nMesh,
|
||||
IN RECTL *prclExtents,
|
||||
IN POINTL *pptlDitherOrg,
|
||||
IN ULONG ulMode)
|
||||
{
|
||||
BOOL Ret;
|
||||
SURFACE *psurf;
|
||||
ASSERT(psoDest);
|
||||
BOOL Ret;
|
||||
SURFACE *psurf;
|
||||
ASSERT(psoDest);
|
||||
|
||||
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||
ASSERT(psurf);
|
||||
psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||
ASSERT(psurf);
|
||||
|
||||
if(psurf->flags & HOOK_GRADIENTFILL)
|
||||
{
|
||||
Ret = GDIDEVFUNCS(psoDest).GradientFill(
|
||||
psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
|
||||
prclExtents, pptlDitherOrg, ulMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ret = EngGradientFill(psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh, prclExtents,
|
||||
pptlDitherOrg, ulMode);
|
||||
}
|
||||
if (psurf->flags & HOOK_GRADIENTFILL)
|
||||
{
|
||||
Ret = GDIDEVFUNCS(psoDest).GradientFill(psoDest,
|
||||
pco,
|
||||
pxlo,
|
||||
pVertex,
|
||||
nVertex,
|
||||
pMesh,
|
||||
nMesh,
|
||||
prclExtents,
|
||||
pptlDitherOrg,
|
||||
ulMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ret = EngGradientFill(psoDest,
|
||||
pco,
|
||||
pxlo,
|
||||
pVertex,
|
||||
nVertex,
|
||||
pMesh,
|
||||
nMesh,
|
||||
prclExtents,
|
||||
pptlDitherOrg,
|
||||
ulMode);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
return Ret;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: GDI Driver Performance Counter Functions
|
||||
|
@ -17,10 +17,10 @@
|
|||
VOID APIENTRY
|
||||
EngQueryPerformanceFrequency(LONGLONG *Frequency)
|
||||
{
|
||||
LARGE_INTEGER Freq;
|
||||
LARGE_INTEGER Freq;
|
||||
|
||||
KeQueryPerformanceCounter(&Freq);
|
||||
*Frequency = Freq.QuadPart;
|
||||
KeQueryPerformanceCounter(&Freq);
|
||||
*Frequency = Freq.QuadPart;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -29,8 +29,8 @@ EngQueryPerformanceFrequency(LONGLONG *Frequency)
|
|||
VOID APIENTRY
|
||||
EngQueryPerformanceCounter(LONGLONG *Count)
|
||||
{
|
||||
LARGE_INTEGER PerfCount;
|
||||
LARGE_INTEGER PerfCount;
|
||||
|
||||
PerfCount = KeQueryPerformanceCounter(NULL);
|
||||
*Count = PerfCount.QuadPart;
|
||||
PerfCount = KeQueryPerformanceCounter(NULL);
|
||||
*Count = PerfCount.QuadPart;
|
||||
}
|
||||
|
|
|
@ -8,26 +8,28 @@
|
|||
*/
|
||||
HSEMAPHORE
|
||||
APIENTRY
|
||||
EngCreateSemaphore ( VOID )
|
||||
EngCreateSemaphore(VOID)
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_95lz.htm
|
||||
PERESOURCE psem = ExAllocatePoolWithTag( NonPagedPool, sizeof(ERESOURCE), GDITAG_SEMAPHORE );
|
||||
if ( !psem )
|
||||
return NULL;
|
||||
if ( !NT_SUCCESS(ExInitializeResourceLite ( psem )) )
|
||||
{
|
||||
ExFreePoolWithTag ( psem, GDITAG_SEMAPHORE );
|
||||
return NULL;
|
||||
}
|
||||
return (HSEMAPHORE)psem;
|
||||
// www.osr.com/ddk/graphics/gdifncs_95lz.htm
|
||||
PERESOURCE psem = ExAllocatePoolWithTag(NonPagedPool, sizeof(ERESOURCE), GDITAG_SEMAPHORE);
|
||||
if (!psem)
|
||||
return NULL;
|
||||
|
||||
if (!NT_SUCCESS(ExInitializeResourceLite(psem)))
|
||||
{
|
||||
ExFreePoolWithTag ( psem, GDITAG_SEMAPHORE );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (HSEMAPHORE)psem;
|
||||
}
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
IntGdiAcquireSemaphore ( HSEMAPHORE hsem )
|
||||
IntGdiAcquireSemaphore(HSEMAPHORE hsem)
|
||||
{
|
||||
KeEnterCriticalRegion();
|
||||
ExAcquireResourceExclusiveLite ( (PERESOURCE)hsem, TRUE );
|
||||
KeEnterCriticalRegion();
|
||||
ExAcquireResourceExclusiveLite ((PERESOURCE)hsem, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -35,14 +37,14 @@ IntGdiAcquireSemaphore ( HSEMAPHORE hsem )
|
|||
*/
|
||||
VOID
|
||||
APIENTRY
|
||||
EngAcquireSemaphore ( IN HSEMAPHORE hsem )
|
||||
EngAcquireSemaphore(IN HSEMAPHORE hsem)
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_14br.htm
|
||||
PTHREADINFO W32Thread;
|
||||
ASSERT(hsem);
|
||||
IntGdiAcquireSemaphore ( hsem );
|
||||
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
|
||||
if (W32Thread) W32Thread->dwEngAcquireCount++;
|
||||
// www.osr.com/ddk/graphics/gdifncs_14br.htm
|
||||
PTHREADINFO W32Thread;
|
||||
ASSERT(hsem);
|
||||
IntGdiAcquireSemaphore(hsem);
|
||||
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
|
||||
if (W32Thread) W32Thread->dwEngAcquireCount++;
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,8 +52,8 @@ VOID
|
|||
FASTCALL
|
||||
IntGdiReleaseSemaphore ( HSEMAPHORE hsem )
|
||||
{
|
||||
ExReleaseResourceLite ( (PERESOURCE)hsem );
|
||||
KeLeaveCriticalRegion();
|
||||
ExReleaseResourceLite((PERESOURCE)hsem);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -61,12 +63,12 @@ VOID
|
|||
APIENTRY
|
||||
EngReleaseSemaphore ( IN HSEMAPHORE hsem )
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_5u3r.htm
|
||||
PTHREADINFO W32Thread;
|
||||
ASSERT(hsem);
|
||||
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
|
||||
if (W32Thread) --W32Thread->dwEngAcquireCount;
|
||||
IntGdiReleaseSemaphore ( hsem );
|
||||
// www.osr.com/ddk/graphics/gdifncs_5u3r.htm
|
||||
PTHREADINFO W32Thread;
|
||||
ASSERT(hsem);
|
||||
W32Thread = PsGetThreadWin32Thread(PsGetCurrentThread());
|
||||
if (W32Thread) --W32Thread->dwEngAcquireCount;
|
||||
IntGdiReleaseSemaphore(hsem);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -89,12 +91,11 @@ VOID
|
|||
APIENTRY
|
||||
EngDeleteSemaphore ( IN HSEMAPHORE hsem )
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_13c7.htm
|
||||
ASSERT ( hsem );
|
||||
// www.osr.com/ddk/graphics/gdifncs_13c7.htm
|
||||
ASSERT(hsem);
|
||||
|
||||
ExDeleteResourceLite((PERESOURCE)hsem);
|
||||
|
||||
ExFreePoolWithTag( (PVOID)hsem, GDITAG_SEMAPHORE);
|
||||
ExDeleteResourceLite((PERESOURCE)hsem);
|
||||
ExFreePoolWithTag((PVOID)hsem, GDITAG_SEMAPHORE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -104,9 +105,9 @@ BOOL
|
|||
APIENTRY
|
||||
EngIsSemaphoreOwned ( IN HSEMAPHORE hsem )
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_6wmf.htm
|
||||
ASSERT(hsem);
|
||||
return (((PERESOURCE)hsem)->ActiveCount > 0);
|
||||
// www.osr.com/ddk/graphics/gdifncs_6wmf.htm
|
||||
ASSERT(hsem);
|
||||
return (((PERESOURCE)hsem)->ActiveCount > 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -116,9 +117,9 @@ BOOL
|
|||
APIENTRY
|
||||
EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem )
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_9yxz.htm
|
||||
ASSERT(hsem);
|
||||
return ExIsResourceAcquiredExclusiveLite ( (PERESOURCE)hsem );
|
||||
// www.osr.com/ddk/graphics/gdifncs_9yxz.htm
|
||||
ASSERT(hsem);
|
||||
return ExIsResourceAcquiredExclusiveLite((PERESOURCE)hsem);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -126,32 +127,32 @@ EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem )
|
|||
*/
|
||||
BOOL APIENTRY
|
||||
EngInitializeSafeSemaphore(
|
||||
OUT ENGSAFESEMAPHORE *Semaphore)
|
||||
OUT ENGSAFESEMAPHORE *Semaphore)
|
||||
{
|
||||
HSEMAPHORE hSem;
|
||||
HSEMAPHORE hSem;
|
||||
|
||||
if (InterlockedIncrement(&Semaphore->lCount) == 1)
|
||||
{
|
||||
/* Create the semaphore */
|
||||
hSem = EngCreateSemaphore();
|
||||
if (hSem == 0)
|
||||
{
|
||||
InterlockedDecrement(&Semaphore->lCount);
|
||||
return FALSE;
|
||||
}
|
||||
/* FIXME: Not thread-safe! Check result of InterlockedCompareExchangePointer
|
||||
and delete semaphore if already initialized! */
|
||||
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, hSem);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wait for the other thread to create the semaphore */
|
||||
ASSERT(Semaphore->lCount > 1);
|
||||
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
|
||||
while (Semaphore->hsem == NULL);
|
||||
}
|
||||
if (InterlockedIncrement(&Semaphore->lCount) == 1)
|
||||
{
|
||||
/* Create the semaphore */
|
||||
hSem = EngCreateSemaphore();
|
||||
if (hSem == 0)
|
||||
{
|
||||
InterlockedDecrement(&Semaphore->lCount);
|
||||
return FALSE;
|
||||
}
|
||||
/* FIXME: Not thread-safe! Check result of InterlockedCompareExchangePointer
|
||||
and delete semaphore if already initialized! */
|
||||
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, hSem);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wait for the other thread to create the semaphore */
|
||||
ASSERT(Semaphore->lCount > 1);
|
||||
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
|
||||
while (Semaphore->hsem == NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -159,14 +160,14 @@ EngInitializeSafeSemaphore(
|
|||
*/
|
||||
VOID APIENTRY
|
||||
EngDeleteSafeSemaphore(
|
||||
IN OUT ENGSAFESEMAPHORE *Semaphore)
|
||||
IN OUT ENGSAFESEMAPHORE *Semaphore)
|
||||
{
|
||||
if (InterlockedDecrement(&Semaphore->lCount) == 0)
|
||||
{
|
||||
/* FIXME: Not thread-safe! Use result of InterlockedCompareExchangePointer! */
|
||||
EngDeleteSemaphore(Semaphore->hsem);
|
||||
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, NULL);
|
||||
}
|
||||
if (InterlockedDecrement(&Semaphore->lCount) == 0)
|
||||
{
|
||||
/* FIXME: Not thread-safe! Use result of InterlockedCompareExchangePointer! */
|
||||
EngDeleteSemaphore(Semaphore->hsem);
|
||||
(void)InterlockedExchangePointer((volatile PVOID *)&Semaphore->hsem, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS win32 subsystem
|
||||
* PURPOSE:
|
||||
* PURPOSE:
|
||||
* FILE: subsystems/win32k/eng/sort.c
|
||||
* PROGRAMER: ReactOS Team
|
||||
*/
|
||||
|
@ -14,10 +14,11 @@
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void APIENTRY
|
||||
void
|
||||
APIENTRY
|
||||
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 */
|
||||
|
|
|
@ -8,82 +8,87 @@
|
|||
BOOL
|
||||
APIENTRY
|
||||
STROBJ_bEnum(
|
||||
IN STROBJ *pstro,
|
||||
OUT ULONG *pc,
|
||||
OUT PGLYPHPOS *ppgpos
|
||||
)
|
||||
IN STROBJ *pstro,
|
||||
OUT ULONG *pc,
|
||||
OUT PGLYPHPOS *ppgpos)
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_65uv.htm
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
// www.osr.com/ddk/graphics/gdifncs_65uv.htm
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD
|
||||
APIENTRY
|
||||
STROBJ_dwGetCodePage ( IN STROBJ *pstro )
|
||||
STROBJ_dwGetCodePage(
|
||||
IN STROBJ *pstro)
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_9jmv.htm
|
||||
PSTRGDI pStrGdi = (PSTRGDI) pstro;
|
||||
return pStrGdi->dwCodePage;
|
||||
// www.osr.com/ddk/graphics/gdifncs_9jmv.htm
|
||||
PSTRGDI pStrGdi = (PSTRGDI) pstro;
|
||||
return pStrGdi->dwCodePage;
|
||||
}
|
||||
|
||||
VOID
|
||||
APIENTRY
|
||||
STROBJ_vEnumStart ( IN STROBJ *pstro )
|
||||
STROBJ_vEnumStart(
|
||||
IN STROBJ *pstro)
|
||||
{
|
||||
// www.osr.com/ddk/graphics/gdifncs_32uf.htm
|
||||
UNIMPLEMENTED;
|
||||
// www.osr.com/ddk/graphics/gdifncs_32uf.htm
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL APIENTRY
|
||||
BOOL
|
||||
APIENTRY
|
||||
STROBJ_bEnumPositionsOnly(
|
||||
IN STROBJ *StringObj,
|
||||
OUT ULONG *Count,
|
||||
OUT PGLYPHPOS *Pos)
|
||||
IN STROBJ *StringObj,
|
||||
OUT ULONG *Count,
|
||||
OUT PGLYPHPOS *Pos)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return (BOOL) DDI_ERROR;
|
||||
UNIMPLEMENTED;
|
||||
return (BOOL) DDI_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL APIENTRY
|
||||
BOOL
|
||||
APIENTRY
|
||||
STROBJ_bGetAdvanceWidths(
|
||||
IN STROBJ *StringObj,
|
||||
IN ULONG First,
|
||||
IN ULONG Count,
|
||||
OUT POINTQF *Widths)
|
||||
IN STROBJ *StringObj,
|
||||
IN ULONG First,
|
||||
IN ULONG Count,
|
||||
OUT POINTQF *Widths)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
FIX APIENTRY
|
||||
FIX
|
||||
APIENTRY
|
||||
STROBJ_fxBreakExtra(
|
||||
IN STROBJ *StringObj)
|
||||
IN STROBJ *StringObj)
|
||||
{
|
||||
PSTRGDI pStrGdi = (PSTRGDI) StringObj;
|
||||
if (pStrGdi->StrObj.flAccel & SO_BREAK_EXTRA) return pStrGdi->fxBreakExtra;
|
||||
return (FIX) 0;
|
||||
PSTRGDI pStrGdi = (PSTRGDI) StringObj;
|
||||
if (pStrGdi->StrObj.flAccel & SO_BREAK_EXTRA) return pStrGdi->fxBreakExtra;
|
||||
return (FIX) 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
FIX APIENTRY
|
||||
FIX
|
||||
APIENTRY
|
||||
STROBJ_fxCharacterExtra(
|
||||
IN STROBJ *StringObj)
|
||||
IN STROBJ *StringObj)
|
||||
{
|
||||
PSTRGDI pStrGdi = (PSTRGDI) StringObj;
|
||||
if (pStrGdi->StrObj.flAccel & SO_CHARACTER_EXTRA) return pStrGdi->fxExtra;
|
||||
return (FIX) 0;
|
||||
PSTRGDI pStrGdi = (PSTRGDI) StringObj;
|
||||
if (pStrGdi->StrObj.flAccel & SO_CHARACTER_EXTRA) return pStrGdi->fxExtra;
|
||||
return (FIX)0;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -11,277 +11,293 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
BOOL APIENTRY
|
||||
EngTransparentBlt(SURFOBJ *psoDest,
|
||||
SURFOBJ *psoSource,
|
||||
CLIPOBJ *Clip,
|
||||
XLATEOBJ *ColorTranslation,
|
||||
PRECTL DestRect,
|
||||
PRECTL SourceRect,
|
||||
ULONG iTransColor,
|
||||
ULONG Reserved)
|
||||
BOOL
|
||||
APIENTRY
|
||||
EngTransparentBlt(
|
||||
SURFOBJ *psoDest,
|
||||
SURFOBJ *psoSource,
|
||||
CLIPOBJ *Clip,
|
||||
XLATEOBJ *ColorTranslation,
|
||||
PRECTL DestRect,
|
||||
PRECTL SourceRect,
|
||||
ULONG iTransColor,
|
||||
ULONG Reserved)
|
||||
{
|
||||
BOOL Ret = TRUE;
|
||||
BYTE ClippingType;
|
||||
INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest;
|
||||
SURFOBJ *InputObj, *OutputObj;
|
||||
RECTL OutputRect, InputRect;
|
||||
POINTL Translate;
|
||||
BOOL Ret = TRUE;
|
||||
BYTE ClippingType;
|
||||
INTENG_ENTER_LEAVE EnterLeaveSource, EnterLeaveDest;
|
||||
SURFOBJ *InputObj, *OutputObj;
|
||||
RECTL OutputRect, InputRect;
|
||||
POINTL Translate;
|
||||
|
||||
LONG DstHeight;
|
||||
LONG DstWidth;
|
||||
LONG SrcHeight;
|
||||
LONG SrcWidth;
|
||||
LONG DstHeight;
|
||||
LONG DstWidth;
|
||||
LONG SrcHeight;
|
||||
LONG SrcWidth;
|
||||
|
||||
InputRect = *SourceRect;
|
||||
InputRect = *SourceRect;
|
||||
|
||||
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)
|
||||
if (!IntEngEnter(&EnterLeaveSource, psoSource, &InputRect, TRUE, &Translate, &InputObj))
|
||||
{
|
||||
InputRect.left += Clip->rclBounds.left - OutputRect.left;
|
||||
OutputRect.left = Clip->rclBounds.left;
|
||||
return FALSE;
|
||||
}
|
||||
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.right = Clip->rclBounds.right;
|
||||
OutputRect.left = DestRect->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 = Clip->rclBounds.top;
|
||||
OutputRect.top = DestRect->bottom;
|
||||
OutputRect.bottom = DestRect->top;
|
||||
}
|
||||
if(Clip->rclBounds.bottom < OutputRect.bottom)
|
||||
|
||||
if (Clip)
|
||||
{
|
||||
InputRect.bottom -= OutputRect.bottom - Clip->rclBounds.bottom;
|
||||
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)
|
||||
if (OutputRect.left < Clip->rclBounds.left)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
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++)
|
||||
if (OutputRect.top < Clip->rclBounds.top)
|
||||
{
|
||||
RECTL ClipRect, CombinedRect;
|
||||
RECTL InputToCombinedRect;
|
||||
InputRect.top += Clip->rclBounds.top - OutputRect.top;
|
||||
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;
|
||||
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;
|
||||
/* 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, &CombinedRect, &InputToCombinedRect, ColorTranslation, iTransColor);
|
||||
if(!Ret)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
OutputObj, InputObj, &OutputRect, &InputRect, ColorTranslation, iTransColor);
|
||||
break;
|
||||
}
|
||||
} while(EnumMore && Ret);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Ret = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DC_RECT:
|
||||
{
|
||||
RECTL ClipRect, CombinedRect;
|
||||
RECTL InputToCombinedRect;
|
||||
|
||||
IntEngLeave(&EnterLeaveDest);
|
||||
IntEngLeave(&EnterLeaveSource);
|
||||
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;
|
||||
|
||||
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
|
||||
IntEngTransparentBlt(SURFOBJ *psoDest,
|
||||
SURFOBJ *psoSource,
|
||||
CLIPOBJ *Clip,
|
||||
XLATEOBJ *ColorTranslation,
|
||||
PRECTL DestRect,
|
||||
PRECTL SourceRect,
|
||||
ULONG iTransColor,
|
||||
ULONG Reserved)
|
||||
BOOL
|
||||
FASTCALL
|
||||
IntEngTransparentBlt(
|
||||
SURFOBJ *psoDest,
|
||||
SURFOBJ *psoSource,
|
||||
CLIPOBJ *Clip,
|
||||
XLATEOBJ *ColorTranslation,
|
||||
PRECTL DestRect,
|
||||
PRECTL SourceRect,
|
||||
ULONG iTransColor,
|
||||
ULONG Reserved)
|
||||
{
|
||||
BOOL Ret;
|
||||
RECTL OutputRect, InputClippedRect;
|
||||
SURFACE *psurfDest;
|
||||
SURFACE *psurfSource;
|
||||
RECTL InputRect;
|
||||
LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
|
||||
BOOL Ret;
|
||||
RECTL OutputRect, InputClippedRect;
|
||||
SURFACE *psurfDest;
|
||||
SURFACE *psurfSource;
|
||||
RECTL InputRect;
|
||||
LONG InputClWidth, InputClHeight, InputWidth, InputHeight;
|
||||
|
||||
ASSERT(psoDest);
|
||||
ASSERT(psoSource);
|
||||
ASSERT(DestRect);
|
||||
ASSERT(psoDest);
|
||||
ASSERT(psoSource);
|
||||
ASSERT(DestRect);
|
||||
|
||||
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
||||
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
|
||||
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
|
||||
|
||||
ASSERT(psurfDest);
|
||||
ASSERT(psurfSource);
|
||||
ASSERT(psurfDest);
|
||||
ASSERT(psurfSource);
|
||||
|
||||
/* If no clip object is given, use trivial one */
|
||||
if (!Clip) Clip = &gxcoTrivial.ClipObj;
|
||||
/* If no clip object is given, use trivial one */
|
||||
if (!Clip) Clip = &gxcoTrivial.ClipObj;
|
||||
|
||||
InputClippedRect = *DestRect;
|
||||
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))
|
||||
InputClippedRect = *DestRect;
|
||||
if (InputClippedRect.right < InputClippedRect.left)
|
||||
{
|
||||
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.right -= (InputWidth * (InputClippedRect.right - OutputRect.right)) / InputClWidth;
|
||||
InputRect.top += (InputHeight * (OutputRect.top - InputClippedRect.top)) / InputClHeight;
|
||||
InputRect.bottom -= (InputHeight * (InputClippedRect.bottom - OutputRect.bottom)) / InputClHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputRect = InputClippedRect;
|
||||
}
|
||||
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;
|
||||
}
|
||||
/* 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)
|
||||
{
|
||||
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
|
||||
psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
|
||||
&InputRect, iTransColor, Reserved);
|
||||
}
|
||||
else
|
||||
Ret = FALSE;
|
||||
InputRect.left += (InputWidth * (OutputRect.left - InputClippedRect.left)) / InputClWidth;
|
||||
InputRect.right -= (InputWidth * (InputClippedRect.right - OutputRect.right)) / InputClWidth;
|
||||
InputRect.top += (InputHeight * (OutputRect.top - InputClippedRect.top)) / InputClHeight;
|
||||
InputRect.bottom -= (InputHeight * (InputClippedRect.bottom - OutputRect.bottom)) / InputClHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputRect = InputClippedRect;
|
||||
}
|
||||
|
||||
if(!Ret)
|
||||
{
|
||||
Ret = EngTransparentBlt(psoDest, psoSource, Clip, ColorTranslation,
|
||||
&OutputRect, &InputRect, iTransColor, Reserved);
|
||||
}
|
||||
if (psurfDest->flags & HOOK_TRANSPARENTBLT)
|
||||
{
|
||||
Ret = GDIDEVFUNCS(psoDest).TransparentBlt(psoDest,
|
||||
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 */
|
||||
|
|
Loading…
Reference in a new issue