ReactOS 0.4.15-dev-7788-g1ad9096
copypix.c File Reference
#include <string.h>
#include "context.h"
#include "copypix.h"
#include "depth.h"
#include "feedback.h"
#include "dlist.h"
#include "macros.h"
#include "pixel.h"
#include "span.h"
#include "stencil.h"
#include "types.h"
Include dependency graph for copypix.c:

Go to the source code of this file.

Functions

static void copy_rgb_pixels (GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
 
static void copy_ci_pixels (GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
 
static void copy_depth_pixels (GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
 
static void copy_stencil_pixels (GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
 
void gl_CopyPixels (GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type)
 

Function Documentation

◆ copy_ci_pixels()

static void copy_ci_pixels ( GLcontext ctx,
GLint  srcx,
GLint  srcy,
GLint  width,
GLint  height,
GLint  destx,
GLint  desty 
)
static

Definition at line 199 of file copypix.c.

202{
203 GLdepth zspan[MAX_WIDTH];
204 GLuint indx[MAX_WIDTH];
205 GLint sy, dy, stepy;
206 GLint i, j;
207 GLboolean setbuffer, zoom;
208
209 if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
210 zoom = GL_FALSE;
211 }
212 else {
213 zoom = GL_TRUE;
214 }
215
216 /* Determine if copy should be bottom-to-top or top-to-bottom */
217 if (srcy<desty) {
218 /* top-down max-to-min */
219 sy = srcy + height - 1;
220 dy = desty + height - 1;
221 stepy = -1;
222 }
223 else {
224 /* bottom-up min-to-max */
225 sy = srcy;
226 dy = desty;
227 stepy = 1;
228 }
229
230 if (ctx->Depth.Test) {
231 /* fill in array of z values */
232 GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
233 for (i=0;i<width;i++) {
234 zspan[i] = z;
235 }
236 }
237
238 /* If read and draw buffer are different we must do buffer switching */
239 setbuffer = ctx->Pixel.ReadBuffer!=ctx->Color.DrawBuffer;
240
241 for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
242 /* read */
243 if (setbuffer) {
244 (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.ReadBuffer );
245 }
246 gl_read_index_span( ctx, width, srcx, sy, indx );
247
248 /* shift, offset */
249 if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) {
250 if (ctx->Pixel.IndexShift<0) {
251 for (i=0;i<width;i++) {
252 indx[i] = (indx[i] >> -ctx->Pixel.IndexShift)
253 + ctx->Pixel.IndexOffset;
254 }
255 }
256 else {
257 for (i=0;i<width;i++) {
258 indx[i] = (indx[i] << ctx->Pixel.IndexShift)
259 + ctx->Pixel.IndexOffset;
260 }
261 }
262 }
263
264 /* mapping */
265 if (ctx->Pixel.MapColorFlag) {
266 for (i=0;i<width;i++) {
267 if (indx[i] < ctx->Pixel.MapItoIsize) {
268 indx[i] = ctx->Pixel.MapItoI[ indx[i] ];
269 }
270 }
271 }
272
273 /* write */
274 if (setbuffer) {
275 (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer );
276 }
277 if (zoom) {
278 gl_write_zoomed_index_span( ctx, width, destx, dy, zspan, indx, desty );
279 }
280 else {
281 gl_write_index_span( ctx, width, destx, dy, zspan, indx, GL_BITMAP );
282 }
283 }
284}
#define MAX_WIDTH
Definition: config.h:130
#define DEPTH_SCALE
Definition: config.h:146
GLint GLdepth
Definition: types.h:218
#define GL_TRUE
Definition: gl.h:174
unsigned int GLuint
Definition: gl.h:159
#define GL_BITMAP
Definition: gl.h:497
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define GL_FALSE
Definition: gl.h:173
int GLint
Definition: gl.h:156
GLint GLint GLsizei width
Definition: gl.h:1546
unsigned char GLboolean
Definition: gl.h:151
GLdouble GLdouble z
Definition: glext.h:5874
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
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 GLint GLint j
Definition: glfuncs.h:250
GLint dy
Definition: linetemp.h:97
void gl_write_zoomed_index_span(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], const GLuint indexes[], GLint y0)
Definition: pixel.c:237
void gl_read_index_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint indx[])
Definition: span.c:897
void gl_write_index_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth z[], GLuint index[], GLenum primitive)
Definition: span.c:167

