ReactOS 0.4.15-dev-7961-gdcf9eb0
gradient.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for gradient.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define VERTEX(n)   (pVertex + gt->n)
 
#define COMPAREVERTEX(a, b)   ((a)->x == (b)->x && (a)->y == (b)->y)
 
#define VCMPCLR(a, b, c, color)   (a->color != b->color || a->color != c->color)
 
#define VCMPCLRS(a, b, c)    !(!VCMPCLR(a,b,c,Red) || !VCMPCLR(a,b,c,Green) || !VCMPCLR(a,b,c,Blue))
 
#define HVINITCOL(Col, id)
 
#define HVSTEPCOL(id)
 
#define S_FILLLINE(linefrom, lineto)
 
#define S_DOLINE(a, b, line)
 
#define S_GOLINE(a, b, line)
 
#define S_ENDLINE(a, b, line)    }
 
#define S_INITLINE(a, b, line)
 
#define INITCOL(a, b, line, col, id)
 
#define STEPCOL(a, b, line, col, id)
 
#define FINITCOL(linefrom, lineto, colid)
 
#define FDOCOL(linefrom, lineto, colid)
 
#define FILLLINE(linefrom, lineto)
 
#define DOLINE(a, b, line)
 
#define GOLINE(a, b, line)
 
#define ENDLINE(a, b, line)    }
 
#define INITLINE(a, b, line)
 
#define DOINIT(a, b, line)
 
#define SMALLER(a, b)   (a->y < b->y) || (a->y == b->y && a->x < b->x)
 
#define SWAP(a, b, c)
 
#define NLINES   3
 

Functions

BOOL FASTCALL IntEngGradientFillRect (IN SURFOBJ *psoDest, IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, IN ULONG nVertex, IN PGRADIENT_RECT gRect, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg, IN BOOL Horizontal)
 
BOOL FASTCALL IntEngGradientFillTriangle (IN SURFOBJ *psoDest, IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, IN ULONG nVertex, IN PGRADIENT_TRIANGLE gTriangle, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg)
 
static BOOL IntEngIsNULLTriangle (TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt)
 
BOOL APIENTRY EngGradientFill (_Inout_ SURFOBJ *psoDest, _In_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ TRIVERTEX *pVertex, _In_ ULONG nVertex, _In_ PVOID pMesh, _In_ ULONG nMesh, _In_ RECTL *prclExtents, _In_ POINTL *pptlDitherOrg, _In_ ULONG ulMode)
 
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)
 

Variables

const LONG LINC [2] = {-1, 1}
 

Macro Definition Documentation

◆ COMPAREVERTEX

#define COMPAREVERTEX (   a,
  b 
)    ((a)->x == (b)->x && (a)->y == (b)->y)

Definition at line 19 of file gradient.c.

◆ DOINIT

#define DOINIT (   a,
  b,
  line 
)
Value:
INITLINE(a, b, line); \
INITCOL(a, b, line, Red, 0); \
INITCOL(a, b, line, Green, 1); \
INITCOL(a, b, line, Blue, 2);
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
Definition: parser.c:49
#define INITLINE(a, b, line)
Definition: gradient.c:285

Definition at line 294 of file gradient.c.

◆ DOLINE

#define DOLINE (   a,
  b,
  line 
)
Value:
STEPCOL(a, b, line, Red, 0); \
STEPCOL(a, b, line, Green, 1); \
STEPCOL(a, b, line, Blue, 2); \
ex[line] += dx[line]; \
while(ex[line] > 0 && x[line] != destx[line]) \
{ \
x[line] += incx[line]; \
sx[line] += incx[line]; \
ex[line] -= dy[line]; \
}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
Definition: comerr.c:44
#define STEPCOL(a, b, line, col, id)
Definition: gradient.c:226

Definition at line 266 of file gradient.c.

◆ ENDLINE

#define ENDLINE (   a,
  b,
  line 
)     }

Definition at line 282 of file gradient.c.

◆ FDOCOL

#define FDOCOL (   linefrom,
  lineto,
  colid 
)
Value:
ge[colid] += gd[colid]; \
while(ge[colid] > 0) \
{ \
gc[colid] += gi[colid]; \
ge[colid] -= gx; \
}

Definition at line 240 of file gradient.c.

◆ FILLLINE

