ReactOS 0.4.15-dev-7788-g1ad9096
pixel.h File Reference
#include "types.h"
Include dependency graph for pixel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gl_GetPixelMapfv (GLcontext *ctx, GLenum map, GLfloat *values)
 
void gl_GetPixelMapuiv (GLcontext *ctx, GLenum map, GLuint *values)
 
void gl_GetPixelMapusv (GLcontext *ctx, GLenum map, GLushort *values)
 
void gl_PixelMapfv (GLcontext *ctx, GLenum map, GLint mapsize, const GLfloat *values)
 
void gl_PixelStorei (GLcontext *ctx, GLenum pname, GLint param)
 
void gl_PixelTransferf (GLcontext *ctx, GLenum pname, GLfloat param)
 
void gl_PixelZoom (GLcontext *ctx, GLfloat xfactor, GLfloat yfactor)
 
GLvoidgl_unpack_pixels (GLcontext *ctx, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
 
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)
 
void gl_write_zoomed_index_span (GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], const GLuint indexes[], GLint y0)
 
void gl_write_zoomed_stencil_span (GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte stencil[], GLint y0)
 

Function Documentation

◆ gl_GetPixelMapfv()

void gl_GetPixelMapfv ( GLcontext ctx,
GLenum  map,
GLfloat values 
)

Definition at line 621 of file pixel.c.

622{
623 GLuint i;
624
625 if (INSIDE_BEGIN_END(ctx)) {
626 gl_error( ctx, GL_INVALID_OPERATION, "glGetPixelMapfv" );
627 return;
628 }
629 switch (map) {
631 for (i=0;i<ctx->Pixel.MapItoIsize;i++) {
632 values[i] = (GLfloat) ctx->Pixel.MapItoI[i];
633 }
634 break;
636 for (i=0;i<ctx->Pixel.MapStoSsize;i++) {
637 values[i] = (GLfloat) ctx->Pixel.MapStoS[i];
638 }
639 break;
641 MEMCPY(values,ctx->Pixel.MapItoR,ctx->Pixel.MapItoRsize*sizeof(GLfloat));
642 break;
644 MEMCPY(values,ctx->Pixel.MapItoG,ctx->Pixel.MapItoGsize*sizeof(GLfloat));
645 break;
647 MEMCPY(values,ctx->Pixel.MapItoB,ctx->Pixel.MapItoBsize*sizeof(GLfloat));
648 break;
650 MEMCPY(values,ctx->Pixel.MapItoA,ctx->Pixel.MapItoAsize*sizeof(GLfloat));
651 break;
653 MEMCPY(values,ctx->Pixel.MapRtoR,ctx->Pixel.MapRtoRsize*sizeof(GLfloat));
654 break;
656 MEMCPY(values,ctx->Pixel.MapGtoG,ctx->Pixel.MapGtoGsize*sizeof(GLfloat));
657 break;
659 MEMCPY(values,ctx->Pixel.MapBtoB,ctx->Pixel.MapBtoBsize*sizeof(GLfloat));
660 break;
662 MEMCPY(values,ctx->Pixel.MapAtoA,ctx->Pixel.MapAtoAsize*sizeof(GLfloat));
663 break;
664 default:
665 gl_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
666 }
667}
Definition: _map.h:48
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
float GLfloat
Definition: gl.h:161
#define GL_PIXEL_MAP_R_TO_R
Definition: gl.h:622
#define GL_PIXEL_MAP_I_TO_I
Definition: gl.h:617
#define GL_INVALID_OPERATION
Definition: gl.h:696
#define GL_PIXEL_MAP_S_TO_S
Definition: gl.h:616
unsigned int GLuint
Definition: gl.h:159
#define GL_PIXEL_MAP_G_TO_G
Definition: gl.h:623
#define GL_PIXEL_MAP_I_TO_R
Definition: gl.h:618
#define GL_PIXEL_MAP_A_TO_A
Definition: gl.h:625
#define GL_PIXEL_MAP_B_TO_B
Definition: gl.h:624
#define GL_PIXEL_MAP_I_TO_B
Definition: gl.h:620
#define GL_PIXEL_MAP_I_TO_G
Definition: gl.h:619
#define GL_PIXEL_MAP_I_TO_A
Definition: gl.h:621
#define GL_INVALID_ENUM
Definition: gl.h:694
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
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
#define MEMCPY(DST, SRC, BYTES)
Definition: macros.h:231
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetPixelMapuiv()

