aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_stencil.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast/s_stencil.c')
-rw-r--r--mesalib/src/mesa/swrast/s_stencil.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c
index fb95ef14d..bbfbf44cc 100644
--- a/mesalib/src/mesa/swrast/s_stencil.c
+++ b/mesalib/src/mesa/swrast/s_stencil.c
@@ -292,12 +292,13 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
GLubyte stencil[])
{
+ struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
const GLint w = rb->Width, h = rb->Height;
- const GLubyte *map = (const GLubyte *) rb->Data;
+ const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
if (rb->Format == MESA_FORMAT_S8) {
- const GLint rowStride = rb->RowStride;
+ const GLint rowStride = srb->RowStride;
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
stencil[i] = *(map + y[i] * rowStride + x[i]);
@@ -306,7 +307,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
else {
const GLint bpp = _mesa_get_format_bytes(rb->Format);
- const GLint rowStride = rb->RowStride * bpp;
+ const GLint rowStride = srb->RowStride;
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
const GLubyte *src = map + y[i] * rowStride + x[i] * bpp;
@@ -326,12 +327,14 @@ put_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLubyte stencil[])
{
const GLint w = rb->Width, h = rb->Height;
+ gl_pack_ubyte_stencil_func pack_stencil =
+ _mesa_get_pack_ubyte_stencil_func(rb->Format);
GLuint i;
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
GLubyte *dst = _swrast_pixel_address(rb, x[i], y[i]);
- _mesa_pack_ubyte_stencil_row(rb->Format, 1, &stencil[i], dst);
+ pack_stencil(&stencil[i], dst);
}
}
}