aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-02-06 17:22:16 +0000
committerBrian Paul <[email protected]>2001-02-06 17:22:16 +0000
commit16461f7c53f3bd88ec20458edfc247df14cde721 (patch)
treea1d3fff35dbaac6f954c6ce5d3e219b1747001be /src
parentd1baa05439c7157eeca42ec191d5375821725bdd (diff)
added _mesa_adjust_image_for_convolution()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/convolve.c35
-rw-r--r--src/mesa/main/convolve.h9
2 files changed, 40 insertions, 4 deletions
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index 1a32acb41e2..891e0aa5a6f 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -1,10 +1,10 @@
-/* $Id: convolve.c,v 1.18 2001/01/05 02:26:48 keithw Exp $ */
+/* $Id: convolve.c,v 1.19 2001/02/06 17:22:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1420,3 +1420,34 @@ _mesa_convolve_sep_image(const GLcontext *ctx,
;
}
}
+
+
+
+/*
+ * This function computes an image's size after convolution.
+ * If the convolution border mode is GL_REDUCE, the post-convolution
+ * image will be smaller than the original.
+ */
+void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+ GLsizei *width, GLsizei *height)
+{
+ if (ctx->Pixel.Convolution1DEnabled
+ && dimensions == 1
+ && ctx->Pixel.ConvolutionBorderMode[0] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Convolution1D.Width, 1) - 1);
+ }
+ else if (ctx->Pixel.Convolution2DEnabled
+ && dimensions > 1
+ && ctx->Pixel.ConvolutionBorderMode[1] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Convolution2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Convolution2D.Height, 1) - 1);
+ }
+ else if (ctx->Pixel.Separable2DEnabled
+ && dimensions > 1
+ && ctx->Pixel.ConvolutionBorderMode[2] == GL_REDUCE) {
+ *width = *width - (MAX2(ctx->Separable2D.Width, 1) - 1);
+ *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1);
+ }
+}
+
diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h
index 7d8acc3d58a..72a5d6f6327 100644
--- a/src/mesa/main/convolve.h
+++ b/src/mesa/main/convolve.h
@@ -1,10 +1,10 @@
-/* $Id: convolve.h,v 1.3 2000/11/22 07:32:16 joukj Exp $ */
+/* $Id: convolve.h,v 1.4 2001/02/06 17:22:16 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -100,4 +100,9 @@ _mesa_convolve_sep_image(const GLcontext *ctx,
const GLfloat *srcImage, GLfloat *dstImage);
+extern void
+_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions,
+ GLsizei *width, GLsizei *height);
+
+
#endif