diff --git a/cogl/cogl/cogl-bitmap.c b/cogl/cogl/cogl-bitmap.c index 7c8d27468..4cec61f7c 100644 --- a/cogl/cogl/cogl-bitmap.c +++ b/cogl/cogl/cogl-bitmap.c @@ -82,12 +82,12 @@ _cogl_bitmap_convert_premult_status (CoglBitmap *bmp, /* Do we need to unpremultiply? */ if ((bmp->format & COGL_PREMULT_BIT) > 0 && (dst_format & COGL_PREMULT_BIT) == 0 && - COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (dst_format)) + _cogl_pixel_format_can_have_premult (dst_format)) return _cogl_bitmap_unpremult (bmp, error); /* Do we need to premultiply? */ if ((bmp->format & COGL_PREMULT_BIT) == 0 && - COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (bmp->format) && + _cogl_pixel_format_can_have_premult (bmp->format) && (dst_format & COGL_PREMULT_BIT) > 0) /* Try premultiplying using imaging library */ return _cogl_bitmap_premult (bmp, error); diff --git a/cogl/cogl/cogl-pixel-format.h b/cogl/cogl/cogl-pixel-format.h index 0f00d66c5..d9fe53873 100644 --- a/cogl/cogl/cogl-pixel-format.h +++ b/cogl/cogl/cogl-pixel-format.h @@ -265,7 +265,7 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/ /** * COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT: - * + * * Architecture dependant format, similar to CAIRO_ARGB32. */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN @@ -324,7 +324,7 @@ gboolean _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format); /* - * COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format): + * _cogl_pixel_format_can_have_premult: * @format: a #CoglPixelFormat * * Returns TRUE if the pixel format can take a premult bit. This is @@ -332,8 +332,11 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format); * COGL_PIXEL_FORMAT_A_8 (because that doesn't have any other * components to multiply by the alpha). */ -#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \ - (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8) +static inline gboolean +_cogl_pixel_format_can_have_premult (CoglPixelFormat format) +{ + return (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8); +} /** * cogl_pixel_format_get_n_planes: diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c index 773789dd0..2bc774656 100644 --- a/cogl/cogl/cogl-texture.c +++ b/cogl/cogl/cogl-texture.c @@ -808,7 +808,7 @@ cogl_texture_get_data (CoglTexture *texture, /* We can assume that whatever data GL gives us will have the premult status of the original texture */ - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (closest_format)) + if (_cogl_pixel_format_can_have_premult (closest_format)) closest_format = ((closest_format & ~COGL_PREMULT_BIT) | (texture_format & COGL_PREMULT_BIT)); @@ -1202,7 +1202,7 @@ _cogl_texture_determine_internal_format (CoglTexture *texture, if (cogl_texture_get_premultiplied (texture)) { - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + if (_cogl_pixel_format_can_have_premult (format)) return format |= COGL_PREMULT_BIT; else return COGL_PIXEL_FORMAT_RGBA_8888_PRE; diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 7197e7c5a..36edc4cdb 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -472,7 +472,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver, uint8_t *tmp_data; gboolean succeeded; - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (read_format)) + if (_cogl_pixel_format_can_have_premult (read_format)) { read_format = ((read_format & ~COGL_PREMULT_BIT) | (internal_format & COGL_PREMULT_BIT)); @@ -536,7 +536,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver, /* We match the premultiplied state of the target buffer to the * premultiplied state of the framebuffer so that it will get * converted to the right format below */ - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + if (_cogl_pixel_format_can_have_premult (format)) bmp_format = ((format & ~COGL_PREMULT_BIT) | (internal_format & COGL_PREMULT_BIT)); else