#define FILLLINE (   linefrom,
  lineto 
)
Value:
gx = abs(sx[lineto] - sx[linefrom]); \
gxi = LINC[sx[linefrom] < sx[lineto]]; \
FINITCOL(linefrom, lineto, 0); \
FINITCOL(linefrom, lineto, 1); \
FINITCOL(linefrom, lineto, 2); \
for(g = sx[linefrom]; g != sx[lineto]; g += gxi) \
{ \
if(InY && g >= FillRect.left && g < FillRect.right) \
{ \
Color = XLATEOBJ_iXlate(pxlo, RGB(gc[0], gc[1], gc[2])); \
DibFunctionsForBitmapFormat[psoOutput->iBitmapFormat].DIB_PutPixel(psoOutput, g, sy, Color); \
} \
FDOCOL(linefrom, lineto, 0); \
FDOCOL(linefrom, lineto, 1); \
FDOCOL(linefrom, lineto, 2); \
}
#define RGB(r, g, b)
Definition: precomp.h:71
#define abs(i)
Definition: fconv.c:206
GLboolean GLboolean g
Definition: glext.h:6204
PFN_DIB_PutPixel DIB_PutPixel
Definition: dib.h:45
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20
const LONG LINC[2]
Definition: gradient.c:16
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
Definition: winddi.h:3416
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Definition at line 248 of file gradient.c.

◆ FINITCOL

#define FINITCOL (   linefrom,
  lineto,
  colid 
)
Value:
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]]
const GLubyte * c
Definition: glext.h:8905

Definition at line 234 of file gradient.c.

◆ GOLINE

#define GOLINE (   a,
  b,
  line 
)
Value:
if(y >= a->y && y <= b->y) \
{
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Definition at line 278 of file gradient.c.

◆ HVINITCOL

#define HVINITCOL (   Col,
  id 
)
Value:
c[id] = v1->Col >> 8; \
dc[id] = abs((v2->Col >> 8) - c[id]); \
ec[id] = -(dy >> 1); \
ic[id] = LINC[(v2->Col >> 8) > c[id]]
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLuint id
Definition: glext.h:5910
static const WCHAR dc[]

Definition at line 26 of file gradient.c.

◆ HVSTEPCOL

#define HVSTEPCOL (   id)
Value:
ec[id] += dc[id]; \
while(ec[id] > 0) \
{ \
c[id] += ic[id]; \
ec[id] -= dy; \
}

Definition at line 31 of file gradient.c.

◆ INITCOL

#define INITCOL (   a,
  b,
  line,
  col,
  id 
)
Value:
c[line][id] = a->col >> 8; \
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]]

Definition at line 220 of file gradient.c.

◆ INITLINE

#define INITLINE (   a,
  b,
  line 
)
Value:
x[line] = a->x; \
sx[line] = a->x + pptlDitherOrg->x; \
dx[line] = abs(b->x - a->x); \
dy[line] = max(abs(b->y - a->y),1); \
incx[line] = LINC[b->x > a->x]; \
ex[line] = -(dy[line]>>1); \
destx[line] = b->x
#define max(a, b)
Definition: svc.c:63
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL * pptlDitherOrg
Definition: winddi.h:3656

Definition at line 285 of file gradient.c.

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file gradient.c.

◆ NLINES

#define NLINES   3

Definition at line 306 of file gradient.c.

◆ S_DOLINE

#define S_DOLINE (   a,
  b,
  line 
)
Value:
ex[line] += dx[line]; \
while(ex[line] > 0 && x[line] != destx[line]) \
{ \
x[line] += incx[line]; \
sx[line] += incx[line]; \
ex[line] -= dy[line]; \
}

Definition at line 194 of file gradient.c.

◆ S_ENDLINE

#define S_ENDLINE (   a,
  b,
  line 
)     }

Definition at line 207 of file gradient.c.

◆ S_FILLLINE

#define S_FILLLINE (   linefrom,
  lineto 
)
Value:
if(sx[lineto] < sx[linefrom]) \
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 min(a, b)
Definition: monoChain.cc:55
PFN_DIB_HLine DIB_HLine
Definition: dib.h:47

Definition at line 188 of file gradient.c.

◆ S_GOLINE

#define S_GOLINE (   a,
  b,
  line 
)
Value:
if(y >= a->y && y <= b->y) \
{

Definition at line 203 of file gradient.c.

◆ S_INITLINE

#define S_INITLINE (   a,
  b,
  line 
)
Value:
x[line] = a->x; \
sx[line] = a->x + pptlDitherOrg->x; \
dx[line] = abs(b->x - a->x); \
dy[line] = abs(b->y - a->y); \
incx[line] = LINC[b->x > a->x]; \
ex[line] = -(dy[line]>>1); \
destx[line] = b->x

