mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
fb_accel_td: implement setBlendMode/Level
This commit is contained in:
@@ -150,6 +150,8 @@ class CFbAccelTD
|
|||||||
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
|
void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col);
|
||||||
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
|
void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp);
|
||||||
void waitForIdle(const char *func = NULL);
|
void waitForIdle(const char *func = NULL);
|
||||||
|
void setBlendMode(uint8_t);
|
||||||
|
void setBlendLevel(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
@@ -143,6 +144,7 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t
|
|||||||
void CFbAccelTD::init(const char *)
|
void CFbAccelTD::init(const char *)
|
||||||
{
|
{
|
||||||
CFrameBuffer::init();
|
CFrameBuffer::init();
|
||||||
|
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||||
if (lfb == NULL) {
|
if (lfb == NULL) {
|
||||||
printf(LOGTAG "CFrameBuffer::init() failed.\n");
|
printf(LOGTAG "CFrameBuffer::init() failed.\n");
|
||||||
return; /* too bad... */
|
return; /* too bad... */
|
||||||
@@ -174,3 +176,29 @@ int CFbAccelTD::setMode(unsigned int, unsigned int, unsigned int)
|
|||||||
backbuffer = lfb; /* will not work well, but avoid crashes */
|
backbuffer = lfb; /* will not work well, but avoid crashes */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFbAccelTD::setBlendMode(uint8_t mode)
|
||||||
|
{
|
||||||
|
Stb04GFXOsdControl g;
|
||||||
|
ioctl(gfxfd, STB04GFX_OSD_GETCONTROL, &g);
|
||||||
|
g.use_global_alpha = (mode == 2); /* 1 == pixel alpha, 2 == global alpha */
|
||||||
|
ioctl(gfxfd, STB04GFX_OSD_SETCONTROL, &g);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFbAccelTD::setBlendLevel(int level)
|
||||||
|
{
|
||||||
|
/* this is bypassing directfb, but faster and easier */
|
||||||
|
Stb04GFXOsdControl g;
|
||||||
|
ioctl(gfxfd, STB04GFX_OSD_GETCONTROL, &g);
|
||||||
|
if (g.use_global_alpha == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (level < 0 || level > 100)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* this is the same as convertSetupAlpha2Alpha(), but non-float */
|
||||||
|
g.global_alpha = 255 - (255 * level / 100);
|
||||||
|
ioctl(gfxfd, STB04GFX_OSD_SETCONTROL, &g);
|
||||||
|
if (level == 100) // sucks
|
||||||
|
usleep(20000);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user