ReactOS 0.4.15-dev-7659-ga55345b
scissor.c File Reference
#include "context.h"
#include "macros.h"
#include "dlist.h"
#include "scissor.h"
#include "types.h"
Include dependency graph for scissor.c:

Go to the source code of this file.

Functions

void gl_Scissor (GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
 
GLint gl_scissor_span (GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte mask[])
 
GLuint gl_scissor_pixels (GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte mask[])
 

Function Documentation

◆ gl_Scissor()

void gl_Scissor ( GLcontext ctx,
GLint  x,
GLint  y,
GLsizei  width,
GLsizei  height 
)

Definition at line 58 of file scissor.c.

60{
61 if (width<0 || height<0) {
62 gl_error( ctx, GL_INVALID_VALUE, "glScissor" );
63 return;
64 }
65 if (INSIDE_BEGIN_END(ctx)) {
66 gl_error( ctx, GL_INVALID_OPERATION, "glBegin" );
67 return;
68 }
69
70 if (x!=ctx->Scissor.X || y!=ctx->Scissor.Y ||
71 width!=ctx->Scissor.Width || height!=ctx->Scissor.Height) {
72 ctx->Scissor.X = x;
73 ctx->Scissor.Y = y;
74 ctx->Scissor.Width = width;
75 ctx->Scissor.Height = height;
76 ctx->NewState |= NEW_ALL; /* TODO: this is overkill */
77 }
78}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define NEW_ALL
Definition: types.h:1236
#define GL_INVALID_VALUE
Definition: gl.h:695
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by execute_list(), and init_exec_pointers().

◆ gl_scissor_pixels()

GLuint gl_scissor_pixels ( GLcontext ctx,
GLuint  n,
const GLint  x[],
const GLint  y[],
GLubyte  mask[] 
)

Definition at line 116 of file scissor.c.

119{
120 GLint xmin = ctx->Buffer->Xmin;
121 GLint xmax = ctx->Buffer->Xmax;
122 GLint ymin = ctx->Buffer->Ymin;
123 GLint ymax = ctx->Buffer->Ymax;
124 GLuint i;
125
126 for (i=0;i<n;i++) {
127 mask[i] &= (x[i]>=xmin) & (x[i]<=xmax) & (y[i]>=ymin) & (y[i]<=ymax);
128 }
129
130 return 1;
131}
unsigned int GLuint
Definition: gl.h:159
int GLint
Definition: gl.h:156
GLdouble n
Definition: glext.h:7729
GLenum GLint GLuint mask
Definition: glext.h:6028
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

◆ gl_scissor_span()

GLint gl_scissor_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
GLubyte  mask[] 
)

Definition at line 87 of file scissor.c.

89{
90 /* first check if whole span is outside the scissor box */
91 if (y<ctx->Buffer->Ymin || y>ctx->Buffer->Ymax
92 || x>ctx->Buffer->Xmax || x+(GLint)n-1<ctx->Buffer->Xmin) {
93 return 0;
94 }
95 else {
96 GLint i;
97 GLint xMin = ctx->Buffer->Xmin;
98 GLint xMax = ctx->Buffer->Xmax;
99 for (i=0; x+i < xMin; i++) {
100 mask[i] = 0;
101 }
102 for (i=(GLint)n-1; x+i > xMax; i--) {
103 mask[i] = 0;
104 }
105
106 return 1;
107 }
108}
Definition: bufpool.h:45

Referenced by gl_write_color_span(), gl_write_index_span(), gl_write_monocolor_span(), gl_write_monoindex_span(), and gl_write_texture_span().