From 65a66f5bc37383c00423c21baf8ba9d6771e0259 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 27 Nov 2004 22:47:59 +0000 Subject: Remove _mesa_ResizeBuffersMESA() call from _mesa_set_viewport(). Now, the driver's Viewport routine should call _mesa_ResizeBuffersMESA() if necessary. Cleaned up code related to GLframebuffer width/height initialization. Set initial viewport/scissor params in _mesa_make_current2(), instead of in the drivers' MakeCurrent functions. --- src/mesa/drivers/allegro/amesa.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/allegro') diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index 92fd1b7068..cb46efa56a 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -21,6 +21,7 @@ #include #include #include +#include "buffers.h" #include "context.h" #include "imports.h" #include "matrix.h" @@ -144,6 +145,13 @@ static void get_buffer_size(GLcontext *ctx, GLuint *width, GLuint *height) } +static void viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + /* poll for window size change and realloc software Z/stencil/etc if needed */ + _mesa_ResizeBuffersMESA(); +} + + /**********************************************************************/ /**********************************************************************/ @@ -155,8 +163,9 @@ static void setup_dd_pointers(GLcontext *ctx) /* a new context is made current or we change buffers via set_buffer! */ ctx->Driver.UpdateState = setup_dd_pointers; - ctx->Driver.SetBuffer = set_buffer; - ctx->Driver.GetBufferSize = get_buffer_size; + ctx->Driver.SetBuffer = set_buffer; + ctx->Driver.GetBufferSize = get_buffer_size; + ctx->Driver.Viewport = viewport; ctx->Driver.Color = set_color_generic; ctx->Driver.ClearColor = clear_color_generic; @@ -371,9 +380,9 @@ GLboolean AMesaMakeCurrent(AMesaContext context, AMesaBuffer buffer) setup_dd_pointers(context->GLContext); _mesa_make_current(context->GLContext, buffer->GLBuffer); - _mesa_set_viewport(context->GLContext, 0, 0, buffer->Width, buffer->Height); } else { + /* XXX I don't think you want to destroy anything here! */ destroy_bitmap(context->Buffer->Screen); context->Buffer->Screen = NULL; context->Buffer->Active = NULL; -- cgit v1.2.3