<color name="WindowTitleForeground" color="#ffffff" />
<color name="WindowTitleBackground" color="#000000" />
</windowstyle>
+ <windowstyle type="skinned" id="2">
+ <color name="Background" color="#000000" />
+ <color name="LabelForeground" color="#ffffff" />
+ <color name="ListboxBackground" color="#000000" />
+ <color name="ListboxForeground" color="#ffffff" />
+ <color name="ListboxSelectedBackground" color="#000000" />
+ <color name="ListboxSelectedForeground" color="#ffffff" />
+ <color name="ListboxMarkedBackground" color="#000000" />
+ <color name="ListboxMarkedForeground" color="#ffffff" />
+ <color name="ListboxMarkedAndSelectedBackground" color="#000000" />
+ <color name="ListboxMarkedAndSelectedForeground" color="#ffffff" />
+ <color name="WindowTitleForeground" color="#ffffff" />
+ <color name="WindowTitleBackground" color="#000000" />
+ </windowstyle>
<!-- Fonts -->
<fonts>
<!-- <font filename="md_khmurabi_10.ttf" name="Regular" scale="90" /> -->
<convert type="ConditionalShowHide">Blink</convert>
</widget>
</screen>
+ <!-- Color OLED screen (main) -->
+ <screen name="InfoBarSummary" position="0,0" size="96,64" id="2">
+ <widget source="session.CurrentService" render="Label" position="0,0" size="96,25" font="Regular;14" halign="center" valign="center" >
+ <convert type="ServiceName">Name</convert>
+ </widget>
+ <widget source="session.Event_Now" render="Progress" position="0,27" size="96,5" borderWidth="1" >
+ <convert type="EventTime">Progress</convert>
+ </widget>
+ <widget source="global.CurrentTime" render="Label" position="0,32" size="96,32" font="Regular;32" halign="center" valign="center" foregroundColor="#FFFFFF" backgroundColor="#000000" >
+ <convert type="ClockToText">Format:%H:%M</convert>
+ </widget>
+ <widget source="session.RecordState" render="FixedLabel" text=" " position="0,32" zPosition="1" size="96,32">
+ <convert type="ConfigEntryTest">config.usage.blinking_display_clock_during_recording,True,CheckSourceBoolean</convert>
+ <convert type="ConditionalShowHide">Blink</convert>
+ </widget>
+ </screen>
<!-- LCD screen (menus) -->
<screen name="MenuSummary" position="0,0" size="132,64">
<widget source="parent.title" render="Label" position="6,0" size="120,32" font="Regular;14" halign="center" valign="center"/>
static FTC_Font cache_current_font=0;
#endif
+#define RBG565
+
struct fntColorCacheKey
{
gRGB start, end;
gColor *lookup8, lookup8_invert[16];
gColor *lookup8_normal=0;
+ __u16 lookup16_normal[16], lookup16_invert[16], *lookup16;
__u32 lookup32_normal[16], lookup32_invert[16], *lookup32;
-
+
if (surface->bpp == 8)
{
if (surface->clut.data)
opcode=0;
} else
opcode=1;
+ } else if (surface->bpp == 16)
+ {
+ opcode=2;
+ for (int i=0; i<16; ++i)
+ {
+#define BLEND(y, x, a) (y + (((x-y) * a)>>8))
+
+ unsigned char dr = background.r, dg = background.g, db = background.b;
+ int sa = i * 16;
+ if (sa < 256)
+ {
+ dr = BLEND(background.r, foreground.r, sa) & 0xFF;
+ dg = BLEND(background.g, foreground.g, sa) & 0xFF;
+ db = BLEND(background.b, foreground.b, sa) & 0xFF;
+ }
+#undef BLEND
+#ifdef RBG565
+ lookup16_normal[i] = ((dr >> 3) << 11) | ((db >> 2) << 5) | (dg >> 3);
+#else
+ lookup16_normal[i] = ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3);
+#endif
+ }
+ for (int i=0; i<16; ++i)
+ lookup16_invert[i]=lookup16_normal[i^0xF];
} else if (surface->bpp == 32)
{
opcode=3;
-
for (int i=0; i<16; ++i)
{
#define BLEND(y, x, a) (y + (((x-y) * a)>>8))
eWarning("can't render to %dbpp", surface->bpp);
return;
}
-
+
gRegion area(eRect(0, 0, surface->x, surface->y));
gRegion clip = dc.getClip() & area;
if (!(i->flags & GS_INVERT))
{
lookup8 = lookup8_normal;
+ lookup16 = lookup16_normal;
lookup32 = lookup32_normal;
} else
{
lookup8 = lookup8_invert;
+ lookup16 = lookup16_invert;
lookup32 = lookup32_invert;
}
d+=diff*buffer_stride;
}
if (sx>0)
- for (int ay=0; ay<sy; ay++)
- {
- if (!opcode) // 4bit lookup to 8bit
+ {
+ switch(opcode) {
+ case 0: // 4bit lookup to 8bit
+ for (int ay=0; ay<sy; ay++)
{
register __u8 *td=d;
register int ax;
-
for (ax=0; ax<sx; ax++)
- {
+ {
register int b=(*s++)>>4;
if(b)
*td++=lookup8[b];
else
td++;
}
- } else if (opcode == 1) // 8bit direct
+ s+=glyph_bitmap->pitch-sx;
+ d+=buffer_stride;
+ }
+ break;
+ case 1: // 8bit direct
+ for (int ay=0; ay<sy; ay++)
{
register __u8 *td=d;
register int ax;
for (ax=0; ax<sx; ax++)
- {
+ {
register int b=*s++;
*td++^=b;
}
- } else
+ s+=glyph_bitmap->pitch-sx;
+ d+=buffer_stride;
+ }
+ break;
+ case 2: // 16bit
+ for (int ay=0; ay<sy; ay++)
+ {
+ register __u16 *td=(__u16*)d;
+ register int ax;
+ for (ax=0; ax<sx; ax++)
+ {
+ register int b=(*s++)>>4;
+ if(b)
+ *td++=lookup16[b];
+ else
+ td++;
+ }
+ s+=glyph_bitmap->pitch-sx;
+ d+=buffer_stride;
+ }
+ break;
+ case 3: // 32bit
+ for (int ay=0; ay<sy; ay++)
{
register __u32 *td=(__u32*)d;
register int ax;
for (ax=0; ax<sx; ax++)
- {
+ {
register int b=(*s++)>>4;
if(b)
*td++=lookup32[b];
else
td++;
}
+ s+=glyph_bitmap->pitch-sx;
+ d+=buffer_stride;
}
- s+=glyph_bitmap->pitch-sx;
- d+=buffer_stride;
+ default:
+ break;
}
+ }
}
}
}
surface.x=lcd->size().width();
surface.y=lcd->size().height();
- surface.bpp=8;
- surface.bypp=1;
surface.stride=lcd->stride();
+ surface.bypp=surface.stride / surface.x;
+ surface.bpp=surface.bypp*8;
surface.data=lcd->buffer();
-
- surface.clut.colors=256;
+ surface.clut.colors=0;
surface.clut.data=0;
+
m_pixmap = new gPixmap(&surface);
}
#include <lib/gdi/region.h>
#include <lib/gdi/accel.h>
+#define RBG565
+
gLookup::gLookup()
:size(0), lookup(0)
{
{
for (int y=area.top(); y<area.bottom(); y++)
memset(((__u8*)surface->data)+y*surface->stride+area.left(), color.color, area.width());
+ } else if (surface->bpp == 16)
+ {
+ __u32 icol;
+
+ if (surface->clut.data && color < surface->clut.colors)
+ icol=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b);
+ else
+ icol=0x10101*color;
+#ifdef RBG565
+ __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11;
+#else
+ __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3;
+#endif
+ for (int y=area.top(); y<area.bottom(); y++)
+ {
+ __u16 *dst=(__u16*)(((__u8*)surface->data)+y*surface->stride+area.left()*surface->bypp);
+ int x=area.width();
+ while (x--)
+ *dst++=col;
+ }
} else if (surface->bpp == 32)
{
__u32 col;
while (x--)
*dst++=col;
}
+ } else if (surface->bpp == 16)
+ {
+ __u32 icol = color.argb();
+#ifdef RBG565
+ __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11;
+#else
+ __u16 col = ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3;
+#endif
+ for (int y=area.top(); y<area.bottom(); y++)
+ {
+ __u16 *dst=(__u16*)(((__u8*)surface->data)+y*surface->stride+area.left()*surface->bypp);
+ int x=area.width();
+ while (x--)
+ *dst++=col;
+ }
} else
eWarning("couldn't rgbfill %d bpp", surface->bpp);
}
}
-static void blit_8i_to_32(__u32 *dst, __u8 *src, __u32 *pal, int width)
+static inline void blit_8i_to_32(__u32 *dst, __u8 *src, __u32 *pal, int width)
{
while (width--)
*dst++=pal[*src++];
}
-static void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width)
+static inline void blit_8i_to_32_at(__u32 *dst, __u8 *src, __u32 *pal, int width)
{
while (width--)
{
}
}
+static inline void blit_8i_to_16(__u16 *dst, __u8 *src, __u32 *pal, int width)
+{
+ while (width--)
+ *dst++=pal[*src++] & 0xFFFF;
+}
+
+static inline void blit_8i_to_16_at(__u16 *dst, __u8 *src, __u32 *pal, int width)
+{
+ while (width--)
+ {
+ if (!(pal[*src]&0x80000000))
+ {
+ src++;
+ dst++;
+ } else
+ *dst++=pal[*src++] & 0xFFFF;
+ }
+}
+
/* WARNING, this function is not endian safe! */
static void blit_8i_to_32_ab(__u32 *dst, __u8 *src, __u32 *pal, int width)
{
srcptr+=src.surface->stride;
dstptr+=surface->stride;
}
+ } else if ((surface->bpp == 16) && (src.surface->bpp==8))
+ {
+ __u8 *srcptr=(__u8*)src.surface->data;
+ __u8 *dstptr=(__u8*)surface->data; // !!
+ __u32 pal[256];
+
+ for (int i=0; i<256; ++i)
+ {
+ __u32 icol;
+ if (src.surface->clut.data && (i<src.surface->clut.colors))
+ icol=(src.surface->clut.data[i].a<<24)|(src.surface->clut.data[i].r<<16)|(src.surface->clut.data[i].g<<8)|(src.surface->clut.data[i].b);
+ else
+ icol=0x010101*i;
+#ifdef RBG565
+ pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11;
+#else
+ pal[i]=icol&0xFF000000 | ((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3;
+#endif
+ pal[i]^=0xFF000000;
+ }
+
+ srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride;
+ dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
+
+ if (flag & blitAlphaBlend)
+ eWarning("ignore unsupported 8bpp -> 16bpp alphablend!");
+
+ for (int y=0; y<area.height(); y++)
+ {
+ int width=area.width();
+ unsigned char *psrc=(unsigned char*)srcptr;
+ __u16 *dst=(__u16*)dstptr;
+ if (flag & blitAlphaTest)
+ blit_8i_to_16_at(dst, psrc, pal, width);
+ else
+ blit_8i_to_16(dst, psrc, pal, width);
+ srcptr+=src.surface->stride;
+ dstptr+=surface->stride;
+ }
+ } else if ((surface->bpp == 16) && (src.surface->bpp==32))
+ {
+ __u8 *srcptr=(__u8*)src.surface->data;
+ __u8 *dstptr=(__u8*)surface->data;
+
+ srcptr+=srcarea.left()+srcarea.top()*src.surface->stride;
+ dstptr+=area.left()+area.top()*surface->stride;
+
+ if (flag & blitAlphaBlend)
+ eWarning("ignore unsupported 32bpp -> 16bpp alphablend!");
+
+ for (int y=0; y<area.height(); y++)
+ {
+ int width=area.width();
+ __u32 *srcp=(__u32*)srcptr;
+ __u16 *dstp=(__u16*)dstptr;
+
+ if (flag & blitAlphaTest)
+ {
+ while (width--)
+ {
+ if (!((*srcp)&0xFF000000))
+ {
+ srcp++;
+ dstp++;
+ } else
+ {
+ __u32 icol = *srcp++;
+#ifdef RBG565
+ *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11;
+#else
+ *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3;
+#endif
+ }
+ }
+ } else
+ {
+ while (width--)
+ {
+ __u32 icol = *srcp++;
+#ifdef RBG565
+ *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF) >> 2) << 5 | (icol & 0xFF00) >> 11;
+#else
+ *dstp++=((icol & 0xFF0000) >> 19) << 11 | ((icol & 0xFF00) >> 10) << 5 | (icol & 0xFF) >> 3;
+#endif
+ }
+ }
+ srcptr+=src.surface->stride;
+ dstptr+=surface->stride;
+ }
} else
eWarning("cannot blit %dbpp from %dbpp", surface->bpp, src.surface->bpp);
}
void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
{
__u8 *srf8 = 0;
- __u32 *srf32 = 0;
+ __u16 *srf16 = 0;
+ __u32 *srf32 = 0;
int stride = surface->stride;
-
+
if (clip.rects.empty())
return;
-
+
+ __u16 col16;
__u32 col = 0;
if (surface->bpp == 8)
- {
srf8 = (__u8*)surface->data;
- } else if (surface->bpp == 32)
+ else
{
srf32 = (__u32*)surface->data;
-
if (surface->clut.data && color < surface->clut.colors)
col=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b);
else
col=0x10101*color;
- col^=0xFF000000;
+ col^=0xFF000000;
}
-
+
+ if (surface->bpp == 16)
+ {
+#ifdef RBG565
+ col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF) >> 2) << 5 | (col & 0xFF00) >> 11;
+#else
+ col16=((col & 0xFF0000) >> 19) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF) >> 3;
+#endif
+ }
+
int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y();
int dx, dy, x, y, s1, s2, e, temp, swap, i;
dy=abs(yb-ya);
} else
swap=0;
e = 2*dy-dx;
-
+
int lasthit = 0;
for(i=1; i<=dx; i++)
{
} while (!clip.rects[a].contains(x, y));
lasthit = a;
}
-
+
if (srf8)
srf8[y * stride + x] = color;
- if (srf32)
+ else if (srf16)
+ srf16[y * stride/2 + x] = col16;
+ else
srf32[y * stride/4 + x] = col;
fail:
while (e>=0)
{
- if (swap==1) x+=s1;
- else y+=s2;
+ if (swap==1)
+ x+=s1;
+ else
+ y+=s2;
e-=2*dx;
}
- if (swap==1)
- y+=s2;
+
+ if (swap==1)
+ y+=s2;
else
x+=s1;
e+=2*dy;
eDBoxLCD *eDBoxLCD::instance;
-eLCD::eLCD(eSize size): res(size)
+eLCD::eLCD()
{
lcdfd = -1;
locked=0;
- _buffer=new unsigned char[res.height()*res.width()];
- memset(_buffer, 0, res.height()*res.width());
- _stride=res.width();
+}
+
+void eLCD::setSize(int xres, int yres, int bpp)
+{
+ res = eSize(xres, yres);
+ _buffer=new unsigned char[xres * yres * bpp/8];
+ memset(_buffer, 0, res.height()*res.width()*bpp/8);
+ _stride=res.width()*bpp/8;
+ eDebug("lcd buffer %p %d bytes, stride %d", _buffer, xres*yres*bpp/8, _stride);
}
eLCD::~eLCD()
locked=0;
}
-eDBoxLCD::eDBoxLCD(): eLCD(eSize(132, 64))
+eDBoxLCD::eDBoxLCD()
{
+ int xres=132, yres=64, bpp=8;
is_oled = 0;
#ifndef NO_LCD
lcdfd = open("/dev/dbox/oled0", O_RDWR);
int i=LCD_MODE_BIN;
ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
inverted=0;
+ FILE *f = fopen("/proc/stb/lcd/xres", "r");
+ if (f)
+ {
+ int tmp;
+ if (fscanf(f, "%x", &tmp) == 1)
+ xres = tmp;
+ fclose(f);
+ f = fopen("/proc/stb/lcd/yres", "r");
+ if (f)
+ {
+ if (fscanf(f, "%x", &tmp) == 1)
+ yres = tmp;
+ fclose(f);
+ f = fopen("/proc/stb/lcd/bpp", "r");
+ if (f)
+ {
+ if (fscanf(f, "%x", &tmp) == 1)
+ bpp = tmp;
+ fclose(f);
+ }
+ }
+ is_oled = 3;
+ }
}
+ setSize(xres, yres, bpp);
}
void eDBoxLCD::setInverted(unsigned char inv)
{
inverted=inv;
- update();
+ update();
}
int eDBoxLCD::setLCDContrast(int contrast)
void eDBoxLCD::update()
{
- if (!is_oled || is_oled == 2)
+ if (lcdfd >= 0)
{
- unsigned char raw[132*8];
- int x, y, yy;
- for (y=0; y<8; y++)
+ if (!is_oled || is_oled == 2)
{
- for (x=0; x<132; x++)
+ unsigned char raw[132*8];
+ int x, y, yy;
+ for (y=0; y<8; y++)
{
- int pix=0;
- for (yy=0; yy<8; yy++)
+ for (x=0; x<132; x++)
{
- pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
+ int pix=0;
+ for (yy=0; yy<8; yy++)
+ {
+ pix|=(_buffer[(y*8+yy)*132+x]>=108)<<yy;
+ }
+ raw[y*132+x]=(pix^inverted);
}
- raw[y*132+x]=(pix^inverted);
}
- }
- if (lcdfd >= 0)
write(lcdfd, raw, 132*8);
- } else
- {
- unsigned char raw[64*64];
- int x, y;
- memset(raw, 0, 64*64);
- for (y=0; y<64; y++)
+ }
+ else if (is_oled == 3) {
+ FILE *f = fopen("/tmp/bla", "w+");
+ if (f) {
+ fwrite(_buffer, _stride * res.height(), 1, f);
+ fclose(f);
+ }
+ write(lcdfd, _buffer, _stride * res.height());
+ }
+ else
{
- int pix=0;
- for (x=0; x<128 / 2; x++)
+ unsigned char raw[64*64];
+ int x, y;
+ memset(raw, 0, 64*64);
+ for (y=0; y<64; y++)
{
- pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
- if (inverted)
- pix = 0xFF - pix;
- raw[y*64+x] = pix;
+ int pix=0;
+ for (x=0; x<128 / 2; x++)
+ {
+ pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
+ if (inverted)
+ pix = 0xFF - pix;
+ raw[y*64+x] = pix;
+ }
}
- }
- if (lcdfd >= 0)
write(lcdfd, raw, 64*64);
+ }
}
}
class eLCD
{
#ifdef SWIG
- eLCD(eSize size);
+ eLCD();
~eLCD();
#else
protected:
+ void setSize(int xres, int yres, int bpp);
eSize res;
unsigned char *_buffer;
int lcdfd;
int islocked() { return locked; }
bool detected() { return lcdfd >= 0; }
#ifndef SWIG
- eLCD(eSize size);
+ eLCD();
virtual ~eLCD();
__u8 *buffer() { return (__u8*)_buffer; }
int stride() { return _stride; }
eSize size() { return res; }
-
virtual void update()=0;
#endif
};
eTextPara::forceReplacementGlyph(i);
eWidgetDesktop dsk(eSize(720, 576));
- eWidgetDesktop dsk_lcd(eSize(132, 64));
-
+ eWidgetDesktop dsk_lcd(my_lcd_dc->size());
+
dsk.setStyleID(0);
- dsk_lcd.setStyleID(1);
-
+ dsk_lcd.setStyleID(my_lcd_dc->size().width() == 96 ? 2 : 1);
+
/* if (double_buffer)
{
eDebug(" - double buffering found, enable buffered graphics mode.");
guiObject.setShadowOffset(parsePosition(value, scale))
elif attrib == 'noWrap':
guiObject.setNoWrap(1)
+ elif attrib == 'id':
+ pass
else:
raise SkinError("unsupported attribute " + attrib + "=" + value)
except int:
for (path, dom_skin) in skins:
loadSingleSkinData(desktop, dom_skin, path)
-def lookupScreen(name):
+def lookupScreen(name, style_id = None):
for (path, skin) in dom_skins:
# first, find the corresponding screen element
for x in skin.findall("screen"):
if x.attrib.get('name', '') == name:
- return x, path
+ screen_style_id = int(x.attrib.get('id', None) or '0')
+ if style_id is None or screen_style_id == style_id:
+ return x, path
return None, None
class additionalWidget:
name = "<embedded-in-'%s'>" % screen.__class__.__name__
+ style_id = desktop.getStyleID();
+
# try all skins, first existing one have priority
for n in names:
- myscreen, path = lookupScreen(n)
+ myscreen, path = lookupScreen(n, style_id)
if myscreen is not None:
# use this name for debug output
name = n
# try uncompiled embedded skin
if myscreen is None and getattr(screen, "skin", None):
print "Looking for embedded skin"
- myscreen = screen.parsedSkin = xml.etree.cElementTree.fromstring(screen.skin)
+ skin_tuple = screen.skin
+ if not isinstance(skin_tuple, tuple):
+ skin_tuple = (skin_tuple,)
+ for sskin in skin_tuple:
+ parsedSkin = xml.etree.cElementTree.fromstring(sskin)
+ if style_id != 2 or parsedSkin.attrib.get('id', 0) == 2:
+ myscreen = screen.parsedSkin = parsedSkin
#assert myscreen is not None, "no skin for screen '" + repr(names) + "' found!"
if myscreen is None: