diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-06-10 16:35:21 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-06-10 16:35:21 +0000 |
commit | ece096bbdc09f7cce3afc755e9d8030a119086f1 (patch) | |
tree | dbdae8dd1ba34c61c37f097971229bacdb9b21c1 /hw/pixel_ops.h | |
parent | b29169d2654776e749de91d65c720003ab4a2e66 (diff) |
Add hw/pixel_ops.h
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2975 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pixel_ops.h')
-rw-r--r-- | hw/pixel_ops.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/hw/pixel_ops.h b/hw/pixel_ops.h new file mode 100644 index 0000000000..5334f1dbf4 --- /dev/null +++ b/hw/pixel_ops.h @@ -0,0 +1,41 @@ +static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, + unsigned int b) +{ + return ((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6); +} + +static inline unsigned int rgb_to_pixel15(unsigned int r, unsigned int g, + unsigned int b) +{ + return ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); +} + +static inline unsigned int rgb_to_pixel15bgr(unsigned int r, unsigned int g, + unsigned int b) +{ + return ((b >> 3) << 10) | ((g >> 3) << 5) | (r >> 3); +} + +static inline unsigned int rgb_to_pixel16(unsigned int r, unsigned int g, + unsigned int b) +{ + return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); +} + +static inline unsigned int rgb_to_pixel16bgr(unsigned int r, unsigned int g, + unsigned int b) +{ + return ((b >> 3) << 11) | ((g >> 2) << 5) | (r >> 3); +} + +static inline unsigned int rgb_to_pixel32(unsigned int r, unsigned int g, + unsigned int b) +{ + return (r << 16) | (g << 8) | b; +} + +static inline unsigned int rgb_to_pixel32bgr(unsigned int r, unsigned int g, + unsigned int b) +{ + return (b << 16) | (g << 8) | r; +} |