From 6ba000db056d7e9b70a7e154a003644046bf7e98 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 29 Jan 2011 21:51:45 +0000 Subject: Add support for opacity property svn path=/trunk/libcss/; revision=11527 --- include/libcss/computed.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'include/libcss/computed.h') diff --git a/include/libcss/computed.h b/include/libcss/computed.h index 818d9db..094fd59 100644 --- a/include/libcss/computed.h +++ b/include/libcss/computed.h @@ -181,7 +181,7 @@ struct css_computed_style { * --- * 84 bits * - * Colours are 32bits of RRGGBBAA + * Colours are 32bits of AARRGGBB * Dimensions are encoded as a fixed point value + 4 bits of unit data * * background_color 2 4 @@ -269,7 +269,7 @@ struct css_computed_style { * 21 mmmmmccc min-width | clear * 22 tttttooo padding-top | overflow * 23 rrrrrppp padding-right | position - * 24 bbbbb... padding-bottom | + * 24 bbbbbo.. padding-bottom | opacity | * 25 lllllttt padding-left | text-transform * 26 tttttwww text-indent | white-space * 27 bbbbbbbb background-position @@ -315,6 +315,8 @@ struct css_computed_style { css_fixed min_height; css_fixed min_width; + css_fixed opacity; + css_fixed padding[4]; css_fixed text_indent; @@ -1771,6 +1773,28 @@ static inline uint8_t css_computed_position( #undef CSS_POSITION_SHIFT #undef CSS_POSITION_INDEX +#define CSS_OPACITY_INDEX 23 +#define CSS_OPACITY_SHIFT 2 +#define CSS_OPACITY_MASK 0x04 +static inline uint8_t css_computed_opacity( + const css_computed_style *style, + css_fixed *opacity) +{ + uint8_t bits = style->bits[CSS_OPACITY_INDEX]; + bits &= CSS_OPACITY_MASK; + bits >>= CSS_OPACITY_SHIFT; + + /* 1bit: t : type */ + if ((bits & 0x1) == CSS_OPACITY_SET) { + *opacity = style->opacity; + } + + return (bits & 0x1); +} +#undef CSS_OPACITY_MASK +#undef CSS_OPACITY_SHIFT +#undef CSS_OPACITY_INDEX + #define CSS_TEXT_TRANSFORM_INDEX 24 #define CSS_TEXT_TRANSFORM_SHIFT 0 #define CSS_TEXT_TRANSFORM_MASK 0x7 -- cgit v1.2.3