diff options
author | Keith Packard <keithp@keithp.com> | 2014-09-10 19:02:55 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2016-01-26 12:03:54 -0800 |
commit | e6754dcb59ee21abb42421a28f4e467295584f67 (patch) | |
tree | b2debe3174a9c11b0061f2815d3d16ddbd3e0986 /glamor/glamor_transform.c | |
parent | 5042b0652b9fe5fed57a233880c3429ba390d86d (diff) |
glamor: Use GL_RED instead of GL_ALPHA if we have texture_swizzle (v3)
GL_RED is supported by core profiles while GL_ALPHA is not; use GL_RED
for one channel objects (depth 1 to 8), and then swizzle them into the
alpha channel when used as a mask.
[airlied: updated to master, add swizzle to composited glyphs and xv paths]
v2: consolidate setting swizzle into the texture creation code, it
should work fine there. Handle swizzle when setting color as well.
v3: Fix drawing to a8 with Render (changes by anholt, reviewed by airlied).
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glamor/glamor_transform.c')
-rw-r--r-- | glamor/glamor_transform.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c index f476a99b7..ad069435f 100644 --- a/glamor/glamor_transform.c +++ b/glamor/glamor_transform.c @@ -111,12 +111,18 @@ glamor_set_color(PixmapPtr pixmap, CARD32 pixel, GLint uniform) { + glamor_screen_private *glamor_priv = + glamor_get_screen_private((pixmap)->drawable.pScreen); float color[4]; glamor_get_rgba_from_pixel(pixel, &color[0], &color[1], &color[2], &color[3], format_for_pixmap(pixmap)); + if ((pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8) && + glamor_priv->one_channel_format == GL_RED) + color[0] = color[3]; + glUniform4fv(uniform, 1, color); } |