void gl_GetPixelMapuiv ( GLcontext ctx,
GLenum  map,
GLuint values 
)

Definition at line 670 of file pixel.c.

671{
672 GLuint i;
673
674 if (INSIDE_BEGIN_END(ctx)) {
675 gl_error( ctx, GL_INVALID_OPERATION, "glGetPixelMapfv" );
676 return;
677 }
678 switch (map) {
680 MEMCPY(values, ctx->Pixel.MapItoI, ctx->Pixel.MapItoIsize*sizeof(GLint));
681 break;
683 MEMCPY(values, ctx->Pixel.MapStoS, ctx->Pixel.MapStoSsize*sizeof(GLint));
684 break;
686 for (i=0;i<ctx->Pixel.MapItoRsize;i++) {
687 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] );
688 }
689 break;
691 for (i=0;i<ctx->Pixel.MapItoGsize;i++) {
692 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] );
693 }
694 break;
696 for (i=0;i<ctx->Pixel.MapItoBsize;i++) {
697 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] );
698 }
699 break;
701 for (i=0;i<ctx->Pixel.MapItoAsize;i++) {
702 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] );
703 }
704 break;
706 for (i=0;i<ctx->Pixel.MapRtoRsize;i++) {
707 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] );
708 }
709 break;
711 for (i=0;i<ctx->Pixel.MapGtoGsize;i++) {
712 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] );
713 }
714 break;
716 for (i=0;i<ctx->Pixel.MapBtoBsize;i++) {
717 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] );
718 }
719 break;
721 for (i=0;i<ctx->Pixel.MapAtoAsize;i++) {
722 values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] );
723 }
724 break;
725 default:
726 gl_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
727 }
728}
int GLint
Definition: gl.h:156
#define FLOAT_TO_UINT(X)
Definition: macros.h:211

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_GetPixelMapusv()

void gl_GetPixelMapusv ( GLcontext ctx,
GLenum  map,
GLushort values 
)

Definition at line 731 of file pixel.c.

732{
733 GLuint i;
734
735 if (INSIDE_BEGIN_END(ctx)) {
736 gl_error( ctx, GL_INVALID_OPERATION, "glGetPixelMapfv" );
737 return;
738 }
739 switch (map) {
741 for (i=0;i<ctx->Pixel.MapItoIsize;i++) {
742 values[i] = (GLushort) ctx->Pixel.MapItoI[i];
743 }
744 break;
746 for (i=0;i<ctx->Pixel.MapStoSsize;i++) {
747 values[i] = (GLushort) ctx->Pixel.MapStoS[i];
748 }
749 break;
751 for (i=0;i<ctx->Pixel.MapItoRsize;i++) {
752 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoR[i] );
753 }
754 break;
756 for (i=0;i<ctx->Pixel.MapItoGsize;i++) {
757 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoG[i] );
758 }
759 break;
761 for (i=0;i<ctx->Pixel.MapItoBsize;i++) {
762 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoB[i] );
763 }
764 break;
766 for (i=0;i<ctx->Pixel.MapItoAsize;i++) {
767 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoA[i] );
768 }
769 break;
771 for (i=0;i<ctx->Pixel.MapRtoRsize;i++) {
772 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapRtoR[i] );
773 }
774 break;
776 for (i=0;i<ctx->Pixel.MapGtoGsize;i++) {
777 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapGtoG[i] );
778 }
779 break;
781 for (i=0;i<ctx->Pixel.MapBtoBsize;i++) {
782 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapBtoB[i] );
783 }
784 break;
786 for (i=0;i<ctx->Pixel.MapAtoAsize;i++) {
787 values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapAtoA[i] );
788 }
789 break;
790 default:
791 gl_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
792 }
793}
unsigned short GLushort
Definition: gl.h:158
#define FLOAT_TO_USHORT(X)
Definition: macros.h:197

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_PixelMapfv()

