summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2012-02-13 22:23:27 +0000
committerRobert Bragg <robert@linux.intel.com>2012-02-17 23:48:50 +0000
commit07f679a6f4944fda907e6cd0449a216dabeea4af (patch)
treee9b1b6c8b552e71fda2c1bb370a3ae621cb88de1
parent27366766716b0a1e5f0a68e19f98dbb3e9bc4073 (diff)
downloadcogl-07f679a6f4944fda907e6cd0449a216dabeea4af.tar.gz
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.
-rw-r--r--cogl/cogl-bitmap-fallback.c7
-rw-r--r--cogl/cogl-bitmap.c4
-rw-r--r--cogl/cogl-types.h1
-rw-r--r--doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt1
-rw-r--r--doc/reference/cogl/cogl-sections.txt1
5 files changed, 5 insertions, 9 deletions
diff --git a/cogl/cogl-bitmap-fallback.c b/cogl/cogl-bitmap-fallback.c
index 1b5b8ca1..be0cf043 100644
--- a/cogl/cogl-bitmap-fallback.c
+++ b/cogl/cogl-bitmap-fallback.c
@@ -374,8 +374,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
dst_rowstride = sizeof(guint8) * dst_bpp * width;
/* Copy the premult bit if the new format has an alpha channel */
if ((dst_format & COGL_A_BIT))
- dst_format = ((src_format & COGL_PREMULT_BIT) |
- (dst_format & COGL_UNPREMULT_MASK));
+ dst_format |= (src_format & COGL_PREMULT_BIT);
/* Allocate a new buffer to hold converted data */
dst_data = g_malloc (height * dst_rowstride);
@@ -391,7 +390,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
/* FIXME: Would be nice to at least remove this inner
* branching, but not sure it can be done without
* rewriting of the whole loop */
- switch (src_format & COGL_UNPREMULT_MASK)
+ switch (src_format & ~COGL_PREMULT_BIT)
{
case COGL_PIXEL_FORMAT_G_8:
_cogl_g_to_rgba (src, temp_rgba); break;
@@ -411,7 +410,7 @@ _cogl_bitmap_fallback_convert (CoglBitmap *src_bmp,
break;
}
- switch (dst_format & COGL_UNPREMULT_MASK)
+ switch (dst_format & ~COGL_PREMULT_BIT)
{
case COGL_PIXEL_FORMAT_G_8:
_cogl_rgba_to_g (temp_rgba, dst); break;
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index 84fd7ac7..a4d0732c 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -111,8 +111,8 @@ _cogl_bitmap_convert_format_and_premult (CoglBitmap *bmp,
CoglBitmap *dst_bmp;
/* Is base format different (not considering premult status)? */
- if ((src_format & COGL_UNPREMULT_MASK) !=
- (dst_format & COGL_UNPREMULT_MASK))
+ if ((src_format & ~COGL_PREMULT_BIT) !=
+ (dst_format & ~COGL_PREMULT_BIT))
{
/* Try converting using imaging library */
if ((dst_bmp = _cogl_bitmap_convert (bmp, dst_format)) == NULL)
diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h
index d60c4acc..c5d7592b 100644
--- a/cogl/cogl-types.h
+++ b/cogl/cogl-types.h
@@ -170,7 +170,6 @@ typedef struct _CoglTextureVertex CoglTextureVertex;
#define COGL_AFIRST_BIT (1 << 6)
#define COGL_PREMULT_BIT (1 << 7)
#define COGL_UNORDERED_MASK 0x0F
-#define COGL_UNPREMULT_MASK 0x7F
/**
* CoglPixelFormat:
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
index 8f7d3d71..861de90a 100644
--- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
+++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
@@ -164,7 +164,6 @@ COGL_PIXEL_FORMAT_24
COGL_PIXEL_FORMAT_32
COGL_PREMULT_BIT
COGL_UNORDERED_MASK
-COGL_UNPREMULT_MASK
</SECTION>
<SECTION>
diff --git a/doc/reference/cogl/cogl-sections.txt b/doc/reference/cogl/cogl-sections.txt
index 77240494..962ec843 100644
--- a/doc/reference/cogl/cogl-sections.txt
+++ b/doc/reference/cogl/cogl-sections.txt
@@ -126,7 +126,6 @@ COGL_PIXEL_FORMAT_24
COGL_PIXEL_FORMAT_32
COGL_PREMULT_BIT
COGL_UNORDERED_MASK
-COGL_UNPREMULT_MASK
</SECTION>
<SECTION>