#include "glxclient.h"
#include "indirect.h"
+#include "util/rounding.h"
-#if !defined __GNUC__ || __GNUC__ < 3
+#if !defined(__GNUC__)
# define __builtin_expect(x, y) x
#endif
* \sa __indirect_glPixelStorei, __indirect_glPixelStoref
*/
static void
-send_PixelStore(__GLXcontext * gc, unsigned sop, GLenum pname,
+send_PixelStore(struct glx_context * gc, unsigned sop, GLenum pname,
const void *param)
{
Display *const dpy = gc->currentDpy;
void
__indirect_glPixelStoref(GLenum pname, GLfloat param)
{
- __GLXcontext *gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = gc->client_state_private;
Display *dpy = gc->currentDpy;
GLuint a;
switch (pname) {
case GL_PACK_ROW_LENGTH:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storePack.rowLength = a;
break;
case GL_PACK_IMAGE_HEIGHT:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storePack.imageHeight = a;
break;
case GL_PACK_SKIP_ROWS:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storePack.skipRows = a;
break;
case GL_PACK_SKIP_PIXELS:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storePack.skipPixels = a;
break;
case GL_PACK_SKIP_IMAGES:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storePack.skipImages = a;
break;
case GL_PACK_ALIGNMENT:
- a = (GLint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
switch (a) {
case 1:
case 2:
break;
case GL_UNPACK_ROW_LENGTH:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storeUnpack.rowLength = a;
break;
case GL_UNPACK_IMAGE_HEIGHT:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storeUnpack.imageHeight = a;
break;
case GL_UNPACK_SKIP_ROWS:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storeUnpack.skipRows = a;
break;
case GL_UNPACK_SKIP_PIXELS:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storeUnpack.skipPixels = a;
break;
case GL_UNPACK_SKIP_IMAGES:
- a = (GLuint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
if (((GLint) a) < 0) {
__glXSetError(gc, GL_INVALID_VALUE);
return;
state->storeUnpack.skipImages = a;
break;
case GL_UNPACK_ALIGNMENT:
- a = (GLint) (param + 0.5);
+ a = _mesa_lroundevenf(param);
switch (a) {
case 1:
case 2:
void
__indirect_glPixelStorei(GLenum pname, GLint param)
{
- __GLXcontext *gc = __glXGetCurrentContext();
+ struct glx_context *gc = __glXGetCurrentContext();
__GLXattribute *state = gc->client_state_private;
Display *dpy = gc->currentDpy;