Referenced by gl_CopyPixels().

◆ copy_depth_pixels()

static void copy_depth_pixels ( GLcontext ctx,
GLint  srcx,
GLint  srcy,
GLint  width,
GLint  height,
GLint  destx,
GLint  desty 
)
static

Definition at line 291 of file copypix.c.

294{
296 GLdepth zspan[MAX_WIDTH];
297 GLuint indx[MAX_WIDTH];
300 GLint sy, dy, stepy;
301 GLint i, j;
302 GLboolean zoom;
303
304 if (!ctx->Buffer->Depth) {
305 gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
306 return;
307 }
308
309 if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
310 zoom = GL_FALSE;
311 }
312 else {
313 zoom = GL_TRUE;
314 }
315
316 /* Determine if copy should be bottom-to-top or top-to-bottom */
317 if (srcy<desty) {
318 /* top-down max-to-min */
319 sy = srcy + height - 1;
320 dy = desty + height - 1;
321 stepy = -1;
322 }
323 else {
324 /* bottom-up min-to-max */
325 sy = srcy;
326 dy = desty;
327 stepy = 1;
328 }
329
330 /* setup colors or indexes */
331 if (ctx->Visual->RGBAflag) {
332 GLubyte r, g, b, a;
333 r = ctx->Current.ByteColor[0];
334 g = ctx->Current.ByteColor[1];
335 b = ctx->Current.ByteColor[2];
336 a = ctx->Current.ByteColor[3];
337 MEMSET( red, (int) r, width );
338 MEMSET( green, (int) g, width );
339 MEMSET( blue, (int) b, width );
340 MEMSET( alpha, (int) a, width );
341 }
342 else {
343 for (i=0;i<width;i++) {
344 indx[i] = ctx->Current.Index;
345 }
346 }
347
348 for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
349 /* read */
350 (*ctx->Driver.ReadDepthSpanFloat)( ctx, width, srcx, sy, depth );
351 /* scale, bias, clamp */
352 for (i=0;i<width;i++) {
353 GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
354 zspan[i] = (GLint) (CLAMP( d, 0.0, 1.0 ) * DEPTH_SCALE);
355 }
356 /* write */
357 if (ctx->Visual->RGBAflag) {
358 if (zoom) {
359 gl_write_zoomed_color_span( ctx, width, destx, dy, zspan,
360 red, green, blue, alpha, desty );
361 }
362 else {
363 gl_write_color_span( ctx, width, destx, dy, zspan,
365 }
366 }
367 else {
368 if (zoom) {
370 zspan, indx, desty);
371 }
372 else {
374 zspan, indx, GL_BITMAP );
375 }
376 }
377 }
378}
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
unsigned char GLubyte
Definition: gl.h:157
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
float GLfloat
Definition: gl.h:161
GLclampf green
Definition: gl.h:1740
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLclampf GLclampf blue
Definition: gl.h:1740
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
#define red
Definition: linetest.c:67
#define MEMSET(DST, VAL, N)
Definition: macros.h:241
void gl_write_zoomed_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], const GLubyte red[], const GLubyte green[], const GLubyte blue[], const GLubyte alpha[], GLint y0)
Definition: pixel.c:136
void gl_write_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLdepth z[], GLubyte r[], GLubyte g[], GLubyte b[], GLubyte a[], GLenum primitive)
Definition: span.c:378
#define CLAMP(f, min, max)
Definition: tif_color.c:177

Referenced by gl_CopyPixels().

◆ copy_rgb_pixels()

static void copy_rgb_pixels ( GLcontext ctx,
GLint  srcx,
GLint  srcy,
GLint  width,
GLint  height,
GLint  destx,
GLint  desty 
)
static

Definition at line 68 of file copypix.c.

