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

rbadaptors.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.5.3
00004  *
00005  * Copyright (C) 1999-2007  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 
00035 #include "glheader.h"
00036 #include "mtypes.h"
00037 #include "colormac.h"
00038 #include "renderbuffer.h"
00039 #include "rbadaptors.h"
00040 
00041 
00042 static void
00043 Delete_wrapper(struct gl_renderbuffer *rb)
00044 {
00045    /* Decrement reference count on the buffer we're wrapping and delete
00046     * it if refcount hits zero.
00047     */
00048    _mesa_reference_renderbuffer(&rb->Wrapped, NULL);
00049 
00050    /* delete myself */
00051    _mesa_delete_renderbuffer(rb);
00052 }
00053 
00054 
00055 static GLboolean
00056 AllocStorage_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb,
00057                      GLenum internalFormat, GLuint width, GLuint height)
00058 {
00059    GLboolean b = rb->Wrapped->AllocStorage(ctx, rb->Wrapped, internalFormat,
00060                                            width, height);
00061    if (b) {
00062       rb->Width = width;
00063       rb->Height = height;
00064    }
00065    return b;
00066 }
00067 
00068 
00069 static void *
00070 GetPointer_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb,
00071                    GLint x, GLint y)
00072 {
00073    (void) ctx;
00074    (void) rb;
00075    (void) x;
00076    (void) y;
00077    return NULL;
00078 }
00079 
00080 
00081 static void
00082 GetRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00083                GLint x, GLint y, void *values)
00084 {
00085    GLubyte values8[MAX_WIDTH * 4];
00086    GLushort *values16 = (GLushort *) values;
00087    GLuint i;
00088    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00089    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00090    ASSERT(count <= MAX_WIDTH);
00091 
00092    /* get 8bpp values */
00093    rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8);
00094 
00095    /* convert 8bpp to 16bpp */
00096    for (i = 0; i < 4 * count; i++) {
00097       values16[i] = (values8[i] << 8) | values8[i];
00098    }
00099 }
00100 
00101 
00102 static void
00103 GetValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00104                   const GLint x[], const GLint y[], void *values)
00105 {
00106    GLubyte values8[MAX_WIDTH * 4];
00107    GLushort *values16 = (GLushort *) values;
00108    GLuint i;
00109    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00110    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00111 
00112    rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8);
00113 
00114    for (i = 0; i < 4 * count; i++) {
00115       values16[i] = (values8[i] << 8) | values8[i];
00116    }
00117 }
00118 
00119 
00120 static void
00121 PutRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00122                GLint x, GLint y, const void *values, const GLubyte *mask)
00123 {
00124    GLubyte values8[MAX_WIDTH * 4];
00125    GLushort *values16 = (GLushort *) values;
00126    GLuint i;
00127    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00128    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00129    for (i = 0; i < 4 * count; i++) {
00130       values8[i] = values16[i] >> 8;
00131    }
00132    rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask);
00133 }
00134 
00135 
00136 static void
00137 PutRowRGB_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00138                   GLint x, GLint y, const void *values, const GLubyte *mask)
00139 {
00140    GLubyte values8[MAX_WIDTH * 3];
00141    GLushort *values16 = (GLushort *) values;
00142    GLuint i;
00143    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00144    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00145    for (i = 0; i < 3 * count; i++) {
00146       values8[i] = values16[i] >> 8;
00147    }
00148    rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask);
00149 }
00150 
00151 
00152 static void
00153 PutMonoRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00154                    GLint x, GLint y, const void *value, const GLubyte *mask)
00155 {
00156    GLubyte value8[4];
00157    GLushort *value16 = (GLushort *) value;
00158    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00159    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00160    value8[0] = value16[0] >> 8;
00161    value8[1] = value16[1] >> 8;
00162    value8[2] = value16[2] >> 8;
00163    value8[3] = value16[3] >> 8;
00164    rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask);
00165 }
00166 
00167 
00168 static void
00169 PutValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00170                   const GLint x[], const GLint y[], const void *values,
00171                   const GLubyte *mask)
00172 {
00173    GLubyte values8[MAX_WIDTH * 4];
00174    GLushort *values16 = (GLushort *) values;
00175    GLuint i;
00176    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00177    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00178    for (i = 0; i < 4 * count; i++) {
00179       values8[i] = values16[i] >> 8;
00180    }
00181    rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask);
00182 }
00183 
00184 
00185 static void
00186 PutMonoValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb,
00187                       GLuint count, const GLint x[], const GLint y[],
00188                       const void *value, const GLubyte *mask)
00189 {
00190    GLubyte value8[4];
00191    GLushort *value16 = (GLushort *) value;
00192    ASSERT(rb->DataType == GL_UNSIGNED_SHORT);
00193    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00194    value8[0] = value16[0] >> 8;
00195    value8[1] = value16[1] >> 8;
00196    value8[2] = value16[2] >> 8;
00197    value8[3] = value16[3] >> 8;
00198    rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask);
00199 }
00200 
00201 
00206 struct gl_renderbuffer *
00207 _mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
00208 {
00209    struct gl_renderbuffer *rb16;
00210 
00211    rb16 = _mesa_new_renderbuffer(ctx, rb8->Name);
00212    if (rb16) {
00213       ASSERT(rb8->DataType == GL_UNSIGNED_BYTE);
00214       ASSERT(rb8->_BaseFormat == GL_RGBA);
00215 
00216       _glthread_LOCK_MUTEX(rb8->Mutex);
00217       rb8->RefCount++;
00218       _glthread_UNLOCK_MUTEX(rb8->Mutex);
00219 
00220       rb16->InternalFormat = rb8->InternalFormat;
00221       rb16->_ActualFormat = rb8->_ActualFormat;
00222       rb16->_BaseFormat = rb8->_BaseFormat;
00223       rb16->DataType = GL_UNSIGNED_SHORT;
00224       /* Note: passing through underlying bits/channel */
00225       rb16->RedBits = rb8->RedBits;
00226       rb16->GreenBits = rb8->GreenBits;
00227       rb16->BlueBits = rb8->BlueBits;
00228       rb16->AlphaBits = rb8->AlphaBits;
00229       rb16->Wrapped = rb8;
00230 
00231       rb16->AllocStorage = AllocStorage_wrapper;
00232       rb16->Delete = Delete_wrapper;
00233       rb16->GetPointer = GetPointer_wrapper;
00234       rb16->GetRow = GetRow_16wrap8;
00235       rb16->GetValues = GetValues_16wrap8;
00236       rb16->PutRow = PutRow_16wrap8;
00237       rb16->PutRowRGB = PutRowRGB_16wrap8;
00238       rb16->PutMonoRow = PutMonoRow_16wrap8;
00239       rb16->PutValues = PutValues_16wrap8;
00240       rb16->PutMonoValues = PutMonoValues_16wrap8;
00241    }
00242    return rb16;
00243 }
00244 
00245 
00246 
00247 
00248 static void
00249 GetRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00250                GLint x, GLint y, void *values)
00251 {
00252    GLubyte values8[MAX_WIDTH * 4];
00253    GLfloat *values32 = (GLfloat *) values;
00254    GLuint i;
00255    ASSERT(rb->DataType == GL_FLOAT);
00256    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00257    ASSERT(count <= MAX_WIDTH);
00258 
00259    /* get 8bpp values */
00260    rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8);
00261 
00262    /* convert 8bpp to 32bpp */
00263    for (i = 0; i < 4 * count; i++) {
00264       values32[i] = UBYTE_TO_FLOAT(values8[i]);
00265    }
00266 }
00267 
00268 
00269 static void
00270 GetValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00271                   const GLint x[], const GLint y[], void *values)
00272 {
00273    GLubyte values8[MAX_WIDTH * 4];
00274    GLfloat *values32 = (GLfloat *) values;
00275    GLuint i;
00276    ASSERT(rb->DataType == GL_FLOAT);
00277    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00278 
00279    rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8);
00280 
00281    for (i = 0; i < 4 * count; i++) {
00282       values32[i] = UBYTE_TO_FLOAT(values8[i]);
00283    }
00284 }
00285 
00286 
00287 static void
00288 PutRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00289                GLint x, GLint y, const void *values, const GLubyte *mask)
00290 {
00291    GLubyte values8[MAX_WIDTH * 4];
00292    GLfloat *values32 = (GLfloat *) values;
00293    GLuint i;
00294    ASSERT(rb->DataType == GL_FLOAT);
00295    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00296    for (i = 0; i < 4 * count; i++) {
00297       UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
00298    }
00299    rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask);
00300 }
00301 
00302 
00303 static void
00304 PutRowRGB_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00305                   GLint x, GLint y, const void *values, const GLubyte *mask)
00306 {
00307    GLubyte values8[MAX_WIDTH * 3];
00308    GLfloat *values32 = (GLfloat *) values;
00309    GLuint i;
00310    ASSERT(rb->DataType == GL_FLOAT);
00311    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00312    for (i = 0; i < 3 * count; i++) {
00313       UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
00314    }
00315    rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask);
00316 }
00317 
00318 
00319 static void
00320 PutMonoRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00321                    GLint x, GLint y, const void *value, const GLubyte *mask)
00322 {
00323    GLubyte value8[4];
00324    GLfloat *value32 = (GLfloat *) value;
00325    ASSERT(rb->DataType == GL_FLOAT);
00326    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00327    UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]);
00328    UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]);
00329    UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]);
00330    UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]);
00331    rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask);
00332 }
00333 
00334 
00335 static void
00336 PutValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00337                   const GLint x[], const GLint y[], const void *values,
00338                   const GLubyte *mask)
00339 {
00340    GLubyte values8[MAX_WIDTH * 4];
00341    GLfloat *values32 = (GLfloat *) values;
00342    GLuint i;
00343    ASSERT(rb->DataType == GL_FLOAT);
00344    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00345    for (i = 0; i < 4 * count; i++) {
00346       UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]);
00347    }
00348    rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask);
00349 }
00350 
00351 
00352 static void
00353 PutMonoValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb,
00354                       GLuint count, const GLint x[], const GLint y[],
00355                       const void *value, const GLubyte *mask)
00356 {
00357    GLubyte value8[4];
00358    GLfloat *value32 = (GLfloat *) value;
00359    ASSERT(rb->DataType == GL_FLOAT);
00360    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE);
00361    UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]);
00362    UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]);
00363    UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]);
00364    UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]);
00365    rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask);
00366 }
00367 
00368 
00373 struct gl_renderbuffer *
00374 _mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8)
00375 {
00376    struct gl_renderbuffer *rb32;
00377 
00378    rb32 = _mesa_new_renderbuffer(ctx, rb8->Name);
00379    if (rb32) {
00380       ASSERT(rb8->DataType == GL_UNSIGNED_BYTE);
00381       ASSERT(rb8->_BaseFormat == GL_RGBA);
00382 
00383       _glthread_LOCK_MUTEX(rb8->Mutex);
00384       rb8->RefCount++;
00385       _glthread_UNLOCK_MUTEX(rb8->Mutex);
00386 
00387       rb32->InternalFormat = rb8->InternalFormat;
00388       rb32->_ActualFormat = rb8->_ActualFormat;
00389       rb32->_BaseFormat = rb8->_BaseFormat;
00390       rb32->DataType = GL_FLOAT;
00391       /* Note: passing through underlying bits/channel */
00392       rb32->RedBits = rb8->RedBits;
00393       rb32->GreenBits = rb8->GreenBits;
00394       rb32->BlueBits = rb8->BlueBits;
00395       rb32->AlphaBits = rb8->AlphaBits;
00396       rb32->Wrapped = rb8;
00397 
00398       rb32->AllocStorage = AllocStorage_wrapper;
00399       rb32->Delete = Delete_wrapper;
00400       rb32->GetPointer = GetPointer_wrapper;
00401       rb32->GetRow = GetRow_32wrap8;
00402       rb32->GetValues = GetValues_32wrap8;
00403       rb32->PutRow = PutRow_32wrap8;
00404       rb32->PutRowRGB = PutRowRGB_32wrap8;
00405       rb32->PutMonoRow = PutMonoRow_32wrap8;
00406       rb32->PutValues = PutValues_32wrap8;
00407       rb32->PutMonoValues = PutMonoValues_32wrap8;
00408    }
00409    return rb32;
00410 }
00411 
00412 
00413 
00414 
00415 static void
00416 GetRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00417                 GLint x, GLint y, void *values)
00418 {
00419    GLushort values16[MAX_WIDTH * 4];
00420    GLfloat *values32 = (GLfloat *) values;
00421    GLuint i;
00422    ASSERT(rb->DataType == GL_FLOAT);
00423    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00424    ASSERT(count <= MAX_WIDTH);
00425 
00426    /* get 16bpp values */
00427    rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values16);
00428 
00429    /* convert 16bpp to 32bpp */
00430    for (i = 0; i < 4 * count; i++) {
00431       values32[i] = USHORT_TO_FLOAT(values16[i]);
00432    }
00433 }
00434 
00435 
00436 static void
00437 GetValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00438                    const GLint x[], const GLint y[], void *values)
00439 {
00440    GLushort values16[MAX_WIDTH * 4];
00441    GLfloat *values32 = (GLfloat *) values;
00442    GLuint i;
00443    ASSERT(rb->DataType == GL_FLOAT);
00444    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00445 
00446    rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values16);
00447 
00448    for (i = 0; i < 4 * count; i++) {
00449       values32[i] = USHORT_TO_FLOAT(values16[i]);
00450    }
00451 }
00452 
00453 
00454 static void
00455 PutRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00456                 GLint x, GLint y, const void *values, const GLubyte *mask)
00457 {
00458    GLushort values16[MAX_WIDTH * 4];
00459    GLfloat *values32 = (GLfloat *) values;
00460    GLuint i;
00461    ASSERT(rb->DataType == GL_FLOAT);
00462    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00463    for (i = 0; i < 4 * count; i++) {
00464       UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
00465    }
00466    rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values16, mask);
00467 }
00468 
00469 
00470 static void
00471 PutRowRGB_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00472                    GLint x, GLint y, const void *values, const GLubyte *mask)
00473 {
00474    GLushort values16[MAX_WIDTH * 3];
00475    GLfloat *values32 = (GLfloat *) values;
00476    GLuint i;
00477    ASSERT(rb->DataType == GL_FLOAT);
00478    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00479    for (i = 0; i < 3 * count; i++) {
00480       UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
00481    }
00482    rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values16, mask);
00483 }
00484 
00485 
00486 static void
00487 PutMonoRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00488                     GLint x, GLint y, const void *value, const GLubyte *mask)
00489 {
00490    GLushort value16[4];
00491    GLfloat *value32 = (GLfloat *) value;
00492    ASSERT(rb->DataType == GL_FLOAT);
00493    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00494    UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]);
00495    UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]);
00496    UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]);
00497    UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]);
00498    rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value16, mask);
00499 }
00500 
00501 
00502 static void
00503 PutValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
00504                    const GLint x[], const GLint y[], const void *values,
00505                    const GLubyte *mask)
00506 {
00507    GLushort values16[MAX_WIDTH * 4];
00508    GLfloat *values32 = (GLfloat *) values;
00509    GLuint i;
00510    ASSERT(rb->DataType == GL_FLOAT);
00511    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00512    for (i = 0; i < 4 * count; i++) {
00513       UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]);
00514    }
00515    rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values16, mask);
00516 }
00517 
00518 
00519 static void
00520 PutMonoValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb,
00521                        GLuint count, const GLint x[], const GLint y[],
00522                        const void *value, const GLubyte *mask)
00523 {
00524    GLushort value16[4];
00525    GLfloat *value32 = (GLfloat *) value;
00526    ASSERT(rb->DataType == GL_FLOAT);
00527    ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT);
00528    UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]);
00529    UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]);
00530    UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]);
00531    UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]);
00532    rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value16, mask);
00533 }
00534 
00535 
00540 struct gl_renderbuffer *
00541 _mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16)
00542 {
00543    struct gl_renderbuffer *rb32;
00544 
00545    rb32 = _mesa_new_renderbuffer(ctx, rb16->Name);
00546    if (rb32) {
00547       ASSERT(rb16->DataType == GL_UNSIGNED_SHORT);
00548       ASSERT(rb16->_BaseFormat == GL_RGBA);
00549 
00550       _glthread_LOCK_MUTEX(rb16->Mutex);
00551       rb16->RefCount++;
00552       _glthread_UNLOCK_MUTEX(rb16->Mutex);
00553 
00554       rb32->InternalFormat = rb16->InternalFormat;
00555       rb32->_ActualFormat = rb16->_ActualFormat;
00556       rb32->_BaseFormat = rb16->_BaseFormat;
00557       rb32->DataType = GL_FLOAT;
00558       /* Note: passing through underlying bits/channel */
00559       rb32->RedBits = rb16->RedBits;
00560       rb32->GreenBits = rb16->GreenBits;
00561       rb32->BlueBits = rb16->BlueBits;
00562       rb32->AlphaBits = rb16->AlphaBits;
00563       rb32->Wrapped = rb16;
00564 
00565       rb32->AllocStorage = AllocStorage_wrapper;
00566       rb32->Delete = Delete_wrapper;
00567       rb32->GetPointer = GetPointer_wrapper;
00568       rb32->GetRow = GetRow_32wrap16;
00569       rb32->GetValues = GetValues_32wrap16;
00570       rb32->PutRow = PutRow_32wrap16;
00571       rb32->PutRowRGB = PutRowRGB_32wrap16;
00572       rb32->PutMonoRow = PutMonoRow_32wrap16;
00573       rb32->PutValues = PutValues_32wrap16;
00574       rb32->PutMonoValues = PutMonoValues_32wrap16;
00575    }
00576    return rb32;
00577 }

Generated on Sun May 27 2012 04:20:26 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.