void gl_PixelMapfv ( GLcontext ctx,
GLenum  map,
GLint  mapsize,
const GLfloat values 
)

Definition at line 520 of file pixel.c.

522{
523 GLuint i;
524
525 if (INSIDE_BEGIN_END(ctx)) {
526 gl_error( ctx, GL_INVALID_OPERATION, "glPixelMapfv" );
527 return;
528 }
529
530 if (mapsize<0 || mapsize>MAX_PIXEL_MAP_TABLE) {
531 gl_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
532 return;
533 }
534
536 /* test that mapsize is a power of two */
537 GLuint p;
539 for (p=1; p<=MAX_PIXEL_MAP_TABLE; p=p<<1) {
540 if ( (p&mapsize) == p ) {
541 ok = GL_TRUE;
542 break;
543 }
544 }
545 if (!ok) {
546 gl_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
547 return;
548 }
549 }
550
551 switch (map) {
553 ctx->Pixel.MapStoSsize = mapsize;
554 for (i=0;i<mapsize;i++) {
555 ctx->Pixel.MapStoS[i] = (GLint) values[i];
556 }
557 break;
559 ctx->Pixel.MapItoIsize = mapsize;
560 for (i=0;i<mapsize;i++) {
561 ctx->Pixel.MapItoI[i] = (GLint) values[i];
562 }
563 break;
565 ctx->Pixel.MapItoRsize = mapsize;
566 for (i=0;i<mapsize;i++) {
567 ctx->Pixel.MapItoR[i] = CLAMP( values[i], 0.0, 1.0 );
568 }
569 break;
571 ctx->Pixel.MapItoGsize = mapsize;
572 for (i=0;i<mapsize;i++) {
573 ctx->Pixel.MapItoG[i] = CLAMP( values[i], 0.0, 1.0 );
574 }
575 break;
577 ctx->Pixel.MapItoBsize = mapsize;
578 for (i=0;i<mapsize;i++) {
579 ctx->Pixel.MapItoB[i] = CLAMP( values[i], 0.0, 1.0 );
580 }
581 break;
583 ctx->Pixel.MapItoAsize = mapsize;
584 for (i=0;i<mapsize;i++) {
585 ctx->Pixel.MapItoA[i] = CLAMP( values[i], 0.0, 1.0 );
586 }
587 break;
589 ctx->Pixel.MapRtoRsize = mapsize;
590 for (i=0;i<mapsize;i++) {
591 ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0, 1.0 );
592 }
593 break;
595 ctx->Pixel.MapGtoGsize = mapsize;
596 for (i=0;i<mapsize;i++) {
597 ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0, 1.0 );
598 }
599 break;
601 ctx->Pixel.MapBtoBsize = mapsize;
602 for (i=0;i<mapsize;i++) {
603 ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0, 1.0 );
604 }
605 break;
607 ctx->Pixel.MapAtoAsize = mapsize;
608 for (i=0;i<mapsize;i++) {
609 ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0, 1.0 );
610 }
611 break;
612 default:
613 gl_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" );
614 }
615}
#define ok(value,...)
Definition: atltest.h:57
#define MAX_PIXEL_MAP_TABLE
Definition: config.h:96
#define GL_TRUE
Definition: gl.h:174
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_FALSE
Definition: gl.h:173
unsigned char GLboolean
Definition: gl.h:151
GLfloat GLfloat p
Definition: glext.h:8902
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 GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint mapsize
Definition: glfuncs.h:262
#define CLAMP(f, min, max)
Definition: tif_color.c:177

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PixelStorei()

