#9646 BLOC 1.5-F11: Switch to 24bpp
Zarro Boogs per Child
bugtracker at laptop.org
Wed Nov 11 08:28:37 EST 2009
#9646: Switch to 24bpp
-------------------------------------------+--------------------------------
Reporter: cjb | Owner: wmb at firmworks.com
Type: defect | Status: new
Priority: blocker | Milestone: 1.5-F11
Component: ofw - open firmware | Version: not specified
Resolution: | Keywords:
Next_action: code | Verified: 0
Deployment_affected: | Blockedby:
Blocking: |
-------------------------------------------+--------------------------------
Comment(by dsd):
indeed, problems with green and blue
I came up with a working macro. Does it suck? Here they are in a head-to-
head deathmatch, for each colour component:
{{{
#include <stdint.h>
#include <stdio.h>
#define TOARGB_mitch(s) (0xff070307 | (((s) >> 11) << 19) | (((s) << 27)
>> 24) | (((s) << 27) >> 10))
#define TOARGB(s) (0xff070307 | (((s) >> 11) << 19) | ((s & 0x07e0) << 5)
| ((s & 0x001f) << 3))
int main(void)
{
uint16_t red = 0xf800, green = 0x07e0, blue = 0x001f;
printf("Mitch: %x %x %x\n", TOARGB_mitch(red),
TOARGB_mitch(green), TOARGB_mitch(blue));
printf("dsd: %x %x %x\n", TOARGB(red), TOARGB(green),
TOARGB(blue));
}
}}}
Output:
{{{
Mitch: ffff0307 ff070307 ffffffff
dsd: ffff0307 ff07ff07 ff0703ff
}}}
--
Ticket URL: <http://dev.laptop.org/ticket/9646#comment:10>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list