summaryrefslogtreecommitdiffstats
path: root/libvo/vo_gl2.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-27 20:45:08 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-06-27 20:45:08 +0000
commitebe46df4143f8acb5993e127b027602e40887070 (patch)
tree7820de943306329018fd0ab02abccd7e0e2bfafd /libvo/vo_gl2.c
parent4143f4e4e576b8a532fae269c01fd4323dcff5e1 (diff)
downloadmpv-ebe46df4143f8acb5993e127b027602e40887070.tar.bz2
mpv-ebe46df4143f8acb5993e127b027602e40887070.tar.xz
avoid visuals with low color-depth.
Based on idea from Timo Kanera (timo (at) kanera (dot) de). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12710 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_gl2.c')
-rw-r--r--libvo/vo_gl2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index f3c1c0d7af..f61ad57396 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -640,6 +640,18 @@ static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi)
w += val;
/* and finally, prefer DirectColor-ed visuals to allow color corrections */
if (vi_list[i].class != DirectColor) w += 100;
+
+ // avoid bad-looking visual with less that 8bit per color
+ res = glXGetConfig(dpy, vi_list + i, GLX_RED_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 50;
+ res = glXGetConfig(dpy, vi_list + i, GLX_GREEN_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 70;
+ res = glXGetConfig(dpy, vi_list + i, GLX_BLUE_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 50;
+
if (w < best_weight) {
best_weight = w;
best_i = i;