void gl_PixelStorei ( GLcontext ctx,
GLenum  pname,
GLint  param 
)

Definition at line 418 of file pixel.c.

419{
420 /* NOTE: this call can't be compiled into the display list */
421
422 if (INSIDE_BEGIN_END(ctx)) {
423 gl_error( ctx, GL_INVALID_OPERATION, "glPixelStore" );
424 return;
425 }
426
427 switch (pname) {
429 ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
430 break;
432 ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
433 break;
435 if (param<0) {
436 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
437 }
438 else {
439 ctx->Pack.RowLength = param;
440 }
441 break;
443 if (param<0) {
444 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
445 }
446 else {
447 ctx->Pack.SkipPixels = param;
448 }
449 break;
451 if (param<0) {
452 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
453 }
454 else {
455 ctx->Pack.SkipRows = param;
456 }
457 break;
459 if (param==1 || param==2 || param==4 || param==8) {
460 ctx->Pack.Alignment = param;
461 }
462 else {
463 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
464 }
465 break;
467 ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
468 break;
470 ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
471 break;
473 if (param<0) {
474 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
475 }
476 else {
477 ctx->Unpack.RowLength = param;
478 }
479 break;
481 if (param<0) {
482 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
483 }
484 else {
485 ctx->Unpack.SkipPixels = param;
486 }
487 break;
489 if (param<0) {
490 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
491 }
492 else {
493 ctx->Unpack.SkipRows = param;
494 }
495 break;
497 if (param==1 || param==2 || param==4 || param==8) {
498 ctx->Unpack.Alignment = param;
499 }
500 else {
501 gl_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
502 }
503 break;
504 default:
505 gl_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
506 }
508}
#define GL_UNPACK_SWAP_BYTES
Definition: gl.h:637
#define GL_PACK_LSB_FIRST
Definition: gl.h:627
#define GL_PACK_ROW_LENGTH
Definition: gl.h:628
#define GL_PACK_ALIGNMENT
Definition: gl.h:626
#define GL_PACK_SKIP_PIXELS
Definition: gl.h:629
#define GL_UNPACK_SKIP_PIXELS
Definition: gl.h:635
#define GL_UNPACK_ALIGNMENT
Definition: gl.h:632
#define GL_PACK_SKIP_ROWS
Definition: gl.h:630
#define GL_PACK_SWAP_BYTES
Definition: gl.h:631
#define GL_UNPACK_SKIP_ROWS
Definition: gl.h:636
#define GL_UNPACK_LSB_FIRST
Definition: gl.h:633
#define GL_UNPACK_ROW_LENGTH
Definition: gl.h:634
GLenum pname
Definition: glext.h:5645
GLfloat param
Definition: glext.h:5796
static void update_drawpixels_state(GLcontext *ctx)
Definition: pixel.c:80

Referenced by init_dlist_pointers(), and init_exec_pointers().

◆ gl_PixelTransferf()

void gl_PixelTransferf ( GLcontext ctx,
GLenum  pname,
GLfloat  param 
)

Definition at line 806 of file pixel.c.

