[cogl/wip/pixel-format-2101010: 6/14] Remove COGL_UNPREMULT_MASK define
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/pixel-format-2101010: 6/14] Remove COGL_UNPREMULT_MASK define
- Date: Fri, 17 Feb 2012 23:34:33 +0000 (UTC)
commit 833662edf6706944de7a112e48fbb578b96fc9ee
Author: Robert Bragg <robert linux intel com>
Date: Mon Feb 13 22:23:27 2012 +0000
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.
cogl/cogl-bitmap-fallback.c | 7 +++----
cogl/cogl-bitmap.c | 4 ++--
cogl/cogl-types.h | 1 -
.../cogl-2.0-experimental-sections.txt | 1 -
doc/reference/cogl/cogl-sections.txt | 1 -
5 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/cogl/cogl-bitmap-fallback.c b/cogl/cogl-bitmap-fallback.c
index 1b5b8ca..be0cf04 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 84fd7ac..a4d0732 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 d60c4ac..c5d7592 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 8f7d3d7..861de90 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 7724049..962ec84 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]