Definition at line 210 of file gradient.c.

◆ SMALLER

#define SMALLER (   a,
  b 
)    (a->y < b->y) || (a->y == b->y && a->x < b->x)

Definition at line 300 of file gradient.c.

◆ STEPCOL

#define STEPCOL (   a,
  b,
  line,
  col,
  id 
)
Value:
ec[line][id] += dc[line][id]; \
while(ec[line][id] > 0) \
{ \
c[line][id] += ic[line][id]; \
ec[line][id] -= dy[line]; \
}

Definition at line 226 of file gradient.c.

◆ SWAP

#define SWAP (   a,
  b,
  c 
)
Value:
c = a;\
a = b;\
b = c
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79

Definition at line 302 of file gradient.c.

◆ VCMPCLR

#define VCMPCLR (   a,
  b,
  c,
  color 
)    (a->color != b->color || a->color != c->color)

Definition at line 21 of file gradient.c.

◆ VCMPCLRS

#define VCMPCLRS (   a,
  b,
  c 
)     !(!VCMPCLR(a,b,c,Red) || !VCMPCLR(a,b,c,Green) || !VCMPCLR(a,b,c,Blue))

Definition at line 22 of file gradient.c.

◆ VERTEX

#define VERTEX (   n)    (pVertex + gt->n)

Definition at line 18 of file gradient.c.

Function Documentation

◆ EngGradientFill()

BOOL APIENTRY EngGradientFill ( _Inout_ SURFOBJ psoDest,
_In_ CLIPOBJ pco,
_In_opt_ XLATEOBJ pxlo,
_In_ TRIVERTEX pVertex,
_In_ ULONG  nVertex,
_In_ PVOID  pMesh,
_In_ ULONG  nMesh,
_In_ RECTL prclExtents,
_In_ POINTL pptlDitherOrg,
_In_ ULONG  ulMode 
)

Definition at line 475 of file gradient.c.