807{
808 if (INSIDE_BEGIN_END(ctx)) {
809 gl_error( ctx, GL_INVALID_OPERATION, "glPixelTransfer" );
810 return;
811 }
812
813 switch (pname) {
814 case GL_MAP_COLOR:
815 ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE;
816 break;
817 case GL_MAP_STENCIL:
818 ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE;
819 break;
820 case GL_INDEX_SHIFT:
821 ctx->Pixel.IndexShift = (GLint) param;
822 break;
823 case GL_INDEX_OFFSET:
824 ctx->Pixel.IndexOffset = (GLint) param;
825 break;
826 case GL_RED_SCALE:
827 ctx->Pixel.RedScale = param;
828 break;
829 case GL_RED_BIAS:
830 ctx->Pixel.RedBias = param;
831 break;
832 case GL_GREEN_SCALE:
833 ctx->Pixel.GreenScale = param;
834 break;
835 case GL_GREEN_BIAS:
836 ctx->Pixel.GreenBias = param;
837 break;
838 case GL_BLUE_SCALE:
839 ctx->Pixel.BlueScale = param;
840 break;
841 case GL_BLUE_BIAS:
842 ctx->Pixel.BlueBias = param;
843 break;
844 case GL_ALPHA_SCALE:
845 ctx->Pixel.AlphaScale = param;
846 break;
847 case GL_ALPHA_BIAS:
848 ctx->Pixel.AlphaBias = param;
849 break;
850 case GL_DEPTH_SCALE:
851 ctx->Pixel.DepthScale = param;
852 break;
853 case GL_DEPTH_BIAS:
854 ctx->Pixel.DepthBias = param;
855 break;
856 default:
857 gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" );
858 return;
859 }
861}
#define GL_INDEX_OFFSET
Definition: gl.h:595
#define GL_DEPTH_BIAS
Definition: gl.h:605
#define GL_DEPTH_SCALE
Definition: gl.h:604
#define GL_MAP_STENCIL
Definition: gl.h:593
#define GL_BLUE_BIAS
Definition: gl.h:601
#define GL_ALPHA_BIAS
Definition: gl.h:603
#define GL_INDEX_SHIFT
Definition: gl.h:594
#define GL_GREEN_SCALE
Definition: gl.h:598
#define GL_RED_BIAS
Definition: gl.h:597
#define GL_GREEN_BIAS
Definition: gl.h:599
#define GL_MAP_COLOR
Definition: gl.h:592
#define GL_ALPHA_SCALE
Definition: gl.h:602
#define GL_BLUE_SCALE
Definition: gl.h:600
#define GL_RED_SCALE
Definition: gl.h:596

Referenced by execute_list(), and init_exec_pointers().

◆ gl_PixelZoom()

void gl_PixelZoom ( GLcontext ctx,
GLfloat  xfactor,
GLfloat  yfactor 
)

Definition at line 112 of file pixel.c.

113{
114 if (INSIDE_BEGIN_END(ctx)) {
115 gl_error( ctx, GL_INVALID_OPERATION, "glPixelZoom" );
116 return;
117 }
118 ctx->Pixel.ZoomX = xfactor;
119 ctx->Pixel.ZoomY = yfactor;
121}

Referenced by execute_list(), and init_exec_pointers().

◆ gl_unpack_pixels()

GLvoid * gl_unpack_pixels ( GLcontext ctx,
GLsizei  width,
GLsizei  height,
GLenum  format,
GLenum  type,
const GLvoid pixels 
)

Definition at line 880 of file pixel.c.

