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/windows/gdi/wmesa.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/windows/gdi') diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index acd5f4a34f..5d7e260c4b 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -29,6 +29,7 @@ //#include "mesa_extend.h" #include "glheader.h" +#include "buffers.h" #include "colors.h" #include "context.h" #include "colormac.h" @@ -614,7 +615,7 @@ static void set_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, /* Return characteristics of the output buffer. */ -static void buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) +static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) { /*GET_CURRENT_CONTEXT(ctx);*/ int New_Size; @@ -658,6 +659,12 @@ static void buffer_size( GLframebuffer *buffer, 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(); +} + /**********************************************************************/ /***** Accelerated point, line, polygon rendering *****/ @@ -1094,7 +1101,8 @@ static void SetFunctionPointers( struct dd_function_table *functions ) functions->GetString = get_string; functions->UpdateState = wmesa_update_state; functions->ResizeBuffers = _swrast_alloc_buffers; - functions->GetBufferSize = buffer_size; + functions->GetBufferSize = get_buffer_size; + functions->Viewport = viewport; functions->Clear = clear; @@ -1491,12 +1499,6 @@ void WMesaMakeCurrent( WMesaContext c ) Current = c; wmesa_update_state(c->gl_ctx, 0); _mesa_make_current(c->gl_ctx, c->gl_buffer); - if (Current->gl_ctx->Viewport.Width==0) { - /* initialize viewport to window size */ - _mesa_Viewport( 0, 0, Current->width, Current->height ); - Current->gl_ctx->Scissor.Width = Current->width; - Current->gl_ctx->Scissor.Height = Current->height; - } if ((c->cColorBits <= 8 ) && (c->rgb_flag == GL_TRUE)){ WMesaPaletteChange(c->hPalHalfTone); } -- cgit v1.2.3