71{
72 DEFARRAY( GLdepth, zspan, MAX_WIDTH );
77 GLboolean scale_or_bias, quick_draw, zoom;
78 GLint sy, dy, stepy;
79 GLint i, j;
80 GLboolean setbuffer;
81
82 if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
83 zoom = GL_FALSE;
84 }
85 else {
86 zoom = GL_TRUE;
87 }
88
89 /* Determine if copy should be done bottom-to-top or top-to-bottom */
90 if (srcy<desty) {
91 /* top-down max-to-min */
92 sy = srcy + height - 1;
93 dy = desty + height - 1;
94 stepy = -1;
95 }
96 else {
97 /* bottom-up min-to-max */
98 sy = srcy;
99 dy = desty;
100 stepy = 1;
101 }
102
103 scale_or_bias = ctx->Pixel.RedScale!=1.0 || ctx->Pixel.RedBias!=0.0
104 || ctx->Pixel.GreenScale!=1.0 || ctx->Pixel.GreenBias!=0.0
105 || ctx->Pixel.BlueScale!=1.0 || ctx->Pixel.BlueBias!=0.0
106 || ctx->Pixel.AlphaScale!=1.0 || ctx->Pixel.AlphaBias!=0.0;
107
108 if (ctx->Depth.Test) {
109 /* fill in array of z values */
110 GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE);
111 for (i=0;i<width;i++) {
112 zspan[i] = z;
113 }
114 }
115
116 if (ctx->RasterMask==0 && !zoom
117 && destx>=0 && destx+width<=ctx->Buffer->Width) {
118 quick_draw = GL_TRUE;
119 }
120 else {
121 quick_draw = GL_FALSE;
122 }
123
124 /* If read and draw buffer are different we must do buffer switching */
125 setbuffer = ctx->Pixel.ReadBuffer!=ctx->Color.DrawBuffer;
126
127 for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
128 /* read */
129
130 if (setbuffer) {
131 (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.ReadBuffer );
132 }
133 gl_read_color_span( ctx, width, srcx, sy, red, green, blue, alpha );
134
135 if (scale_or_bias) {
136 GLfloat rbias = ctx->Pixel.RedBias * ctx->Visual->RedScale;
137 GLfloat gbias = ctx->Pixel.GreenBias * ctx->Visual->GreenScale;
138 GLfloat bbias = ctx->Pixel.BlueBias * ctx->Visual->BlueScale;
139 GLfloat abias = ctx->Pixel.AlphaBias * ctx->Visual->AlphaScale;
140 GLint rmax = (GLint) ctx->Visual->RedScale;
141 GLint gmax = (GLint) ctx->Visual->GreenScale;
142 GLint bmax = (GLint) ctx->Visual->BlueScale;
143 GLint amax = (GLint) ctx->Visual->AlphaScale;
144 for (i=0;i<width;i++) {
145 GLint r = red[i] * ctx->Pixel.RedScale + rbias;
146 GLint g = green[i] * ctx->Pixel.GreenScale + gbias;
147 GLint b = blue[i] * ctx->Pixel.BlueScale + bbias;
148 GLint a = alpha[i] * ctx->Pixel.AlphaScale + abias;
149 red[i] = CLAMP( r, 0, rmax );
150 green[i] = CLAMP( g, 0, gmax );
151 blue[i] = CLAMP( b, 0, bmax );
152 alpha[i] = CLAMP( a, 0, amax );
153 }
154 }
155
156 if (ctx->Pixel.MapColorFlag) {
157 GLfloat r = (ctx->Pixel.MapRtoRsize-1) * ctx->Visual->InvRedScale;
158 GLfloat g = (ctx->Pixel.MapGtoGsize-1) * ctx->Visual->InvGreenScale;
159 GLfloat b = (ctx->Pixel.MapBtoBsize-1) * ctx->Visual->InvBlueScale;
160 GLfloat a = (ctx->Pixel.MapAtoAsize-1) * ctx->Visual->InvAlphaScale;
161 for (i=0;i<width;i++) {
162 GLint ir = red[i] * r;
163 GLint ig = green[i] * g;
164 GLint ib = blue[i] * b;
165 GLint ia = alpha[i] * a;
166 red[i] = (GLint) (ctx->Pixel.MapRtoR[ir]*ctx->Visual->RedScale);
167 green[i] = (GLint) (ctx->Pixel.MapGtoG[ig]*ctx->Visual->GreenScale);
168 blue[i] = (GLint) (ctx->Pixel.MapBtoB[ib]*ctx->Visual->BlueScale);
169 alpha[i] = (GLint) (ctx->Pixel.MapAtoA[ia]*ctx->Visual->AlphaScale);
170 }
171 }
172
173 /* write */
174 if (setbuffer) {
175 (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer );
176 }
177 if (quick_draw && dy>=0 && dy<ctx->Buffer->Height) {
178 (*ctx->Driver.WriteColorSpan)( ctx, width, destx, dy,
179 red, green, blue, alpha, NULL);
180 }
181 else if (zoom) {
182 gl_write_zoomed_color_span( ctx, width, destx, dy, zspan,
183 red, green, blue, alpha, desty );
184 }
185 else {
186 gl_write_color_span( ctx, width, destx, dy, zspan,
188 }
189 }
190 UNDEFARRAY( zspan );
191 UNDEFARRAY( red );
192 UNDEFARRAY( green );
193 UNDEFARRAY( blue );
194 UNDEFARRAY( alpha );
195}
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define DEFARRAY(TYPE, NAME, SIZE)
Definition: macros.h:256
#define UNDEFARRAY(NAME)
Definition: macros.h:257
void gl_read_color_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte red[], GLubyte green[], GLubyte blue[], GLubyte alpha[])
Definition: span.c:850

