summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-04-27 21:17:20 +0000
committerBrian Paul <[email protected]>2001-04-27 21:17:20 +0000
commit75978bd85ea86b4e0a4153d623eaf1d40976f49b (patch)
tree54411fe4f5dcea2fd028311a8ddc8ac61847efc4 /src/mesa/main
parent4dbd625eaf4a2abd0772b1acb0da17ac0c646f3c (diff)
added _mesa_free_framebuffer_data()
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.c66
-rw-r--r--src/mesa/main/context.h5
2 files changed, 47 insertions, 24 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 2d39b526897..87a9749d588 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.133 2001/04/25 18:21:05 brianp Exp $ */
+/* $Id: context.c,v 1.134 2001/04/27 21:17:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -361,7 +361,7 @@ _mesa_initialize_framebuffer( GLframebuffer *buffer,
assert(visual->alphaBits > 0);
}
- buffer->Visual = *visual; /* XXX copy instead? */
+ buffer->Visual = *visual;
buffer->UseSoftwareDepthBuffer = softwareDepth;
buffer->UseSoftwareStencilBuffer = softwareStencil;
buffer->UseSoftwareAccumBuffer = softwareAccum;
@@ -376,32 +376,52 @@ void
_mesa_destroy_framebuffer( GLframebuffer *buffer )
{
if (buffer) {
- if (buffer->DepthBuffer) {
- FREE( buffer->DepthBuffer );
- }
- if (buffer->Accum) {
- FREE( buffer->Accum );
- }
- if (buffer->Stencil) {
- FREE( buffer->Stencil );
- }
- if (buffer->FrontLeftAlpha) {
- FREE( buffer->FrontLeftAlpha );
- }
- if (buffer->BackLeftAlpha) {
- FREE( buffer->BackLeftAlpha );
- }
- if (buffer->FrontRightAlpha) {
- FREE( buffer->FrontRightAlpha );
- }
- if (buffer->BackRightAlpha) {
- FREE( buffer->BackRightAlpha );
- }
+ _mesa_free_framebuffer_data(buffer);
FREE(buffer);
}
}
+/*
+ * Free the data hanging off of <buffer>, but not <buffer> itself.
+ */
+void
+_mesa_free_framebuffer_data( GLframebuffer *buffer )
+{
+ if (!buffer)
+ return;
+
+ if (buffer->DepthBuffer) {
+ FREE( buffer->DepthBuffer );
+ buffer->DepthBuffer = NULL;
+ }
+ if (buffer->Accum) {
+ FREE( buffer->Accum );
+ buffer->Accum = NULL;
+ }
+ if (buffer->Stencil) {
+ FREE( buffer->Stencil );
+ buffer->Stencil = NULL;
+ }
+ if (buffer->FrontLeftAlpha) {
+ FREE( buffer->FrontLeftAlpha );
+ buffer->FrontLeftAlpha = NULL;
+ }
+ if (buffer->BackLeftAlpha) {
+ FREE( buffer->BackLeftAlpha );
+ buffer->BackLeftAlpha = NULL;
+ }
+ if (buffer->FrontRightAlpha) {
+ FREE( buffer->FrontRightAlpha );
+ buffer->FrontRightAlpha = NULL;
+ }
+ if (buffer->BackRightAlpha) {
+ FREE( buffer->BackRightAlpha );
+ buffer->BackRightAlpha = NULL;
+ }
+}
+
+
/**********************************************************************/
/***** Context allocation, initialization, destroying *****/
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index e4e5c5f1c20..825881b8704 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -1,4 +1,4 @@
-/* $Id: context.h,v 1.25 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: context.h,v 1.26 2001/04/27 21:17:20 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -118,6 +118,9 @@ _mesa_initialize_framebuffer( GLframebuffer *fb,
GLboolean softwareAlpha );
extern void
+_mesa_free_framebuffer_data( GLframebuffer *buffer );
+
+extern void
_mesa_destroy_framebuffer( GLframebuffer *buffer );