summaryrefslogtreecommitdiff
path: root/hw/xquartz/GL
diff options
context:
space:
mode:
authorGeorge Staplin <gstaplin@apple.com>2008-11-12 17:17:25 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-11-13 11:34:21 -0800
commit47d38218706564d1437dc3ff9d1bba3511db063c (patch)
tree96adf1a52687c0dd7e8b03b771e84acf50bb55ac /hw/xquartz/GL
parent6b501d7cc55f1d06966cdf3caf36bcfc6cf18939 (diff)
XQuartz: GL: Handle the alpha differently when the alpha is equal to GLCAPS_COLOR_BUF_INVALID_VALUE.
This prevents visuals with odd sizes. The machine I use didn't have this problem, but it shows up on some others. (cherry picked from commit ed181382ddeb77019577d39b9c06b1cd839e18e4)
Diffstat (limited to 'hw/xquartz/GL')
-rw-r--r--hw/xquartz/GL/visualConfigs.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index 2f5c508e2..81f88fb3c 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -149,12 +149,30 @@ void setVisualConfigs(void) {
visualConfigs[i].redSize = conf->color_buffers[color].r;
visualConfigs[i].greenSize = conf->color_buffers[color].g;
visualConfigs[i].blueSize = conf->color_buffers[color].b;
- visualConfigs[i].alphaSize = conf->color_buffers[color].a;
-
- visualConfigs[i].bufferSize = conf->color_buffers[color].r +
- conf->color_buffers[color].g + conf->color_buffers[color].b +
- conf->color_buffers[color].a;
-
+
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) {
+ /* This visual has no alpha. */
+ visualConfigs[i].alphaSize = 0;
+ } else {
+ visualConfigs[i].alphaSize = conf->color_buffers[color].a;
+ }
+
+ /*
+ * If the .a/alpha value is unset, then don't add it to the
+ * bufferSize specification. The INVALID_VALUE indicates that it
+ * was unset.
+ *
+ * This prevents odd bufferSizes, such as 14.
+ */
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) {
+ visualConfigs[i].bufferSize = conf->color_buffers[color].r +
+ conf->color_buffers[color].g + conf->color_buffers[color].b;
+ } else {
+ visualConfigs[i].bufferSize = conf->color_buffers[color].r +
+ conf->color_buffers[color].g + conf->color_buffers[color].b +
+ conf->color_buffers[color].a;
+ }
+
/*
* I'm uncertain about these masks.
* I don't think we actually care what the values are in our