486{
487 ULONG i;
488 BOOL ret = FALSE;
489
490 /* Check for NULL clip object */
491 if (pco == NULL)
492 {
493 /* Use the trivial one instead */
494 pco = (CLIPOBJ *)&gxcoTrivial;//.coClient;
495 }
496
497 switch(ulMode)
498 {
499 case GRADIENT_FILL_RECT_H:
500 case GRADIENT_FILL_RECT_V:
501 {
503 for (i = 0; i < nMesh; i++, gr++)
504 {
505 if (!IntEngGradientFillRect(psoDest,
506 pco,
507 pxlo,
508 pVertex,
509 nVertex,
510 gr,
513 (ulMode == GRADIENT_FILL_RECT_H)))
514 {
515 break;
516 }
517 }
518 ret = TRUE;
519 break;
520 }
521 case GRADIENT_FILL_TRIANGLE:
522 {
524 for (i = 0; i < nMesh; i++, gt++)
525 {
527 {
528 /* skip empty triangles */
529 continue;
530 }
531 if (!IntEngGradientFillTriangle(psoDest,
532 pco,
533 pxlo,
534 pVertex,
535 nVertex,
536 gt,
539 {
540 break;
541 }
542 }
543 ret = TRUE;
544 break;
545 }
546 }
547
548 return ret;
549}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32_t ULONG
Definition: typedefs.h:59
int ret
XCLIPOBJ gxcoTrivial
Definition: bitblt.c:20
static BOOL IntEngIsNULLTriangle(TRIVERTEX *pVertex, GRADIENT_TRIANGLE *gt)
Definition: gradient.c:461
BOOL FASTCALL IntEngGradientFillRect(IN SURFOBJ *psoDest, IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, IN ULONG nVertex, IN PGRADIENT_RECT gRect, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg, IN BOOL Horizontal)
Definition: gradient.c:43
BOOL FASTCALL IntEngGradientFillTriangle(IN SURFOBJ *psoDest, IN CLIPOBJ *pco, IN XLATEOBJ *pxlo, IN TRIVERTEX *pVertex, IN ULONG nVertex, IN PGRADIENT_TRIANGLE gTriangle, IN RECTL *prclExtents, IN POINTL *pptlDitherOrg)
Definition: gradient.c:310
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID pMesh
Definition: winddi.h:3653
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG nVertex
Definition: winddi.h:3652
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL * prclExtents
Definition: winddi.h:3655
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG _In_ RECTL _In_ POINTL _In_ ULONG ulMode
Definition: winddi.h:3657
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX * pVertex
Definition: winddi.h:3651
_In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ TRIVERTEX _In_ ULONG _In_ PVOID _In_ ULONG nMesh
Definition: winddi.h:3654
_In_ SURFOBJ _In_ CLIPOBJ * pco
Definition: winddi.h:3415
struct _GRADIENT_RECT * PGRADIENT_RECT
struct _GRADIENT_TRIANGLE * PGRADIENT_TRIANGLE

Referenced by IntEngGradientFill(), and PanGradientFill().

◆ IntEngGradientFill()

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 
)

Definition at line 553 of file gradient.c.

564{
565 BOOL Ret;
566 SURFACE *psurf;
567 ASSERT(psoDest);
568
569 psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
570 ASSERT(psurf);
571
572 if (psurf->flags & HOOK_GRADIENTFILL)
573 {
574 Ret = GDIDEVFUNCS(psoDest).GradientFill(psoDest,
575 pco,
576 pxlo,
577 pVertex,
578 nVertex,
579 pMesh,
580 nMesh,
583 ulMode);
584 }
585 else
586 {
587 Ret = EngGradientFill(psoDest,
588 pco,
589 pxlo,
590 pVertex,
591 nVertex,
592 pMesh,
593 nMesh,
596 ulMode);
597 }
598
599 return Ret;
600}
#define ASSERT(a)
Definition: mode.c:44
FLONG flags
Definition: surface.h:10
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
BOOL APIENTRY EngGradientFill(_Inout_ SURFOBJ *psoDest, _In_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ TRIVERTEX *pVertex, _In_ ULONG nVertex, _In_ PVOID pMesh, _In_ ULONG nMesh, _In_ RECTL *prclExtents, _In_ POINTL *pptlDitherOrg, _In_ ULONG ulMode)
Definition: gradient.c:475
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
#define HOOK_GRADIENTFILL
Definition: winddi.h:1436

Referenced by GreGradientFill().

◆ IntEngGradientFillRect()

BOOL FASTCALL IntEngGradientFillRect ( IN SURFOBJ psoDest,
IN CLIPOBJ pco,
IN XLATEOBJ pxlo,
IN TRIVERTEX pVertex,
IN ULONG  nVertex,
IN PGRADIENT_RECT  gRect,
IN RECTL prclExtents,
IN POINTL pptlDitherOrg,
IN BOOL  Horizontal 
)

Definition at line 43 of file gradient.c.

53{
54 SURFOBJ *psoOutput;
55 TRIVERTEX *v1, *v2;
56 RECTL rcGradient, rcSG;
57 RECT_ENUM RectEnum;
58 BOOL EnumMore;
59 ULONG i;
60 POINTL Translate;
61 INTENG_ENTER_LEAVE EnterLeave;
62 LONG y, dy, c[3], dc[3], ec[3], ic[3];
63
64 v1 = (pVertex + gRect->UpperLeft);
65 v2 = (pVertex + gRect->LowerRight);
66
67 rcGradient.left = min(v1->x, v2->x);
68 rcGradient.right = max(v1->x, v2->x);
69 rcGradient.top = min(v1->y, v2->y);
70 rcGradient.bottom = max(v1->y, v2->y);
71 rcSG = rcGradient;
73
74 if(Horizontal)
75 {
76 dy = abs(rcGradient.right - rcGradient.left);
77 }
78 else
79 {
80 dy = abs(rcGradient.bottom - rcGradient.top);
81 }
82
83 if(!IntEngEnter(&EnterLeave, psoDest, &rcSG, FALSE, &Translate, &psoOutput))
84 {
85 return FALSE;
86 }
87
88 if((v1->Red != v2->Red || v1->Green != v2->Green || v1->Blue != v2->Blue) && dy > 1)
89 {
91 do
92 {
95
96 if (Horizontal)
97 {
98 EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
99 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
100 {
101 if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
102 {
103 HVINITCOL(Red, 0);
104 HVINITCOL(Green, 1);
105 HVINITCOL(Blue, 2);
106
107 for (y = rcSG.left; y < FillRect.right; y++)
108 {
109 if (y >= FillRect.left)
110 {
111 Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2]));
113 psoOutput, y + Translate.x, FillRect.top + Translate.y, FillRect.bottom + Translate.y, Color);
114 }
115 HVSTEPCOL(0);
116 HVSTEPCOL(1);
117 HVSTEPCOL(2);
118 }
119 }
120 }
121
122 continue;
123 }
124
125 /* vertical */
126 EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
127 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
128 {
129 if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
130 {
131 HVINITCOL(Red, 0);
132 HVINITCOL(Green, 1);
133 HVINITCOL(Blue, 2);
134
135 for (y = rcSG.top; y < FillRect.bottom; y++)
136 {
137 if (y >= FillRect.top)
138 {
139 Color = XLATEOBJ_iXlate(pxlo, RGB(c[0], c[1], c[2]));
141 FillRect.left + Translate.x,
142 FillRect.right + Translate.x,
143 y + Translate.y,
144 Color);
145 }
146 HVSTEPCOL(0);
147 HVSTEPCOL(1);
148 HVSTEPCOL(2);
149 }
150 }
151 }
152
153 }
154 while (EnumMore);
155
156 return IntEngLeave(&EnterLeave);
157 }
158
159 /* rectangle has only one color, no calculation required */
161 do
162 {
164 ULONG Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
165
166 EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
167 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= rcSG.bottom; i++)
168 {
169 if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], &rcSG))
170 {
171 for (; FillRect.top < FillRect.bottom; FillRect.top++)
172 {
174 FillRect.left + Translate.x,
175 FillRect.right + Translate.x,
176 FillRect.top + Translate.y,
177 Color);
178 }
179 }
180 }
181 }
182 while (EnumMore);
183
184 return IntEngLeave(&EnterLeave);
185}
BOOL APIENTRY IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave, SURFOBJ *psoDest, RECTL *DestRect, BOOL ReadOnly, POINTL *Translate, SURFOBJ **ppsoOutput)
Definition: engmisc.c:15
BOOL APIENTRY IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave)
Definition: engmisc.c:162
long LONG
Definition: pedump.c:60
PFN_DIB_VLine DIB_VLine
Definition: dib.h:48
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
ULONG c
Definition: vgaddi.h:78
RECTL arcl[ENUM_RECT_LIMIT]
Definition: vgaddi.h:79
ULONG iBitmapFormat
Definition: winddi.h:1215
#define HVINITCOL(Col, id)
Definition: gradient.c:26
#define HVSTEPCOL(id)
Definition: gradient.c:31
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define CT_RECTANGLES
Definition: winddi.h:1317
ENGAPI BOOL APIENTRY CLIPOBJ_bEnum(_In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pul)
Definition: clip.c:319
ENGAPI ULONG APIENTRY CLIPOBJ_cEnumStart(_Inout_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cLimit)
Definition: clip.c:255
#define CD_RIGHTDOWN
Definition: winddi.h:1320

