[Mesa-dev] [PATCH 6/9] gallium/util: remove duplicated function util_format_is_rgb_no_alpha
Marek Olšák
maraeo at gmail.com
Sun Jan 27 12:52:54 PST 2013
It only checks if alpha is present, so it's the same as util_format_has_alpha.
---
src/gallium/auxiliary/util/u_format.c | 11 ++++-------
src/gallium/auxiliary/util/u_format.h | 26 +-------------------------
src/gallium/drivers/softpipe/sp_quad_blend.c | 2 +-
3 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 8228de1..1845637 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -63,17 +63,14 @@ util_format_is_float(enum pipe_format format)
/** Test if the format contains RGB, but not alpha */
boolean
-util_format_is_rgb_no_alpha(enum pipe_format format)
+util_format_has_alpha(enum pipe_format format)
{
const struct util_format_description *desc =
util_format_description(format);
- if ((desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
- desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
- desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_1) {
- return TRUE;
- }
- return FALSE;
+ return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
+ desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
+ desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
}
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 024dabb..156d5cf 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -567,7 +567,7 @@ util_format_is_float(enum pipe_format format);
boolean
-util_format_is_rgb_no_alpha(enum pipe_format format);
+util_format_has_alpha(enum pipe_format format);
boolean
@@ -772,30 +772,6 @@ util_format_get_component_bits(enum pipe_format format,
}
}
-static INLINE boolean
-util_format_has_alpha(enum pipe_format format)
-{
- const struct util_format_description *desc = util_format_description(format);
-
- assert(format);
- if (!format) {
- return FALSE;
- }
-
- switch (desc->colorspace) {
- case UTIL_FORMAT_COLORSPACE_RGB:
- case UTIL_FORMAT_COLORSPACE_SRGB:
- return desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
- case UTIL_FORMAT_COLORSPACE_YUV:
- return FALSE;
- case UTIL_FORMAT_COLORSPACE_ZS:
- return FALSE;
- default:
- assert(0);
- return FALSE;
- }
-}
-
/**
* Given a linear RGB colorspace format, return the corresponding SRGB
* format, or PIPE_FORMAT_NONE if none.
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index b85431d..48d1a2e 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -1268,7 +1268,7 @@ choose_blend_quad(struct quad_stage *qs,
bqs->base_format[i] = LUMINANCE;
else if (util_format_is_luminance_alpha(format))
bqs->base_format[i] = LUMINANCE_ALPHA;
- else if (util_format_is_rgb_no_alpha(format))
+ else if (!util_format_has_alpha(format))
bqs->base_format[i] = RGB;
else
bqs->base_format[i] = RGBA;
--
1.7.10.4
More information about the mesa-dev
mailing list