884{
885 GLint s, n;
886
887 s = gl_sizeof_type( type );
888 if (s<0) {
889 gl_error( ctx, GL_INVALID_ENUM, "internal error in gl_unpack(type)" );
890 return NULL;
891 }
892
894 if (n<0) {
895 gl_error( ctx, GL_INVALID_ENUM, "gl_unpack_pixels(format)" );
896 return NULL;
897 }
898
899 if (type==GL_BITMAP) {
900 /* BITMAP data */
901 GLint bytes, i, width_in_bytes;
902 GLubyte *buffer, *dst;
903 GLvoid *src;
904
905 /* Alloc dest storage */
906 bytes = CEILING( width * height , 8 );
907 buffer = (GLubyte *) malloc( bytes );
908 if (!buffer) {
909 return NULL;
910 }
911
912 /* Copy/unpack pixel data to buffer */
913 width_in_bytes = CEILING( width, 8 );
914 dst = buffer;
915 for (i=0;i<height;i++) {
917 format, type, i);
918 if (!src) {
919 free(buffer);
920 return NULL;
921 }
922 MEMCPY( dst, src, width_in_bytes );
923 dst += width_in_bytes;
924 }
925
926 /* Bit flipping */
927 if (ctx->Unpack.LsbFirst) {
929 }
930 return (GLvoid *) buffer;
931 }
932 else {
933 /* Non-BITMAP data */
934 GLint width_in_bytes, bytes, i;
935 GLubyte *buffer, *dst;
936 GLvoid *src;
937
938 width_in_bytes = width * n * s;
939
940 /* Alloc dest storage */
941 bytes = height * width_in_bytes;
942 buffer = (GLubyte *) malloc( bytes );
943 if (!buffer) {
944 return NULL;
945 }
946
947 /* Copy/unpack pixel data to buffer */
948 dst = buffer;
949 for (i=0;i<height;i++) {
951 format, type, i);
952 if (!src) {
953 free(buffer);
954 return NULL;
955 }
956 MEMCPY( dst, src, width_in_bytes );
957 dst += width_in_bytes;
958 }
959
960 /* Byte swapping */
961 if (ctx->Unpack.SwapBytes && s>1) {
962 if (s==2) {
963 gl_swap2( (GLushort *) buffer, bytes/2 );
964 }
965 else if (s==4) {
966 gl_swap4( (GLuint *) buffer, bytes/4 );
967 }
968 }
969 return (GLvoid *) buffer;
970 }
971}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
GLint gl_sizeof_type(GLenum type)
Definition: image.c:163
GLint gl_components_in_format(GLenum format)
Definition: image.c:193
GLvoid * gl_pixel_addr_in_image(struct gl_pixelstore_attrib *packing, const GLvoid *image, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint row)
Definition: image.c:232
void gl_flip_bytes(GLubyte *p, GLuint n)
Definition: image.c:105
void gl_swap4(GLuint *p, GLuint n)
Definition: image.c:141
void gl_swap2(GLushort *p, GLuint n)
Definition: image.c:127
unsigned char GLubyte
Definition: gl.h:157
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
#define GL_BITMAP
Definition: gl.h:497
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLenum GLenum dst
Definition: glext.h:6340
#define CEILING(A, B)
Definition: macros.h:151

Referenced by gl_DrawPixels().

◆ gl_write_zoomed_color_span()

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 at line 136 of file pixel.c.

