aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_context.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-12-24 08:54:26 -0700
committerBrian Paul <[email protected]>2011-12-24 08:59:50 -0700
commit242fd9df3b2266402b3f6b20447798fb3bf57d53 (patch)
treead33c46e5e6f0368f57c6c1bb16c52fab56cb76f /src/mesa/swrast/s_context.h
parentd00d39a016893979d9b4ca61f6eaa570ccafb0b5 (diff)
swrast: use _swrast_pixel_address() helper function
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_context.h')
-rw-r--r--src/mesa/swrast/s_context.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index 446b990d990..af9e49ecbb6 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -422,5 +422,17 @@ _swrast_unmap_renderbuffers(struct gl_context *ctx);
#define ATTRIB_LOOP_END } }
+/**
+ * Return the address of a pixel value in a mapped renderbuffer.
+ */
+static inline GLubyte *
+_swrast_pixel_address(struct gl_renderbuffer *rb, GLint x, GLint y)
+{
+ const GLint bpp = _mesa_get_format_bytes(rb->Format);
+ const GLint rowStride = rb->RowStride * bpp;
+ return (GLubyte *) rb->Data + y * rowStride + x * bpp;
+}
+
+
#endif