gallium/util: remove duplicated function util_format_is_rgb_no_alpha

It only checks if alpha is present, so it's the same as util_format_has_alpha.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Marek Olšák 2013-01-25 21:21:22 +01:00
parent b92057a983
commit bc2ceb97f1
3 changed files with 6 additions and 33 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -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;