Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygens_spantemp.h
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 6.5.1 00004 * 00005 * Copyright (C) 1999-2006 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 00025 00026 /* 00027 * Templates for the span/pixel-array write/read functions called via 00028 * the gl_renderbuffer's GetRow, GetValues, PutRow, PutMonoRow, PutValues 00029 * and PutMonoValues functions. 00030 * 00031 * Define the following macros before including this file: 00032 * NAME(BASE) to generate the function name (i.e. add prefix or suffix) 00033 * RB_TYPE the renderbuffer DataType 00034 * CI_MODE if set, color index mode, else RGBA 00035 * SPAN_VARS to declare any local variables 00036 * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel 00037 * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel 00038 * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer 00039 * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer 00040 * 00041 * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates 00042 * for the pixels to be stored. This is useful when dithering and probably 00043 * ignored otherwise. 00044 */ 00045 00046 #include "main/macros.h" 00047 00048 00049 #ifdef CI_MODE 00050 #define RB_COMPONENTS 1 00051 #elif !defined(RB_COMPONENTS) 00052 #define RB_COMPONENTS 4 00053 #endif 00054 00055 00056 static void 00057 NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, 00058 GLuint count, GLint x, GLint y, void *values ) 00059 { 00060 #ifdef SPAN_VARS 00061 SPAN_VARS 00062 #endif 00063 #ifdef CI_MODE 00064 RB_TYPE *dest = (RB_TYPE *) values; 00065 #else 00066 RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values; 00067 #endif 00068 GLuint i; 00069 INIT_PIXEL_PTR(pixel, x, y); 00070 for (i = 0; i < count; i++) { 00071 FETCH_PIXEL(dest[i], pixel); 00072 INC_PIXEL_PTR(pixel); 00073 } 00074 (void) rb; 00075 } 00076 00077 00078 static void 00079 NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, 00080 GLuint count, const GLint x[], const GLint y[], void *values ) 00081 { 00082 #ifdef SPAN_VARS 00083 SPAN_VARS 00084 #endif 00085 #ifdef CI_MODE 00086 RB_TYPE *dest = (RB_TYPE *) values; 00087 #else 00088 RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values; 00089 #endif 00090 GLuint i; 00091 for (i = 0; i < count; i++) { 00092 INIT_PIXEL_PTR(pixel, x[i], y[i]); 00093 FETCH_PIXEL(dest[i], pixel); 00094 } 00095 (void) rb; 00096 } 00097 00098 00099 static void 00100 NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, 00101 GLuint count, GLint x, GLint y, 00102 const void *values, const GLubyte mask[] ) 00103 { 00104 #ifdef SPAN_VARS 00105 SPAN_VARS 00106 #endif 00107 const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values; 00108 GLuint i; 00109 INIT_PIXEL_PTR(pixel, x, y); 00110 if (mask) { 00111 for (i = 0; i < count; i++) { 00112 if (mask[i]) { 00113 STORE_PIXEL(pixel, x + i, y, src[i]); 00114 } 00115 INC_PIXEL_PTR(pixel); 00116 } 00117 } 00118 else { 00119 for (i = 0; i < count; i++) { 00120 STORE_PIXEL(pixel, x + i, y, src[i]); 00121 INC_PIXEL_PTR(pixel); 00122 } 00123 } 00124 (void) rb; 00125 } 00126 00127 00128 #if !defined(CI_MODE) 00129 static void 00130 NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb, 00131 GLuint count, GLint x, GLint y, 00132 const void *values, const GLubyte mask[] ) 00133 { 00134 #ifdef SPAN_VARS 00135 SPAN_VARS 00136 #endif 00137 const RB_TYPE (*src)[3] = (const RB_TYPE (*)[3]) values; 00138 GLuint i; 00139 INIT_PIXEL_PTR(pixel, x, y); 00140 for (i = 0; i < count; i++) { 00141 if (!mask || mask[i]) { 00142 #ifdef STORE_PIXEL_RGB 00143 STORE_PIXEL_RGB(pixel, x + i, y, src[i]); 00144 #else 00145 STORE_PIXEL(pixel, x + i, y, src[i]); 00146 #endif 00147 } 00148 INC_PIXEL_PTR(pixel); 00149 } 00150 (void) rb; 00151 } 00152 #endif 00153 00154 00155 static void 00156 NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, 00157 GLuint count, GLint x, GLint y, 00158 const void *value, const GLubyte mask[] ) 00159 { 00160 #ifdef SPAN_VARS 00161 SPAN_VARS 00162 #endif 00163 const RB_TYPE *src = (const RB_TYPE *) value; 00164 GLuint i; 00165 INIT_PIXEL_PTR(pixel, x, y); 00166 if (mask) { 00167 for (i = 0; i < count; i++) { 00168 if (mask[i]) { 00169 STORE_PIXEL(pixel, x + i, y, src); 00170 } 00171 INC_PIXEL_PTR(pixel); 00172 } 00173 } 00174 else { 00175 for (i = 0; i < count; i++) { 00176 STORE_PIXEL(pixel, x + i, y, src); 00177 INC_PIXEL_PTR(pixel); 00178 } 00179 } 00180 (void) rb; 00181 } 00182 00183 00184 static void 00185 NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, 00186 GLuint count, const GLint x[], const GLint y[], 00187 const void *values, const GLubyte mask[] ) 00188 { 00189 #ifdef SPAN_VARS 00190 SPAN_VARS 00191 #endif 00192 const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values; 00193 GLuint i; 00194 ASSERT(mask); 00195 for (i = 0; i < count; i++) { 00196 if (mask[i]) { 00197 INIT_PIXEL_PTR(pixel, x[i], y[i]); 00198 STORE_PIXEL(pixel, x[i], y[i], src[i]); 00199 } 00200 } 00201 (void) rb; 00202 } 00203 00204 00205 static void 00206 NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, 00207 GLuint count, const GLint x[], const GLint y[], 00208 const void *value, const GLubyte mask[] ) 00209 { 00210 #ifdef SPAN_VARS 00211 SPAN_VARS 00212 #endif 00213 const RB_TYPE *src = (const RB_TYPE *) value; 00214 GLuint i; 00215 ASSERT(mask); 00216 for (i = 0; i < count; i++) { 00217 if (mask[i]) { 00218 INIT_PIXEL_PTR(pixel, x[i], y[i]); 00219 STORE_PIXEL(pixel, x[i], y[i], src); 00220 } 00221 } 00222 (void) rb; 00223 } 00224 00225 00226 #undef NAME 00227 #undef RB_TYPE 00228 #undef RB_COMPONENTS 00229 #undef CI_MODE 00230 #undef SPAN_VARS 00231 #undef INIT_PIXEL_PTR 00232 #undef INC_PIXEL_PTR 00233 #undef STORE_PIXEL 00234 #undef STORE_PIXEL_RGB 00235 #undef FETCH_PIXEL Generated on Thu May 24 2012 04:20:56 for ReactOS by
1.7.6.1
|