summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 13:05:41 -0700
committerIan Romanick <[email protected]>2012-01-27 18:02:41 -0800
commiteca54b1eb442abec1d42a81171dc7da15f691627 (patch)
treeeb377f7499b32d30f5768aeb8160fb030a554894 /src/mesa/swrast
parent8e5cf4cb45b2a2cc989530d17933228ec86cfe1a (diff)
swrast: remove a few extra _mesa_get_format_bytes() calls
(cherry picked from commit 6c1e27ba219e41ae2641cca0d3c67462bdba8631)
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_renderbuffer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index f0dbb012bdf..378e3a7e39a 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -58,6 +58,7 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint width, GLuint height)
{
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
+ GLuint bpp;
switch (internalFormat) {
case GL_RGB:
@@ -115,25 +116,26 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
return GL_FALSE;
}
+ bpp = _mesa_get_format_bytes(rb->Format);
+
/* free old buffer storage */
if (srb->Buffer) {
free(srb->Buffer);
srb->Buffer = NULL;
}
- srb->RowStride = width * _mesa_get_format_bytes(rb->Format);
+ srb->RowStride = width * bpp;
if (width > 0 && height > 0) {
/* allocate new buffer storage */
- srb->Buffer = malloc(width * height
- * _mesa_get_format_bytes(rb->Format));
+ srb->Buffer = malloc(srb->RowStride * height);
if (srb->Buffer == NULL) {
rb->Width = 0;
rb->Height = 0;
_mesa_error(ctx, GL_OUT_OF_MEMORY,
"software renderbuffer allocation (%d x %d x %d)",
- width, height, _mesa_get_format_bytes(rb->Format));
+ width, height, bpp);
return GL_FALSE;
}
}