summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-02-23 17:19:02 +0900
committerAdam Jackson <ajax@redhat.com>2016-03-08 15:17:16 -0500
commitb05ae79ee3bebef9790c97eedc033d1ffb3ec39a (patch)
tree7ce954d8eab54f32f40d61245989fb7c96db9621
parent947e94a341fa153258e9e86060b83af95934672b (diff)
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>
-rw-r--r--glamor/glamor_transform.c16
-rw-r--r--glamor/glamor_transform.h12
2 files changed, 19 insertions, 9 deletions
diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c
index 17b10666e..fc96fd670 100644
--- a/glamor/glamor_transform.c
+++ b/glamor/glamor_transform.c
@@ -104,20 +104,20 @@ glamor_set_destination_drawable(DrawablePtr drawable,
*/
void
-glamor_set_color(PixmapPtr pixmap,
- CARD32 pixel,
- GLint uniform)
+glamor_set_color_depth(ScreenPtr pScreen,
+ int depth,
+ CARD32 pixel,
+ GLint uniform)
{
- glamor_screen_private *glamor_priv =
- glamor_get_screen_private((pixmap)->drawable.pScreen);
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(pScreen);
float color[4];
glamor_get_rgba_from_pixel(pixel,
&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) &&
- glamor_priv->one_channel_format == GL_RED)
+ if ((depth == 1 || depth == 8) &&
+ glamor_priv->one_channel_format == GL_RED)
color[0] = color[3];
glUniform4fv(uniform, 1, color);
diff --git a/glamor/glamor_transform.h b/glamor/glamor_transform.h
index ab7b2bcb3..5a520ebb0 100644
--- a/glamor/glamor_transform.h
+++ b/glamor/glamor_transform.h
@@ -33,9 +33,19 @@ glamor_set_destination_drawable(DrawablePtr drawable,
int *p_off_y);
void
+glamor_set_color_depth(ScreenPtr pScreen,
+ int depth,
+ CARD32 pixel,
+ GLint uniform);
+
+static inline void
glamor_set_color(PixmapPtr pixmap,
CARD32 pixel,
- GLint uniform);
+ GLint uniform)
+{
+ glamor_set_color_depth(pixmap->drawable.pScreen,
+ pixmap->drawable.depth, pixel, uniform);
+}
Bool
glamor_set_texture_pixmap(PixmapPtr texture);