/*
* Mesa 3-D graphics library
- * Version: 7.1
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
* Pixel transfer functions (glPixelZoom, glPixelMap, glPixelTransfer)
*/
+#include "c99_math.h"
#include "glheader.h"
#include "bufferobj.h"
-#include "colormac.h"
#include "context.h"
#include "macros.h"
#include "pixel.h"
#include "pbo.h"
#include "mtypes.h"
-#include "main/dispatch.h"
/**********************************************************************/
/* special case */
ctx->PixelMaps.StoS.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->PixelMaps.StoS.Map[i] = (GLfloat)IROUND(values[i]);
+ ctx->PixelMaps.StoS.Map[i] = roundf(values[i]);
}
break;
case GL_PIXEL_MAP_I_TO_I:
/* restore */
_mesa_reference_buffer_object(ctx,
- &ctx->DefaultPacking.BufferObj,
- ctx->Shared->NullBufferObj);
+ &ctx->DefaultPacking.BufferObj, NULL);
if (!ok) {
- if (_mesa_is_bufferobj(pack->BufferObj)) {
+ if (pack->BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"gl[Get]PixelMap*v(out of bounds PBO access)");
} else {
if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
/* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
+ if (!util_is_power_of_two_or_zero(mapsize)) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" );
return;
}
values = (const GLfloat *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
+ if (ctx->Unpack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glPixelMapfv(PBO is mapped)");
}
if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
/* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
+ if (!util_is_power_of_two_or_zero(mapsize)) {
_mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
return;
}
values = (const GLuint *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
+ if (ctx->Unpack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glPixelMapuiv(PBO is mapped)");
}
if (map >= GL_PIXEL_MAP_S_TO_S && map <= GL_PIXEL_MAP_I_TO_A) {
/* test that mapsize is a power of two */
- if (!_mesa_is_pow_two(mapsize)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapuiv(mapsize)" );
+ if (!util_is_power_of_two_or_zero(mapsize)) {
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPixelMapusv(mapsize)" );
return;
}
}
values = (const GLushort *) _mesa_map_pbo_source(ctx, &ctx->Unpack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Unpack.BufferObj)) {
+ if (ctx->Unpack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glPixelMapusv(PBO is mapped)");
}
values = (GLfloat *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetPixelMapfv(PBO is mapped)");
}
values = (GLuint *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetPixelMapuiv(PBO is mapped)");
}
values = (GLushort *) _mesa_map_pbo_dest(ctx, &ctx->Pack, values);
if (!values) {
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetPixelMapusv(PBO is mapped)");
}
/* special cases */
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0F, 65535.0F);
}
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0F, 65535.0F);
}
break;
default:
/***** State Management *****/
/**********************************************************************/
-/*
- * Return a bitmask of IMAGE_*_BIT flags which to indicate which
- * pixel transfer operations are enabled.
+
+/**
+ * Update mesa pixel transfer derived state to indicate which operations are
+ * enabled.
*/
-static void
-update_image_transfer_state(struct gl_context *ctx)
+void
+_mesa_update_pixel( struct gl_context *ctx )
{
GLuint mask = 0;
}
-/**
- * Update mesa pixel transfer derived state.
- */
-void _mesa_update_pixel( struct gl_context *ctx, GLuint new_state )
-{
- if (new_state & _NEW_PIXEL)
- update_image_transfer_state(ctx);
-}
-
-
/**********************************************************************/
/***** Initialization *****/
/**********************************************************************/