summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 11:28:15 -0700
committerBrian Paul <[email protected]>2012-01-24 14:12:20 -0700
commitcb5fa9ea624574909bf57f9e1ad190a440d59dc2 (patch)
tree3e76db417a669bd095aaf4ddccaeba17a66c67c7 /src/mesa
parent2873555a76a7358db053c3a7b121b489f8df9bb1 (diff)
dri/swrast: remove obsolete GetRow/PutRow code
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_priv.h10
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_span.c347
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_spantemp.h223
4 files changed, 0 insertions, 582 deletions
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 90a96381ede..e7f121ecf7c 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -335,11 +335,9 @@ swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
xrb->Base.Delete = swrast_delete_renderbuffer;
if (front) {
xrb->Base.AllocStorage = swrast_alloc_front_storage;
- swrast_set_span_funcs_front(xrb, pixel_format);
}
else {
xrb->Base.AllocStorage = swrast_alloc_back_storage;
- swrast_set_span_funcs_back(xrb, pixel_format);
}
switch (pixel_format) {
diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h
index b57012aefdf..8695d4b9ee4 100644
--- a/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -130,14 +130,4 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
-/* swrast_span.c */
-
-extern void
-swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
- GLuint pixel_format);
-
-extern void
-swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
- GLuint pixel_format);
-
#endif /* _SWRAST_PRIV_H_ */
diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c
deleted file mode 100644
index ba6174f9d78..00000000000
--- a/src/mesa/drivers/dri/swrast/swrast_span.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright 2008, 2010 George Sapountzis <[email protected]>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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.
- */
-
-#include "swrast_priv.h"
-
-#define YFLIP(_xrb, Y) ((_xrb)->Base.Height - (Y) - 1)
-
-/*
- * Dithering support takes the "computation" extreme in the "computation vs.
- * storage" trade-off. This approach is very simple to implement and any
- * computational overhead should be acceptable. XMesa uses table lookups for
- * around 8KB of storage overhead per visual.
- */
-#define DITHER 1
-
-static const GLubyte kernel[16] = {
- 0*16, 8*16, 2*16, 10*16,
- 12*16, 4*16, 14*16, 6*16,
- 3*16, 11*16, 1*16, 9*16,
- 15*16, 7*16, 13*16, 5*16,
-};
-
-#if DITHER
-#define DITHER_COMP(X, Y) kernel[((X) & 0x3) | (((Y) & 0x3) << 2)]
-
-#define DITHER_CLAMP(X) (((X) < 255) ? (X) : 255)
-#else
-#define DITHER_COMP(X, Y) 0
-
-#define DITHER_CLAMP(X) (X)
-#endif
-
-
-/*
- * Pixel macros shared across front/back buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) \
- *DST = VALUE[ACOMP] << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define FETCH_PIXEL_A8R8G8B8(DST, SRC) \
- DST[ACOMP] = *SRC >> 24; \
- DST[RCOMP] = (*SRC >> 16) & 0xff; \
- DST[GCOMP] = (*SRC >> 8) & 0xff; \
- DST[BCOMP] = *SRC & 0xff
-
-
-/* 32-bit BGRX */
-#define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \
- *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP]
-#define FETCH_PIXEL_X8R8G8B8(DST, SRC) \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = (*SRC >> 16) & 0xff; \
- DST[GCOMP] = (*SRC >> 8) & 0xff; \
- DST[BCOMP] = *SRC & 0xff
-
-
-/* 16-bit BGR */
-#define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \
- do { \
- int d = DITHER_COMP(X, Y) >> 6; \
- *DST = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \
- ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \
- ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \
- } while(0)
-#define FETCH_PIXEL_R5G6B5(DST, SRC) \
- do { \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = ((*SRC >> 8) & 0xf8) * 255 / 0xf8; \
- DST[GCOMP] = ((*SRC >> 3) & 0xfc) * 255 / 0xfc; \
- DST[BCOMP] = ((*SRC << 3) & 0xf8) * 255 / 0xf8; \
- } while(0)
-
-
-/* 8-bit BGR */
-#define STORE_PIXEL_R3G3B2(DST, X, Y, VALUE) \
- do { \
- int d = DITHER_COMP(X, Y) >> 3; \
- GLubyte *p = (GLubyte *)DST; \
- *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xe0) >> 5) | \
- ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xe0) >> 2) | \
- ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xc0) >> 0) ); \
- } while(0)
-#define FETCH_PIXEL_R3G3B2(DST, SRC) \
- do { \
- GLubyte p = *(GLubyte *)SRC; \
- DST[ACOMP] = 0xff; \
- DST[RCOMP] = ((p << 5) & 0xe0) * 255 / 0xe0; \
- DST[GCOMP] = ((p << 2) & 0xe0) * 255 / 0xe0; \
- DST[BCOMP] = ((p << 0) & 0xc0) * 255 / 0xc0; \
- } while(0)
-
-
-/*
- * Generate code for back-buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define NAME(FUNC) FUNC##_A8R8G8B8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X)
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_A8R8G8B8(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 32-bit BGRX */
-#define NAME(FUNC) FUNC##_X8R8G8B8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X);
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_X8R8G8B8(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 16-bit BGR */
-#define NAME(FUNC) FUNC##_R5G6B5
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 2 + (X);
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R5G6B5(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/* 8-bit BGR */
-#define NAME(FUNC) FUNC##_R3G3B2
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 1;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R3G3B2(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R3G3B2(DST, SRC)
-
-#include "swrast/s_spantemp.h"
-
-
-/*
- * Generate code for front-buffer span functions.
- */
-
-/* 32-bit BGRA */
-#define NAME(FUNC) FUNC##_A8R8G8B8_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_A8R8G8B8(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 32-bit BGRX */
-#define NAME(FUNC) FUNC##_X8R8G8B8_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE)
-#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \
- STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_X8R8G8B8(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 16-bit BGR */
-#define NAME(FUNC) FUNC##_R5G6B5_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *)row;
-#define INC_PIXEL_PTR(P) P++
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R5G6B5(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R5G6B5(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/* 8-bit BGR */
-#define NAME(FUNC) FUNC##_R3G3B2_front
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = (GLubyte *)row;
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(DST, X, Y, VALUE) \
- STORE_PIXEL_R3G3B2(DST, X, Y, VALUE)
-#define FETCH_PIXEL(DST, SRC) \
- FETCH_PIXEL_R3G3B2(DST, SRC)
-
-#include "swrast_spantemp.h"
-
-
-/*
- * Back-buffers are malloced memory and always private.
- *
- * BACK_PIXMAP (not supported)
- * BACK_XIMAGE
- */
-void
-swrast_set_span_funcs_back(struct swrast_renderbuffer *xrb,
- GLuint pixel_format)
-{
- switch (pixel_format) {
- case PF_A8R8G8B8:
- xrb->Base.GetRow = get_row_A8R8G8B8;
- xrb->Base.GetValues = get_values_A8R8G8B8;
- xrb->Base.PutRow = put_row_A8R8G8B8;
- xrb->Base.PutValues = put_values_A8R8G8B8;
- break;
- case PF_X8R8G8B8:
- xrb->Base.GetRow = get_row_X8R8G8B8;
- xrb->Base.GetValues = get_values_X8R8G8B8;
- xrb->Base.PutRow = put_row_X8R8G8B8;
- xrb->Base.PutValues = put_values_X8R8G8B8;
- break;
- case PF_R5G6B5:
- xrb->Base.GetRow = get_row_R5G6B5;
- xrb->Base.GetValues = get_values_R5G6B5;
- xrb->Base.PutRow = put_row_R5G6B5;
- xrb->Base.PutValues = put_values_R5G6B5;
- break;
- case PF_R3G3B2:
- xrb->Base.GetRow = get_row_R3G3B2;
- xrb->Base.GetValues = get_values_R3G3B2;
- xrb->Base.PutRow = put_row_R3G3B2;
- xrb->Base.PutValues = put_values_R3G3B2;
- break;
- default:
- assert(0);
- return;
- }
-}
-
-
-/*
- * Front-buffers are provided by the loader, the xorg loader uses pixmaps.
- *
- * WINDOW, An X window
- * GLXWINDOW, GLX window
- * PIXMAP, GLX pixmap
- * PBUFFER GLX Pbuffer
- */
-void
-swrast_set_span_funcs_front(struct swrast_renderbuffer *xrb,
- GLuint pixel_format)
-{
- switch (pixel_format) {
- case PF_A8R8G8B8:
- xrb->Base.GetRow = get_row_A8R8G8B8_front;
- xrb->Base.GetValues = get_values_A8R8G8B8_front;
- xrb->Base.PutRow = put_row_A8R8G8B8_front;
- xrb->Base.PutValues = put_values_A8R8G8B8_front;
- break;
- case PF_X8R8G8B8:
- xrb->Base.GetRow = get_row_X8R8G8B8_front;
- xrb->Base.GetValues = get_values_X8R8G8B8_front;
- xrb->Base.PutRow = put_row_X8R8G8B8_front;
- xrb->Base.PutValues = put_values_X8R8G8B8_front;
- break;
- case PF_R5G6B5:
- xrb->Base.GetRow = get_row_R5G6B5_front;
- xrb->Base.GetValues = get_values_R5G6B5_front;
- xrb->Base.PutRow = put_row_R5G6B5_front;
- xrb->Base.PutValues = put_values_R5G6B5_front;
- break;
- case PF_R3G3B2:
- xrb->Base.GetRow = get_row_R3G3B2_front;
- xrb->Base.GetValues = get_values_R3G3B2_front;
- xrb->Base.PutRow = put_row_R3G3B2_front;
- xrb->Base.PutValues = put_values_R3G3B2_front;
- break;
- default:
- assert(0);
- return;
- }
-}
diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h
deleted file mode 100644
index 50671193e21..00000000000
--- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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.
- */
-
-
-/*
- * Modified version of swrast/s_spantemp.h for front-buffer rendering. The
- * no-mask paths use a scratch row to avoid repeated calls to the loader.
- *
- * For the mask paths we always use an array of 4 elements of RB_TYPE. This is
- * to satisfy the xorg loader requirement of an image pitch of 32 bits and
- * should be ok for other loaders also.
- */
-
-
-#ifndef _SWRAST_SPANTEMP_ONCE
-#define _SWRAST_SPANTEMP_ONCE
-
-static INLINE void
-PUT_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLvoid *p )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW,
- x, y, 1, 1, (char *)p,
- draw->loaderPrivate);
-}
-
-
-static INLINE void
-GET_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLubyte *p )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->getImage(read, x, y, 1, 1, (char *)p,
- read->loaderPrivate);
-}
-
-static INLINE void
-PUT_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->putImage(draw, __DRI_SWRAST_IMAGE_OP_DRAW,
- x, y, n, 1, row,
- draw->loaderPrivate);
-}
-
-static INLINE void
-GET_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
-{
- __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
-
- __DRIscreen *screen = ctx->driScreenPriv;
-
- screen->swrast_loader->getImage(read, x, y, n, 1, row,
- read->loaderPrivate);
-}
-
-#endif /* _SWRAST_SPANTEMP_ONCE */
-
-
-/*
- * Templates for the span/pixel-array write/read functions called via
- * the gl_renderbuffer's GetRow, GetValues, PutRow and PutValues.
- *
- * Define the following macros before including this file:
- * NAME(BASE) to generate the function name (i.e. add prefix or suffix)
- * RB_TYPE the renderbuffer DataType
- * SPAN_VARS to declare any local variables
- * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel
- * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel
- * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer
- * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer
- *
- * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates
- * for the pixels to be stored. This is useful when dithering and probably
- * ignored otherwise.
- */
-
-#include "main/macros.h"
-
-
-#if !defined(RB_COMPONENTS)
-#define RB_COMPONENTS 4
-#endif
-
-
-static void
-NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, GLint x, GLint y, void *values )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- char *row = swrast_drawable(ctx->ReadBuffer)->row;
- INIT_PIXEL_PTR(pixel, x, y);
- GET_ROW( ctx, x, YFLIP(xrb, y), count, row );
- for (i = 0; i < count; i++) {
- FETCH_PIXEL(dest[i], pixel);
- INC_PIXEL_PTR(pixel);
- }
- (void) rb;
-}
-
-
-static void
-NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[], void *values )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- RB_TYPE (*dest)[RB_COMPONENTS] = (RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- for (i = 0; i < count; i++) {
- RB_TYPE pixel[4];
- GET_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
- FETCH_PIXEL(dest[i], pixel);
- }
- (void) rb;
-}
-
-
-static void
-NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, GLint x, GLint y,
- const void *values, const GLubyte mask[] )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- if (mask) {
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- RB_TYPE row[4];
- INIT_PIXEL_PTR(pixel, x, y);
- STORE_PIXEL(pixel, x + i, y, src[i]);
- PUT_PIXEL(ctx, x + i, YFLIP(xrb, y), pixel);
- }
- }
- }
- else {
- char *row = swrast_drawable(ctx->DrawBuffer)->row;
- INIT_PIXEL_PTR(pixel, x, y);
- for (i = 0; i < count; i++) {
- STORE_PIXEL(pixel, x + i, y, src[i]);
- INC_PIXEL_PTR(pixel);
- }
- PUT_ROW( ctx, x, YFLIP(xrb, y), count, row );
- }
- (void) rb;
-}
-
-
-static void
-NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLuint count, const GLint x[], const GLint y[],
- const void *values, const GLubyte mask[] )
-{
-#ifdef SPAN_VARS
- SPAN_VARS
-#endif
- const RB_TYPE (*src)[RB_COMPONENTS] = (const RB_TYPE (*)[RB_COMPONENTS]) values;
- GLuint i;
- ASSERT(mask);
- for (i = 0; i < count; i++) {
- if (mask[i]) {
- RB_TYPE row[4];
- INIT_PIXEL_PTR(pixel, x, y);
- STORE_PIXEL(pixel, x[i], y[i], src[i]);
- PUT_PIXEL(ctx, x[i], YFLIP(xrb, y[i]), pixel);
- }
- }
- (void) rb;
-}
-
-
-
-
-#undef NAME
-#undef RB_TYPE
-#undef RB_COMPONENTS
-#undef SPAN_VARS
-#undef INIT_PIXEL_PTR
-#undef INC_PIXEL_PTR
-#undef STORE_PIXEL
-#undef STORE_PIXEL_RGB
-#undef FETCH_PIXEL