141{
142 GLint m;
143 GLint r0, r1, row, r;
144 GLint i, j, skipcol;
145 GLubyte zred[MAX_WIDTH], zgreen[MAX_WIDTH]; /* zoomed pixel colors */
146 GLubyte zblue[MAX_WIDTH], zalpha[MAX_WIDTH];
147 GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
148 GLint maxwidth = MIN2( ctx->Buffer->Width, MAX_WIDTH );
149
150 /* compute width of output row */
151 m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
152 if (m==0) {
153 return;
154 }
155 if (ctx->Pixel.ZoomX<0.0) {
156 /* adjust x coordinate for left/right mirroring */
157 x = x - m;
158 }
159
160 /* compute which rows to draw */
161 row = y-y0;
162 r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY);
163 r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY);
164 if (r0==r1) {
165 return;
166 }
167 else if (r1<r0) {
168 GLint rtmp = r1;
169 r1 = r0;
170 r0 = rtmp;
171 }
172
173 /* return early if r0...r1 is above or below window */
174 if (r0<0 && r1<0) {
175 /* below window */
176 return;
177 }
178 if (r0>=ctx->Buffer->Height && r1>=ctx->Buffer->Height) {
179 /* above window */
180 return;
181 }
182
183 /* check if left edge is outside window */
184 skipcol = 0;
185 if (x<0) {
186 skipcol = -x;
187 m += x;
188 }
189 /* make sure span isn't too long or short */
190 if (m>maxwidth) {
191 m = maxwidth;
192 }
193 else if (m<=0) {
194 return;
195 }
196
197 assert( m <= MAX_WIDTH );
198
199 /* zoom the span horizontally */
200 if (ctx->Pixel.ZoomX==-1.0F) {
201 /* n==m */
202 for (j=0;j<m;j++) {
203 i = n - (j+skipcol) - 1;
204 zred[j] = red[i];
205 zgreen[j] = green[i];
206 zblue[j] = blue[i];
207 zalpha[j] = alpha[i];
208 zdepth[j] = z[i];
209 }
210 }
211 else {
212 GLfloat xscale = 1.0F / ctx->Pixel.ZoomX;
213 for (j=0;j<m;j++) {
214 i = (j+skipcol) * xscale;
215 if (i<0) i = n + i - 1;
216 zred[j] = red[i];
217 zgreen[j] = green[i];
218 zblue[j] = blue[i];
219 zalpha[j] = alpha[i];
220 zdepth[j] = z[i];
221 }
222 }
223
224 /* write the span */
225 for (r=r0; r<r1; r++) {
226 gl_write_color_span( ctx, m, x+skipcol, r, zdepth,
227 zred, zgreen, zblue, zalpha, GL_BITMAP );
228 }
229}
#define MAX_WIDTH
Definition: config.h:130
GLint GLdepth
Definition: types.h:218
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
#define assert(x)
Definition: debug.h:53
GLclampf green
Definition: gl.h:1740
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLclampf GLclampf blue
Definition: gl.h:1740
GLdouble GLdouble z
Definition: glext.h:5874
const GLfloat * m
Definition: glext.h:10848
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 y0
Definition: linetemp.h:96
#define red
Definition: linetest.c:67
#define ABSF(X)
Definition: macros.h:141
#define MIN2(A, B)
Definition: macros.h:159
static DNS_RECORDW r1
Definition: record.c:37
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

Referenced by copy_depth_pixels(), copy_rgb_pixels(), draw_color_pixels(), draw_depth_pixels(), and draw_index_pixels().

◆ gl_write_zoomed_index_span()

void gl_write_zoomed_index_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
const GLdepth  z[],
const GLuint  indexes[],
GLint  y0 
)

Definition at line 237 of file pixel.c.

240{
241 GLint m;
242 GLint r0, r1, row, r;
243 GLint i, j, skipcol;
244 GLuint zindexes[MAX_WIDTH]; /* zoomed color indexes */
245 GLdepth zdepth[MAX_WIDTH]; /* zoomed depth values */
246 GLint maxwidth = MIN2( ctx->Buffer->Width, MAX_WIDTH );
247
248 /* compute width of output row */
249 m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
250 if (m==0) {
251 return;
252 }
253 if (ctx->Pixel.ZoomX<0.0) {
254 /* adjust x coordinate for left/right mirroring */
255 x = x - m;
256 }
257
258 /* compute which rows to draw */
259 row = y-y0;
260 r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY);
261 r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY);
262 if (r0==r1) {
263 return;
264 }
265 else if (r1<r0) {
266 GLint rtmp = r1;
267 r1 = r0;
268 r0 = rtmp;
269 }
270
271 /* return early if r0...r1 is above or below window */
272 if (r0<0 && r1<0) {
273 /* below window */
274 return;
275 }
276 if (r0>=ctx->Buffer->Height && r1>=ctx->Buffer->Height) {
277 /* above window */
278 return;
279 }
280
281 /* check if left edge is outside window */
282 skipcol = 0;
283 if (x<0) {
284 skipcol = -x;
285 m += x;
286 }
287 /* make sure span isn't too long or short */
288 if (m>maxwidth) {
289 m = maxwidth;
290 }
291 else if (m<=0) {
292 return;
293 }
294
295 assert( m <= MAX_WIDTH );
296
297 /* zoom the span horizontally */
298 if (ctx->Pixel.ZoomX==-1.0F) {
299 /* n==m */
300 for (j=0;j<m;j++) {
301 i = n - (j+skipcol) - 1;
302 zindexes[j] = indexes[i];
303 zdepth[j] = z[i];
304 }
305 }
306 else {
307 GLfloat xscale = 1.0F / ctx->Pixel.ZoomX;
308 for (j=0;j<m;j++) {
309 i = (j+skipcol) * xscale;
310 if (i<0) i = n + i - 1;
311 zindexes[j] = indexes[i];
312 zdepth[j] = z[i];
313 }
314 }
315
316 /* write the span */
317 for (r=r0; r<r1; r++) {
318 gl_write_index_span( ctx, m, x+skipcol, r, zdepth, zindexes, GL_BITMAP );
319 }
320}
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 copy_ci_pixels(), copy_depth_pixels(), draw_depth_pixels(), and draw_index_pixels().

