mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
- add support for 24bit PNGs with alpha-channel
- modify resize function If you encounter problems please report here including a log: http://www.dbox2world.net/board293-coolstream-hd1/board314-coolstream-development/10561-transparente-senderlogos/?s=d3381092abb5a81271ebfa0c4219f73f0ba7b8ca THX micha_bbg! git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1715 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -1618,32 +1618,49 @@ void CFrameBuffer::Unlock()
|
||||
locked = false;
|
||||
}
|
||||
|
||||
void * CFrameBuffer::convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp)
|
||||
void * CFrameBuffer::int_convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp, bool alpha)
|
||||
{
|
||||
unsigned long i;
|
||||
unsigned int *fbbuff;
|
||||
unsigned long count = x*y;
|
||||
unsigned long count = x * y;
|
||||
|
||||
//fbbuff = (unsigned int *) malloc(count * sizeof(unsigned int));
|
||||
fbbuff = (unsigned int *) cs_malloc_uncached(count * sizeof(unsigned int));
|
||||
if(fbbuff == NULL)
|
||||
{
|
||||
printf("convertRGB2FB: Error: malloc\n");
|
||||
printf("convertRGB2FB%s: Error: cs_malloc_uncached\n", ((alpha) ? " (Alpha)" : ""));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(i = 0; i < count ; i++) {
|
||||
transp = 0;
|
||||
|
||||
if(rgbbuff[i*3] || rgbbuff[i*3+1] || rgbbuff[i*3+2])
|
||||
transp = 0xFF;
|
||||
|
||||
fbbuff[i] = (transp << 24) | ((rgbbuff[i*3] << 16) & 0xFF0000) | ((rgbbuff[i*3+1] << 8) & 0xFF00) | (rgbbuff[i*3+2] & 0xFF);
|
||||
if (alpha)
|
||||
{
|
||||
for(i = 0; i < count ; i++)
|
||||
fbbuff[i] = ((rgbbuff[i*4+3] << 24) & 0xFF000000) |
|
||||
((rgbbuff[i*4] << 16) & 0x00FF0000) |
|
||||
((rgbbuff[i*4+1] << 8) & 0x0000FF00) |
|
||||
((rgbbuff[i*4+2]) & 0x000000FF);
|
||||
}else
|
||||
{
|
||||
for(i = 0; i < count ; i++)
|
||||
{
|
||||
transp = 0;
|
||||
if(rgbbuff[i*3] || rgbbuff[i*3+1] || rgbbuff[i*3+2])
|
||||
transp = 0xFF;
|
||||
fbbuff[i] = (transp << 24) | ((rgbbuff[i*3] << 16) & 0xFF0000) | ((rgbbuff[i*3+1] << 8) & 0xFF00) | (rgbbuff[i*3+2] & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
return (void *) fbbuff;
|
||||
}
|
||||
|
||||
void * CFrameBuffer::convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp)
|
||||
{
|
||||
return int_convertRGB2FB(rgbbuff, x, y, transp, false);
|
||||
}
|
||||
|
||||
void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y)
|
||||
{
|
||||
return int_convertRGB2FB(rgbbuff, x, y, 0, true);
|
||||
}
|
||||
|
||||
void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp)
|
||||
{
|
||||
int xc, yc;
|
||||
|
Reference in New Issue
Block a user