ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

pixelstore.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.1
00004  *
00005  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00031 #include "glheader.h"
00032 #include "bufferobj.h"
00033 #include "colormac.h"
00034 #include "context.h"
00035 #include "image.h"
00036 #include "macros.h"
00037 #include "pixelstore.h"
00038 #include "mtypes.h"
00039 
00040 
00041 void GLAPIENTRY
00042 _mesa_PixelStorei( GLenum pname, GLint param )
00043 {
00044    /* NOTE: this call can't be compiled into the display list */
00045    GET_CURRENT_CONTEXT(ctx);
00046    ASSERT_OUTSIDE_BEGIN_END(ctx);
00047 
00048    switch (pname) {
00049       case GL_PACK_SWAP_BYTES:
00050      if (param == (GLint)ctx->Pack.SwapBytes)
00051         return;
00052      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00053          ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE;
00054      break;
00055       case GL_PACK_LSB_FIRST:
00056      if (param == (GLint)ctx->Pack.LsbFirst)
00057         return;
00058      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00059          ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE;
00060      break;
00061       case GL_PACK_ROW_LENGTH:
00062      if (param<0) {
00063         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00064         return;
00065      }
00066      if (ctx->Pack.RowLength == param)
00067         return;
00068      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00069      ctx->Pack.RowLength = param;
00070      break;
00071       case GL_PACK_IMAGE_HEIGHT:
00072          if (param<0) {
00073             _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00074         return;
00075      }
00076      if (ctx->Pack.ImageHeight == param)
00077         return;
00078      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00079      ctx->Pack.ImageHeight = param;
00080          break;
00081       case GL_PACK_SKIP_PIXELS:
00082      if (param<0) {
00083         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00084         return;
00085      }
00086      if (ctx->Pack.SkipPixels == param)
00087         return;
00088      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00089      ctx->Pack.SkipPixels = param;
00090      break;
00091       case GL_PACK_SKIP_ROWS:
00092      if (param<0) {
00093         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00094         return;
00095      }
00096      if (ctx->Pack.SkipRows == param)
00097         return;
00098      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00099      ctx->Pack.SkipRows = param;
00100      break;
00101       case GL_PACK_SKIP_IMAGES:
00102      if (param<0) {
00103         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00104         return;
00105      }
00106      if (ctx->Pack.SkipImages == param)
00107         return;
00108      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00109      ctx->Pack.SkipImages = param;
00110      break;
00111       case GL_PACK_ALIGNMENT:
00112          if (param!=1 && param!=2 && param!=4 && param!=8) {
00113         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00114         return;
00115      }
00116      if (ctx->Pack.Alignment == param)
00117         return;
00118      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00119      ctx->Pack.Alignment = param;
00120      break;
00121       case GL_PACK_INVERT_MESA:
00122          if (!ctx->Extensions.MESA_pack_invert) {
00123             _mesa_error( ctx, GL_INVALID_ENUM, "glPixelstore(pname)" );
00124             return;
00125          }
00126          if (ctx->Pack.Invert == param)
00127             return;
00128          FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00129          ctx->Pack.Invert = param;
00130          break;
00131 
00132       case GL_UNPACK_SWAP_BYTES:
00133      if (param == (GLint)ctx->Unpack.SwapBytes)
00134         return;
00135      if ((GLint)ctx->Unpack.SwapBytes == param)
00136         return;
00137      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00138      ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE;
00139          break;
00140       case GL_UNPACK_LSB_FIRST:
00141      if (param == (GLint)ctx->Unpack.LsbFirst)
00142         return;
00143      if ((GLint)ctx->Unpack.LsbFirst == param)
00144         return;
00145      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00146      ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE;
00147      break;
00148       case GL_UNPACK_ROW_LENGTH:
00149      if (param<0) {
00150         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00151         return;
00152      }
00153      if (ctx->Unpack.RowLength == param)
00154         return;
00155      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00156      ctx->Unpack.RowLength = param;
00157      break;
00158       case GL_UNPACK_IMAGE_HEIGHT:
00159          if (param<0) {
00160             _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00161         return;
00162      }
00163      if (ctx->Unpack.ImageHeight == param)
00164         return;
00165 
00166      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00167      ctx->Unpack.ImageHeight = param;
00168          break;
00169       case GL_UNPACK_SKIP_PIXELS:
00170      if (param<0) {
00171         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00172         return;
00173      }
00174      if (ctx->Unpack.SkipPixels == param)
00175         return;
00176      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00177      ctx->Unpack.SkipPixels = param;
00178      break;
00179       case GL_UNPACK_SKIP_ROWS:
00180      if (param<0) {
00181         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00182         return;
00183      }
00184      if (ctx->Unpack.SkipRows == param)
00185         return;
00186      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00187      ctx->Unpack.SkipRows = param;
00188      break;
00189       case GL_UNPACK_SKIP_IMAGES:
00190      if (param < 0) {
00191         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" );
00192         return;
00193      }
00194      if (ctx->Unpack.SkipImages == param)
00195         return;
00196      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00197      ctx->Unpack.SkipImages = param;
00198      break;
00199       case GL_UNPACK_ALIGNMENT:
00200          if (param!=1 && param!=2 && param!=4 && param!=8) {
00201         _mesa_error( ctx, GL_INVALID_VALUE, "glPixelStore" );
00202         return;
00203      }
00204      if (ctx->Unpack.Alignment == param)
00205         return;
00206      FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00207      ctx->Unpack.Alignment = param;
00208      break;
00209       case GL_UNPACK_CLIENT_STORAGE_APPLE:
00210          if (param == (GLint)ctx->Unpack.ClientStorage)
00211             return;
00212          FLUSH_VERTICES(ctx, _NEW_PACKUNPACK);
00213          ctx->Unpack.ClientStorage = param ? GL_TRUE : GL_FALSE;
00214          break;
00215       default:
00216      _mesa_error( ctx, GL_INVALID_ENUM, "glPixelStore" );
00217      return;
00218    }
00219 }
00220 
00221 
00222 void GLAPIENTRY
00223 _mesa_PixelStoref( GLenum pname, GLfloat param )
00224 {
00225    _mesa_PixelStorei( pname, (GLint) param );
00226 }
00227 
00228 
00229 
00233 void
00234 _mesa_init_pixelstore( GLcontext *ctx )
00235 {
00236    /* Pixel transfer */
00237    ctx->Pack.Alignment = 4;
00238    ctx->Pack.RowLength = 0;
00239    ctx->Pack.ImageHeight = 0;
00240    ctx->Pack.SkipPixels = 0;
00241    ctx->Pack.SkipRows = 0;
00242    ctx->Pack.SkipImages = 0;
00243    ctx->Pack.SwapBytes = GL_FALSE;
00244    ctx->Pack.LsbFirst = GL_FALSE;
00245    ctx->Pack.ClientStorage = GL_FALSE;
00246    ctx->Pack.Invert = GL_FALSE;
00247 #if FEATURE_EXT_pixel_buffer_object
00248    ctx->Pack.BufferObj = ctx->Array.NullBufferObj;
00249 #endif
00250    ctx->Unpack.Alignment = 4;
00251    ctx->Unpack.RowLength = 0;
00252    ctx->Unpack.ImageHeight = 0;
00253    ctx->Unpack.SkipPixels = 0;
00254    ctx->Unpack.SkipRows = 0;
00255    ctx->Unpack.SkipImages = 0;
00256    ctx->Unpack.SwapBytes = GL_FALSE;
00257    ctx->Unpack.LsbFirst = GL_FALSE;
00258    ctx->Unpack.ClientStorage = GL_FALSE;
00259    ctx->Unpack.Invert = GL_FALSE;
00260 #if FEATURE_EXT_pixel_buffer_object
00261    ctx->Unpack.BufferObj = ctx->Array.NullBufferObj;
00262 #endif
00263 
00264    /*
00265     * _mesa_unpack_image() returns image data in this format.  When we
00266     * execute image commands (glDrawPixels(), glTexImage(), etc) from
00267     * within display lists we have to be sure to set the current
00268     * unpacking parameters to these values!
00269     */
00270    ctx->DefaultPacking.Alignment = 1;
00271    ctx->DefaultPacking.RowLength = 0;
00272    ctx->DefaultPacking.SkipPixels = 0;
00273    ctx->DefaultPacking.SkipRows = 0;
00274    ctx->DefaultPacking.ImageHeight = 0;
00275    ctx->DefaultPacking.SkipImages = 0;
00276    ctx->DefaultPacking.SwapBytes = GL_FALSE;
00277    ctx->DefaultPacking.LsbFirst = GL_FALSE;
00278    ctx->DefaultPacking.ClientStorage = GL_FALSE;
00279    ctx->DefaultPacking.Invert = GL_FALSE;
00280 #if FEATURE_EXT_pixel_buffer_object
00281    ctx->DefaultPacking.BufferObj = ctx->Array.NullBufferObj;
00282 #endif
00283 }

Generated on Sat May 26 2012 04:19:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.