◆ gl_write_zoomed_stencil_span()

void gl_write_zoomed_stencil_span ( GLcontext ctx,
GLuint  n,
GLint  x,
GLint  y,
const GLubyte  stencil[],
GLint  y0 
)

Definition at line 328 of file pixel.c.

331{
332 GLint m;
333 GLint r0, r1, row, r;
334 GLint i, j, skipcol;
335 GLubyte zstencil[MAX_WIDTH]; /* zoomed stencil values */
336 GLint maxwidth = MIN2( ctx->Buffer->Width, MAX_WIDTH );
337
338 /* compute width of output row */
339 m = (GLint) ABSF( n * ctx->Pixel.ZoomX );
340 if (m==0) {
341 return;
342 }
343 if (ctx->Pixel.ZoomX<0.0) {
344 /* adjust x coordinate for left/right mirroring */
345 x = x - m;
346 }
347
348 /* compute which rows to draw */
349 row = y-y0;
350 r0 = y0 + (GLint) (row * ctx->Pixel.ZoomY);
351 r1 = y0 + (GLint) ((row+1) * ctx->Pixel.ZoomY);
352 if (r0==r1) {
353 return;
354 }
355 else if (r1<r0) {
356 GLint rtmp = r1;
357 r1 = r0;
358 r0 = rtmp;
359 }
360
361 /* return early if r0...r1 is above or below window */
362 if (r0<0 && r1<0) {
363 /* below window */
364 return;
365 }
366 if (r0>=ctx->Buffer->Height && r1>=ctx->Buffer->Height) {
367 /* above window */
368 return;
369 }
370
371 /* check if left edge is outside window */
372 skipcol = 0;
373 if (x<0) {
374 skipcol = -x;
375 m += x;
376 }
377 /* make sure span isn't too long or short */
378 if (m>maxwidth) {
379 m = maxwidth;
380 }
381 else if (m<=0) {
382 return;
383 }
384
385 assert( m <= MAX_WIDTH );
386
387 /* zoom the span horizontally */
388 if (ctx->Pixel.ZoomX==-1.0F) {
389 /* n==m */
390 for (j=0;j<m;j++) {
391 i = n - (j+skipcol) - 1;
392 zstencil[j] = stencil[i];
393 }
394 }
395 else {
396 GLfloat xscale = 1.0F / ctx->Pixel.ZoomX;
397 for (j=0;j<m;j++) {
398 i = (j+skipcol) * xscale;
399 if (i<0) i = n + i - 1;
400 zstencil[j] = stencil[i];
401 }
402 }
403
404 /* write the span */
405 for (r=r0; r<r1; r++) {
406 gl_write_stencil_span( ctx, m, x+skipcol, r, zstencil );
407 }
408}
GLint GLfloat GLint stencil
Definition: glext.h:6260
void gl_write_stencil_span(GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte stencil[])
Definition: stencil.c:957

Referenced by copy_stencil_pixels(), and draw_stencil_pixels().