Remove COGL_UNPREMULT_MASK define
Since (A & ~COGL_PREMULT_BIT) is basically as readable as (A & COGL_UNPREMULT_MASK) this patch removes the mask define. Without the mask the code is slightly more explicit and there's less risk in error caused by us forgetting to update the COGL_UNPREMULT_MASK if the way CoglPixelFormat is defined evolves. Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
07e972505c
commit
a203a5e396
5 changed files with 5 additions and 8 deletions
|
@ -375,7 +375,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
|
||||||
/* Copy the premult bit if the new format has an alpha channel */
|
/* Copy the premult bit if the new format has an alpha channel */
|
||||||
if ((dst_format & COGL_A_BIT))
|
if ((dst_format & COGL_A_BIT))
|
||||||
dst_format = ((src_format & COGL_PREMULT_BIT) |
|
dst_format = ((src_format & COGL_PREMULT_BIT) |
|
||||||
(dst_format & COGL_UNPREMULT_MASK));
|
(dst_format & ~COGL_PREMULT_BIT));
|
||||||
|
|
||||||
/* Allocate a new buffer to hold converted data */
|
/* Allocate a new buffer to hold converted data */
|
||||||
dst_data = g_malloc (height * dst_rowstride);
|
dst_data = g_malloc (height * dst_rowstride);
|
||||||
|
@ -391,7 +391,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
|
||||||
/* FIXME: Would be nice to at least remove this inner
|
/* FIXME: Would be nice to at least remove this inner
|
||||||
* branching, but not sure it can be done without
|
* branching, but not sure it can be done without
|
||||||
* rewriting of the whole loop */
|
* rewriting of the whole loop */
|
||||||
switch (src_format & COGL_UNPREMULT_MASK)
|
switch (src_format & ~COGL_PREMULT_BIT)
|
||||||
{
|
{
|
||||||
case COGL_PIXEL_FORMAT_G_8:
|
case COGL_PIXEL_FORMAT_G_8:
|
||||||
_cogl_g_to_rgba (src, temp_rgba); break;
|
_cogl_g_to_rgba (src, temp_rgba); break;
|
||||||
|
@ -411,7 +411,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst_format & COGL_UNPREMULT_MASK)
|
switch (dst_format & ~COGL_PREMULT_BIT)
|
||||||
{
|
{
|
||||||
case COGL_PIXEL_FORMAT_G_8:
|
case COGL_PIXEL_FORMAT_G_8:
|
||||||
_cogl_rgba_to_g (temp_rgba, dst); break;
|
_cogl_rgba_to_g (temp_rgba, dst); break;
|
||||||
|
|
|
@ -111,8 +111,8 @@ _cogl_bitmap_convert_format_and_premult (CoglBitmap *bmp,
|
||||||
CoglBitmap *dst_bmp;
|
CoglBitmap *dst_bmp;
|
||||||
|
|
||||||
/* Is base format different (not considering premult status)? */
|
/* Is base format different (not considering premult status)? */
|
||||||
if ((src_format & COGL_UNPREMULT_MASK) !=
|
if ((src_format & ~COGL_PREMULT_BIT) !=
|
||||||
(dst_format & COGL_UNPREMULT_MASK))
|
(dst_format & ~COGL_PREMULT_BIT))
|
||||||
{
|
{
|
||||||
/* Try converting using imaging library */
|
/* Try converting using imaging library */
|
||||||
if ((dst_bmp = _cogl_bitmap_convert (bmp, dst_format)) == NULL)
|
if ((dst_bmp = _cogl_bitmap_convert (bmp, dst_format)) == NULL)
|
||||||
|
|
|
@ -170,7 +170,6 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
|
||||||
#define COGL_AFIRST_BIT (1 << 6)
|
#define COGL_AFIRST_BIT (1 << 6)
|
||||||
#define COGL_PREMULT_BIT (1 << 7)
|
#define COGL_PREMULT_BIT (1 << 7)
|
||||||
#define COGL_UNORDERED_MASK 0x0F
|
#define COGL_UNORDERED_MASK 0x0F
|
||||||
#define COGL_UNPREMULT_MASK 0x7F
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglPixelFormat:
|
* CoglPixelFormat:
|
||||||
|
|
|
@ -164,7 +164,6 @@ COGL_PIXEL_FORMAT_24
|
||||||
COGL_PIXEL_FORMAT_32
|
COGL_PIXEL_FORMAT_32
|
||||||
COGL_PREMULT_BIT
|
COGL_PREMULT_BIT
|
||||||
COGL_UNORDERED_MASK
|
COGL_UNORDERED_MASK
|
||||||
COGL_UNPREMULT_MASK
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
@ -126,7 +126,6 @@ COGL_PIXEL_FORMAT_24
|
||||||
COGL_PIXEL_FORMAT_32
|
COGL_PIXEL_FORMAT_32
|
||||||
COGL_PREMULT_BIT
|
COGL_PREMULT_BIT
|
||||||
COGL_UNORDERED_MASK
|
COGL_UNORDERED_MASK
|
||||||
COGL_UNPREMULT_MASK
|
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
Loading…
Reference in a new issue