ReactOS  0.4.12-dev-712-ge6be187
bitmap.h File Reference
#include "types.h"
Include dependency graph for bitmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct gl_imagegl_unpack_bitmap (GLcontext *ctx, GLsizei width, GLsizei height, const GLubyte *bitmap)
 
void gl_render_bitmap (GLcontext *ctx, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const struct gl_image *bitmap)
 
void gl_Bitmap (GLcontext *ctx, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const struct gl_image *bitmap)
 

Function Documentation

◆ gl_Bitmap()

void gl_Bitmap ( GLcontext ctx,
GLsizei  width,
GLsizei  height,
GLfloat  xorig,
GLfloat  yorig,
GLfloat  xmove,
GLfloat  ymove,
const struct gl_image bitmap 
)

Definition at line 161 of file bitmap.c.

166 {
167  if (width<0 || height<0) {
168  gl_error( ctx, GL_INVALID_VALUE, "glBitmap" );
169  return;
170  }
171  if (INSIDE_BEGIN_END(ctx)) {
172  gl_error( ctx, GL_INVALID_OPERATION, "glBitmap" );
173  return;
174  }
175  if (ctx->Current.RasterPosValid==GL_FALSE) {
176  /* do nothing */
177  return;
178  }
179 
180  if (ctx->RenderMode==GL_RENDER) {
181  GLboolean completed = GL_FALSE;
182  if (ctx->Driver.Bitmap) {
183  /* let device driver try to render the bitmap */
184  completed = (*ctx->Driver.Bitmap)( ctx, width, height, xorig, yorig,
185  xmove, ymove, bitmap );
186  }
187  if (!completed) {
188  /* use generic function */
189  gl_render_bitmap( ctx, width, height, xorig, yorig,
190  xmove, ymove, bitmap );
191  }
192  }
193  else if (ctx->RenderMode==GL_FEEDBACK) {
194  GLfloat color[4], texcoord[4], invq;
195  color[0] = ctx->Current.ByteColor[0] * ctx->Visual->InvRedScale;
196  color[1] = ctx->Current.ByteColor[1] * ctx->Visual->InvGreenScale;
197  color[2] = ctx->Current.ByteColor[2] * ctx->Visual->InvBlueScale;
198  color[3] = ctx->Current.ByteColor[3] * ctx->Visual->InvAlphaScale;
199  invq = 1.0F / ctx->Current.TexCoord[3];
200  texcoord[0] = ctx->Current.TexCoord[0] * invq;
201  texcoord[1] = ctx->Current.TexCoord[1] * invq;
202  texcoord[2] = ctx->Current.TexCoord[2] * invq;
203  texcoord[3] = ctx->Current.TexCoord[3];
205  /* TODO: Verify XYZW values are correct: */
206  gl_feedback_vertex( ctx, ctx->Current.RasterPos[0] - xorig,
207  ctx->Current.RasterPos[1] - yorig,
208  ctx->Current.RasterPos[2],
209  ctx->Current.RasterPos[3],
210  color, ctx->Current.Index, texcoord );
211  }
212  else if (ctx->RenderMode==GL_SELECT) {
213  /* Bitmaps don't generate selection hits. See appendix B of 1.1 spec. */
214  }
215 
216  /* update raster position */
217  ctx->Current.RasterPos[0] += xmove;
218  ctx->Current.RasterPos[1] += ymove;
219 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define GL_FALSE
Definition: gl.h:173
struct gl_current_attrib Current
Definition: types.h:1320
GLvisual * Visual
Definition: types.h:1272
#define FEEDBACK_TOKEN(CTX, T)
Definition: feedback.h:39
#define INSIDE_BEGIN_END(CTX)
Definition: macros.h:135
struct dd_function_table Driver
Definition: types.h:1276
GLuint color
Definition: glext.h:6243
unsigned char GLboolean
Definition: gl.h:151
GLenum RenderMode
Definition: types.h:1356
Definition: uimain.c:88
void gl_render_bitmap(GLcontext *ctx, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const struct gl_image *bitmap)
Definition: bitmap.c:90
GLfloat InvRedScale
Definition: types.h:1148
#define GL_INVALID_VALUE
Definition: gl.h:695
#define GL_INVALID_OPERATION
Definition: gl.h:696
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void gl_error(GLcontext *ctx, GLenum error, const char *s)
Definition: context.c:1421
#define GL_SELECT
Definition: gl.h:389
#define GL_BITMAP_TOKEN
Definition: gl.h:401
#define GL_FEEDBACK
Definition: gl.h:387
GLfloat InvBlueScale
Definition: types.h:1150
float GLfloat
Definition: gl.h:161
GLfloat InvGreenScale
Definition: types.h:1149
int GLint
Definition: gl.h:156
#define GL_RENDER
Definition: gl.h:388
GLfloat InvAlphaScale
Definition: types.h:1151
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

Referenced by execute_list(), and init_exec_pointers().

◆ gl_render_bitmap()

void gl_render_bitmap ( GLcontext ctx,
GLsizei  width,
GLsizei  height,
GLfloat  xorig,
GLfloat  yorig,
GLfloat  xmove,
GLfloat  ymove,
const struct gl_image bitmap 
)

Definition at line 90 of file bitmap.c.

95 {
96  struct pixel_buffer *PB = ctx->PB;
97  GLint bx, by; /* bitmap position */
98  GLint px, py, pz; /* pixel position */
99  GLubyte *ptr;
100 
101  assert(bitmap);
102  assert(bitmap->Type == GL_BITMAP);
103  assert(bitmap->Format == GL_COLOR_INDEX);
104 
105  if (ctx->NewState) {
106  gl_update_state(ctx);
107  PB_INIT( PB, GL_BITMAP );
108  }
109 
110  if (ctx->Visual->RGBAflag) {
111  GLint r, g, b, a;
112  r = (GLint) (ctx->Current.RasterColor[0] * ctx->Visual->RedScale);
113  g = (GLint) (ctx->Current.RasterColor[1] * ctx->Visual->GreenScale);
114  b = (GLint) (ctx->Current.RasterColor[2] * ctx->Visual->BlueScale);
115  a = (GLint) (ctx->Current.RasterColor[3] * ctx->Visual->AlphaScale);
116  PB_SET_COLOR( ctx, PB, r, g, b, a );
117  }
118  else {
119  PB_SET_INDEX( ctx, PB, ctx->Current.RasterIndex );
120  }
121 
122  px = (GLint) ( (ctx->Current.RasterPos[0] - xorig) + 0.0F );
123  py = (GLint) ( (ctx->Current.RasterPos[1] - yorig) + 0.0F );
124  pz = (GLint) ( ctx->Current.RasterPos[2] * DEPTH_SCALE );
125  ptr = (GLubyte *) bitmap->Data;
126 
127  for (by=0;by<height;by++) {
128  GLubyte bitmask;
129 
130  /* do a row */
131  bitmask = 128;
132  for (bx=0;bx<width;bx++) {
133  if (*ptr&bitmask) {
134  PB_WRITE_PIXEL( PB, px+bx, py+by, pz );
135  }
136  bitmask = bitmask >> 1;
137  if (bitmask==0) {
138  ptr++;
139  bitmask = 128;
140  }
141  }
142 
143  PB_CHECK_FLUSH( ctx, PB )
144 
145  /* get ready for next row */
146  if (bitmask!=128) ptr++;
147  }
148 
149  gl_flush_pb(ctx);
150 }
GLint GLint GLsizei width
Definition: gl.h:1546
void gl_flush_pb(GLcontext *ctx)
Definition: pb.c:136
#define GL_BITMAP
Definition: gl.h:497
GLuint NewState
Definition: types.h:1355
unsigned char GLubyte
Definition: gl.h:157
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define PB_INIT(PB, PRIM)
Definition: pb.h:79
GLboolean RGBAflag
Definition: types.h:1137
struct pixel_buffer * PB
Definition: types.h:1383
#define assert(x)
Definition: debug.h:53
struct gl_current_attrib Current
Definition: types.h:1320
GLvisual * Visual
Definition: types.h:1272
#define a
Definition: ke_i.h:78
static PVOID ptr
Definition: dispmode.c:27
GLfloat AlphaScale
Definition: types.h:1143
GLfloat BlueScale
Definition: types.h:1142
#define b
Definition: ke_i.h:79
GLfloat GreenScale
Definition: types.h:1141
#define PB_CHECK_FLUSH(CTX, PB)
Definition: pb.h:167
Definition: uimain.c:88
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define for
Definition: utility.h:88
#define PB
#define PB_SET_COLOR(CTX, PB, R, G, B, A)
Definition: pb.h:89
#define PB_WRITE_PIXEL(PB, X, Y, Z)
Definition: pb.h:116
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
void gl_update_state(GLcontext *ctx)
Definition: context.c:1749
#define GL_COLOR_INDEX
Definition: gl.h:479
GLfloat RedScale
Definition: types.h:1140
#define PB_SET_INDEX(CTX, PB, I)
Definition: pb.h:105
GLbyte by
Definition: glext.h:8766
int GLint
Definition: gl.h:156
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define DEPTH_SCALE
Definition: config.h:146

Referenced by gl_Bitmap().

◆ gl_unpack_bitmap()

struct gl_image* gl_unpack_bitmap ( GLcontext ctx,
GLsizei  width,
GLsizei  height,
const GLubyte bitmap 
)

Definition at line 76 of file bitmap.c.

79 {
80  return gl_unpack_image( ctx, width, height,
82 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define GL_BITMAP
Definition: gl.h:497
Definition: uimain.c:88
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
struct gl_image * gl_unpack_image(GLcontext *ctx, GLint width, GLint height, GLenum srcFormat, GLenum srcType, const GLvoid *pixels)
Definition: image.c:314
#define GL_COLOR_INDEX
Definition: gl.h:479

Referenced by _mesa_Bitmap().