diff options
author | Adam Jackson <ajax@redhat.com> | 2018-02-23 16:08:10 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-02-26 16:46:34 -0500 |
commit | 8171d4c2d67b2990a278dc018ac32534c3afe606 (patch) | |
tree | f83e0536b3a40b0ed3eb32679e8c897891016736 /glamor | |
parent | 92272378064a878ce7a62852b877d674bcad89cd (diff) |
render: Store and use all 16bpc of precision for solid pixels (v2.1)
This plumbs the full width color for solid pictures through to fb, exa,
and glamor. External drivers and acceleration code may wish to make a
similar change for sufficiently new servers.
v2: Don't break ABI (Michel Dänzer)
v2.1: Use the (correct) full color in fb too (Michel Dänzer)
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_program.c | 7 | ||||
-rw-r--r-- | glamor/glamor_render.c | 20 | ||||
-rw-r--r-- | glamor/glamor_utils.h | 9 |
3 files changed, 21 insertions, 15 deletions
diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c index 23c102bc3..830deb38b 100644 --- a/glamor/glamor_program.c +++ b/glamor/glamor_program.c @@ -508,12 +508,13 @@ glamor_set_blend(CARD8 op, glamor_program_alpha alpha, PicturePtr dst) static Bool use_source_solid(CARD8 op, PicturePtr src, PicturePtr dst, glamor_program *prog) { + PictSolidFill *solid = &src->pSourcePict->solidFill; + float color[4]; + glamor_get_rgba_from_color(&solid->fullcolor, color); glamor_set_blend(op, prog->alpha, dst); + glUniform4fv(prog->fg_uniform, 1, color); - glamor_set_color_depth(dst->pDrawable->pScreen, 32, - src->pSourcePict->solidFill.color, - prog->fg_uniform); return TRUE; } diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 7a96c82dd..d8d1a335b 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -828,13 +828,11 @@ glamor_composite_choose_shader(CARD8 op, source_solid_color[3] = 0.0; } else if (!source->pDrawable) { - if (source->pSourcePict->type == SourcePictTypeSolidFill) { + SourcePictPtr sp = source->pSourcePict; + if (sp->type == SourcePictTypeSolidFill) { key.source = SHADER_SOURCE_SOLID; - glamor_get_rgba_from_pixel(source->pSourcePict->solidFill.color, - &source_solid_color[0], - &source_solid_color[1], - &source_solid_color[2], - &source_solid_color[3], PICT_a8r8g8b8); + glamor_get_rgba_from_color(&sp->solidFill.fullcolor, + source_solid_color); } else goto fail; @@ -848,13 +846,11 @@ glamor_composite_choose_shader(CARD8 op, if (mask) { if (!mask->pDrawable) { - if (mask->pSourcePict->type == SourcePictTypeSolidFill) { + SourcePictPtr sp = mask->pSourcePict; + if (sp->type == SourcePictTypeSolidFill) { key.mask = SHADER_MASK_SOLID; - glamor_get_rgba_from_pixel - (mask->pSourcePict->solidFill.color, - &mask_solid_color[0], - &mask_solid_color[1], - &mask_solid_color[2], &mask_solid_color[3], PICT_a8r8g8b8); + glamor_get_rgba_from_color(&sp->solidFill.fullcolor, + mask_solid_color); } else goto fail; diff --git a/glamor/glamor_utils.h b/glamor/glamor_utils.h index 84371f769..0d5674d63 100644 --- a/glamor/glamor_utils.h +++ b/glamor/glamor_utils.h @@ -706,6 +706,15 @@ glamor_get_rgba_from_pixel(CARD32 pixel, return TRUE; } +static inline void +glamor_get_rgba_from_color(const xRenderColor *color, float rgba[4]) +{ + rgba[0] = color->red / (float)UINT16_MAX; + rgba[1] = color->green / (float)UINT16_MAX; + rgba[2] = color->blue / (float)UINT16_MAX; + rgba[3] = color->alpha / (float)UINT16_MAX; +} + inline static Bool glamor_is_large_pixmap(PixmapPtr pixmap) { |