Referenced by gl_CopyPixels().

◆ copy_stencil_pixels()

static void copy_stencil_pixels ( GLcontext ctx,
GLint  srcx,
GLint  srcy,
GLint  width,
GLint  height,
GLint  destx,
GLint  desty 
)
static

Definition at line 382 of file copypix.c.

385{
387 GLint sy, dy, stepy;
388 GLint i, j;
389 GLboolean zoom;
390
391 if (!ctx->Buffer->Stencil) {
392 gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
393 return;
394 }
395
396 if (ctx->Pixel.ZoomX==1.0F && ctx->Pixel.ZoomY==1.0F) {
397 zoom = GL_FALSE;
398 }
399 else {
400 zoom = GL_TRUE;
401 }
402
403 /* Determine if copy should be bottom-to-top or top-to-bottom */
404 if (srcy<desty) {
405 /* top-down max-to-min */
406 sy = srcy + height - 1;
407 dy = desty + height - 1;
408 stepy = -1;
409 }
410 else {
411 /* bottom-up min-to-max */
412 sy = srcy;
413 dy = desty;
414 stepy = 1;
415 }
416
417 for (j=0; j<height; j++, sy+=stepy, dy+=stepy) {
418 /* read */
419 gl_read_stencil_span( ctx, width, srcx, sy, stencil );
420 /* shift, offset */
421 if (ctx->Pixel.IndexShift<0) {
422 for (i=0;i<width;i++) {
423 stencil[i] = (stencil[i] >> -ctx->Pixel.IndexShift)
424 + ctx->Pixel.IndexOffset;
425 }
426 }
427 else {
428 for (i=0;i<width;i++) {
429 stencil[i] = (stencil[i] << ctx->Pixel.IndexShift)
430 + ctx->Pixel.IndexOffset;
431 }
432 }
433 /* mapping */
434 if (ctx->Pixel.MapStencilFlag) {
435 for (i=0;i<width;i++) {
436 if ((GLint) stencil[i] < ctx->Pixel.MapStoSsize) {
437 stencil[i] = ctx->Pixel.MapStoS[ stencil[i] ];
438 }
439 }
440 }
441 /* write */
442 if (zoom) {
443 gl_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty );
444 }
445 else {
447 }
448 }
449}
GLint GLfloat GLint stencil
Definition: glext.h:6260
void gl_write_zoomed_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte stencil[], GLint y0)
Definition: pixel.c:328
void gl_write_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte stencil[])
Definition: stencil.c:957
void gl_read_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte stencil[])
Definition: stencil.c:938