Referenced by EngGradientFill().

◆ IntEngGradientFillTriangle()

BOOL FASTCALL IntEngGradientFillTriangle ( IN SURFOBJ psoDest,
IN CLIPOBJ pco,
IN XLATEOBJ pxlo,
IN TRIVERTEX pVertex,
IN ULONG  nVertex,
IN PGRADIENT_TRIANGLE  gTriangle,
IN RECTL prclExtents,
IN POINTL pptlDitherOrg 
)

Definition at line 310 of file gradient.c.

319{
320 SURFOBJ *psoOutput;
321 PTRIVERTEX v1, v2, v3;
322 RECT_ENUM RectEnum;
323 BOOL EnumMore;
324 ULONG i;
325 POINTL Translate;
326 INTENG_ENTER_LEAVE EnterLeave;
327 RECTL FillRect = { 0, 0, 0, 0 };
328 ULONG Color;
329
330 BOOL sx[NLINES];
331 LONG x[NLINES], dx[NLINES], dy[NLINES], incx[NLINES], ex[NLINES], destx[NLINES];
332 LONG c[NLINES][3], dc[NLINES][3], ec[NLINES][3], ic[NLINES][3]; /* colors on lines */
333 LONG g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
334 LONG sy, y, bt;
335
336 v1 = (pVertex + gTriangle->Vertex1);
337 v2 = (pVertex + gTriangle->Vertex2);
338 v3 = (pVertex + gTriangle->Vertex3);
339
340 /* bubble sort */
341 if (SMALLER(v2, v1))
342 {
343 TRIVERTEX *t;
344 SWAP(v1, v2, t);
345 }
346
347 if (SMALLER(v3, v2))
348 {
349 TRIVERTEX *t;
350 SWAP(v2, v3, t);
351 if (SMALLER(v2, v1))
352 {
353 SWAP(v1, v2, t);
354 }
355 }
356
357 DPRINT("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y);
358 /* FIXME: commented out because of an endless loop - fix triangles first */
359 DPRINT("FIXME: IntEngGradientFillTriangle is broken\n");
360
361 if (!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput))
362 {
363 return FALSE;
364 }
365
366 if (VCMPCLRS(v1, v2, v3))
367 {
369 do
370 {
371 EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
372 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
373 {
375 {
376 BOOL InY;
377
378 DOINIT(v1, v3, 0);
379 DOINIT(v1, v2, 1);
380 DOINIT(v2, v3, 2);
381
382 y = v1->y;
383 sy = v1->y + pptlDitherOrg->y;
384 bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
385
386 while (sy < bt)
387 {
388 InY = !(sy < FillRect.top || sy >= FillRect.bottom);
389 GOLINE(v1, v3, 0);
390 DOLINE(v1, v3, 0);
391 ENDLINE(v1, v3, 0);
392
393 GOLINE(v1, v2, 1);
394 DOLINE(v1, v2, 1);
395 FILLLINE(0, 1);
396 ENDLINE(v1, v2, 1);
397
398 GOLINE(v2, v3, 2);
399 DOLINE(v2, v3, 2);
400 FILLLINE(0, 2);
401 ENDLINE(23, v3, 2);
402
403 y++;
404 sy++;
405 }
406 }
407 }
408 } while (EnumMore);
409
410 return IntEngLeave(&EnterLeave);
411 }
412
413 /* fill triangle with one solid color */
414
415 Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
417 do
418 {
419 EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
420 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
421 {
423 {
424 S_INITLINE(v1, v3, 0);
425 S_INITLINE(v1, v2, 1);
426 S_INITLINE(v2, v3, 2);
427
428 y = v1->y;
429 sy = v1->y + pptlDitherOrg->y;
430 bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
431
432 while (sy < bt)
433 {
434 S_GOLINE(v1, v3, 0);
435 S_DOLINE(v1, v3, 0);
436 S_ENDLINE(v1, v3, 0);
437
438 S_GOLINE(v1, v2, 1);
439 S_DOLINE(v1, v2, 1);
440 S_FILLLINE(0, 1);
441 S_ENDLINE(v1, v2, 1);
442
443 S_GOLINE(v2, v3, 2);
444 S_DOLINE(v2, v3, 2);
445 S_FILLLINE(0, 2);
446 S_ENDLINE(23, v3, 2);
447
448 y++;
449 sy++;
450 }
451 }
452 }
453 } while (EnumMore);
454
455 return IntEngLeave(&EnterLeave);
456}
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
#define DPRINT
Definition: sndvol32.h:71
#define S_DOLINE(a, b, line)
Definition: gradient.c:194
#define SMALLER(a, b)
Definition: gradient.c:300
#define S_ENDLINE(a, b, line)
Definition: gradient.c:207
#define ENDLINE(a, b, line)
Definition: gradient.c:282
#define SWAP(a, b, c)
Definition: gradient.c:302
#define S_INITLINE(a, b, line)
Definition: gradient.c:210
#define NLINES
Definition: gradient.c:306
#define DOLINE(a, b, line)
Definition: gradient.c:266
#define S_FILLLINE(linefrom, lineto)
Definition: gradient.c:188
#define S_GOLINE(a, b, line)
Definition: gradient.c:203
#define GOLINE(a, b, line)
Definition: gradient.c:278
#define DOINIT(a, b, line)
Definition: gradient.c:294
#define FILLLINE(linefrom, lineto)
Definition: gradient.c:248
#define VCMPCLRS(a, b, c)
Definition: gradient.c:22

Referenced by EngGradientFill().

◆ IntEngIsNULLTriangle()

static BOOL IntEngIsNULLTriangle ( TRIVERTEX pVertex,
GRADIENT_TRIANGLE gt 
)
static

Definition at line 461 of file gradient.c.

462{
463 if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))
464 return TRUE;
465 if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex3)))
466 return TRUE;
467 if(COMPAREVERTEX(VERTEX(Vertex2), VERTEX(Vertex3)))
468 return TRUE;
469 return FALSE;
470}
#define VERTEX(n)
Definition: gradient.c:18
#define COMPAREVERTEX(a, b)
Definition: gradient.c:19

Referenced by EngGradientFill().

Variable Documentation

◆ LINC

const LONG LINC[2] = {-1, 1}

Definition at line 16 of file gradient.c.