glamor: Factor out glamor_set_color_depth from glamor_set_color

The former takes explicit screen and depth parameters instead of
deriving them from a pixmap.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Michel Dänzer 2016-02-23 17:19:02 +09:00 committed by Adam Jackson
parent 947e94a341
commit b05ae79ee3
2 changed files with 19 additions and 9 deletions

View File

@ -104,19 +104,19 @@ glamor_set_destination_drawable(DrawablePtr drawable,
*/ */
void void
glamor_set_color(PixmapPtr pixmap, glamor_set_color_depth(ScreenPtr pScreen,
int depth,
CARD32 pixel, CARD32 pixel,
GLint uniform) GLint uniform)
{ {
glamor_screen_private *glamor_priv = glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
glamor_get_screen_private((pixmap)->drawable.pScreen);
float color[4]; float color[4];
glamor_get_rgba_from_pixel(pixel, glamor_get_rgba_from_pixel(pixel,
&color[0], &color[1], &color[2], &color[3], &color[0], &color[1], &color[2], &color[3],
format_for_pixmap(pixmap)); format_for_depth(depth));
if ((pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8) && if ((depth == 1 || depth == 8) &&
glamor_priv->one_channel_format == GL_RED) glamor_priv->one_channel_format == GL_RED)
color[0] = color[3]; color[0] = color[3];

View File

@ -33,10 +33,20 @@ glamor_set_destination_drawable(DrawablePtr drawable,
int *p_off_y); int *p_off_y);
void void
glamor_set_color(PixmapPtr pixmap, glamor_set_color_depth(ScreenPtr pScreen,
int depth,
CARD32 pixel, CARD32 pixel,
GLint uniform); GLint uniform);
static inline void
glamor_set_color(PixmapPtr pixmap,
CARD32 pixel,
GLint uniform)
{
glamor_set_color_depth(pixmap->drawable.pScreen,
pixmap->drawable.depth, pixel, uniform);
}
Bool Bool
glamor_set_texture_pixmap(PixmapPtr texture); glamor_set_texture_pixmap(PixmapPtr texture);