remove some more code duplication, fix a string, and remove a potential bug

This commit is contained in:
jp9000
2013-10-05 09:40:43 -07:00
parent 3243bfbaa3
commit f9c2aadf53
5 changed files with 39 additions and 68 deletions

View File

@@ -226,7 +226,7 @@ struct gs_rect {
int cy;
};
static inline uint32_t get_format_bpp(enum gs_color_format format)
static inline uint32_t gs_get_format_bpp(enum gs_color_format format)
{
switch (format) {
case GS_A8: return 8;
@@ -250,11 +250,24 @@ static inline uint32_t get_format_bpp(enum gs_color_format format)
}
}
static inline bool is_compressed_format(enum gs_color_format format)
static inline bool gs_is_compressed_format(enum gs_color_format format)
{
return (format == GS_DXT1 || format == GS_DXT3 || format == GS_DXT5);
}
static inline uint32_t gs_num_total_levels(uint32_t width, uint32_t height)
{
uint32_t size = width > height ? width : height;
uint32_t num_levels = 0;
while (size > 1) {
size /= 2;
num_levels++;
}
return num_levels;
}
/* wrapped opaque data types */
struct gs_texture;