Referenced by gl_CopyPixels().

◆ gl_CopyPixels()

void gl_CopyPixels ( GLcontext ctx,
GLint  srcx,
GLint  srcy,
GLsizei  width,
GLsizei  height,
GLenum  type 
)

Definition at line 454 of file copypix.c.

456{
457 GLint destx, desty;
458
459 if (INSIDE_BEGIN_END(ctx)) {
460 gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
461 return;
462 }
463
464 if (width<0 || height<0) {
465 gl_error( ctx, GL_INVALID_VALUE, "glCopyPixels" );
466 return;
467 }
468
469 if (ctx->NewState) {
471 }
472
473 if (ctx->RenderMode==GL_RENDER) {
474 /* Destination of copy: */
475 if (!ctx->Current.RasterPosValid) {
476 return;
477 }
478 destx = (GLint) (ctx->Current.RasterPos[0] + 0.5F);
479 desty = (GLint) (ctx->Current.RasterPos[1] + 0.5F);
480
481 if (type==GL_COLOR && ctx->Visual->RGBAflag) {
482 copy_rgb_pixels( ctx, srcx, srcy, width, height, destx, desty );
483 }
484 else if (type==GL_COLOR && !ctx->Visual->RGBAflag) {
485 copy_ci_pixels( ctx, srcx, srcy, width, height, destx, desty );
486 }
487 else if (type==GL_DEPTH) {
488 copy_depth_pixels( ctx, srcx, srcy, width, height, destx, desty );
489 }
490 else if (type==GL_STENCIL) {
491 copy_stencil_pixels( ctx, srcx, srcy, width, height, destx, desty );
492 }
493 else {
494 gl_error( ctx, GL_INVALID_ENUM, "glCopyPixels" );
495 }
496 }
497 else if (ctx->RenderMode==GL_FEEDBACK) {
498 GLfloat color[4];
499 color[0] = ctx->Current.ByteColor[0] * ctx->Visual->InvRedScale;
500 color[1] = ctx->Current.ByteColor[1] * ctx->Visual->InvGreenScale;
501 color[2] = ctx->Current.ByteColor[2] * ctx->Visual->InvBlueScale;
502 color[3] = ctx->Current.ByteColor[3] * ctx->Visual->InvAlphaScale;
504 gl_feedback_vertex( ctx, ctx->Current.RasterPos[0],
505 ctx->Current.RasterPos[1],
506 ctx->Current.RasterPos[2],
507 ctx->Current.RasterPos[3],
508 color, ctx->Current.Index,
509 ctx->Current.TexCoord );
510 }
511 else if (ctx->RenderMode==GL_SELECT) {
512 gl_update_hitflag( ctx, ctx->Current.RasterPos[2] );
513 }
514
515}
static void copy_ci_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
Definition: copypix.c:199
static void copy_rgb_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
Definition: copypix.c:68
static void copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
Definition: copypix.c:382
static void copy_depth_pixels(GLcontext *ctx, GLint srcx, GLint srcy, GLint width, GLint height, GLint destx, GLint desty)
Definition: copypix.c:291
void gl_update_state(GLcontext *ctx)
Definition: context.c:1749
void gl_feedback_vertex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w, const GLfloat color[4], GLfloat index, const GLfloat texcoord[4])
Definition: feedback.c:161
void gl_update_hitflag(GLcontext *ctx, GLfloat z)
Definition: feedback.c:240
#define FEEDBACK_TOKEN(CTX, T)
Definition: feedback.h:39
#define GL_RENDER
Definition: gl.h:388
#define GL_INVALID_VALUE
Definition: gl.h:695
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_SELECT
Definition: gl.h:389
#define GL_COLOR
Definition: gl.h:498
#define GL_STENCIL
Definition: gl.h:500
#define GL_FEEDBACK
Definition: gl.h:387
#define GL_DEPTH
Definition: gl.h:499
#define GL_COPY_PIXEL_TOKEN
Definition: gl.h:403
#define GL_INVALID_ENUM
Definition: gl.h:694
GLuint color
Definition: glext.h:6243
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by execute_list(), and init_exec_pointers().