Changeset 15253


Ignore:
Timestamp:
04/14/12 02:28:07 (11 years ago)
Author:
nit
Message:

[titan] cleanup, optimize gmulti epg

Location:
titan/titan
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/gmultiepg.h

    r14209 r15253  
    111111
    112112
    113 int calcgmultiepg(struct channel* tmpchannel, struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int linecol1, int linecol2, int linecol3, int* aktline, struct skin** pchnode, struct skin** pchnode1, int height, int picheight)
     113int calcgmultiepg(struct channel* tmpchannel, struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int linecol1, int linecol2, int linecol3, int* aktline, struct skin** pchnode, struct skin** pchnode1, int height, int picheight, int epgicon, long deaktivcol)
    114114{
    115115        int treffer = 0, gridbr = 0, aktcol = 0, nottuneable = 0;
     
    119119        time_t nowtime = time(NULL);
    120120
    121         int epgpicon = getconfigint("epgpicon", NULL);
    122 
    123121        if(tmpchannel != NULL && tmpchannel->servicetype == status.servicetype)
    124122        {
     
    129127                {
    130128                        chnode->bgspace = 1;
    131                         tmpstr = createpiconpath(tmpchannel, 0);
    132                         if(epgpicon == 1 && tmpstr != NULL && strstr(tmpstr, "default.png") == NULL)
     129                       
     130                        if(epgpicon == 1) tmpstr = createpiconpath(tmpchannel, 0);
     131                        if(tmpstr != NULL && strstr(tmpstr, "default.png") == NULL)
    133132                        {
    134133                                changepic(chnode, tmpstr);
     
    193192                                        chnode1->hspace = 2;
    194193                                        if(nottuneable == 1)
    195                                                 chnode1->deaktivcol = convertcol("deaktivcol");
     194                                                chnode1->deaktivcol = deaktivcol;
    196195                                       
    197196                                        //TODO: record timeline
     
    226225                                        chnode1->bgspace = 1;
    227226                                        if(nottuneable == 1)
    228                                                 chnode1->deaktivcol = convertcol("deaktivcol");
     227                                                chnode1->deaktivcol = deaktivcol;
    229228                                }
    230229                        }
     
    233232                        if(nottuneable == 1)
    234233                        {
    235                                 chnode->deaktivcol = convertcol("deaktivcol");
     234                                chnode->deaktivcol = deaktivcol;
    236235                                (*aktline)--;
    237236                        }
     
    252251        int height = getskinconfigint("epgheight", NULL);
    253252        int picheight = getskinconfigint("epgpicheight", NULL);
     253        int epgpicon = getconfigint("epgpicon", NULL);
     254        long deaktivcol = convertcol("deaktivcol");
    254255
    255256        if(height < 1) height = 35;
     
    261262        while(tmpchannel != NULL)
    262263        {
    263                 if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight) == 1)
     264                if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgicon, deaktivcol) == 1)
    264265                        treffer = 1;
    265266                tmpchannel = tmpchannel->next;
     
    279280        int height = getskinconfigint("epgheight", NULL);
    280281        int picheight = getskinconfigint("epgpicheight", NULL);
     282        int epgpicon = getconfigint("epgpicon", NULL);
     283        long deaktivcol = convertcol("deaktivcol");
    281284
    282285        if(height < 1) height = 35;
     
    288291        while(tmpbouquet != NULL)
    289292        {
    290                 if(calcgmultiepg(tmpbouquet->channel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight) == 1)
     293                if(calcgmultiepg(tmpbouquet->channel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgicon, deaktivcol) == 1)
    291294                        treffer = 1;
    292295                tmpbouquet = tmpbouquet->next;
     
    306309        int height = getskinconfigint("epgheight", NULL);
    307310        int picheight = getskinconfigint("epgpicheight", NULL);
     311        int epgpicon = getconfigint("epgpicon", NULL);
     312        long deaktivcol = convertcol("deaktivcol");
    308313
    309314        if(height < 1) height = 35;
     
    316321                if(tmpchannel->provider == providernode)
    317322                {
    318                         if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight) == 1)
     323                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgicon, deaktivcol) == 1)
    319324                                treffer = 1;
    320325                }
     
    337342        int height = getskinconfigint("epgheight", NULL);
    338343        int picheight = getskinconfigint("epgpicheight", NULL);
     344        int epgpicon = getconfigint("epgpicon", NULL);
     345        long deaktivcol = convertcol("deaktivcol");
    339346
    340347        if(height < 1) height = 35;
     
    347354                if(tmpchannel->transponder != NULL && tmpchannel->transponder->orbitalpos == satnode->orbitalpos)
    348355                {
    349                         if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight) == 1)
     356                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgicon, deaktivcol) == 1)
    350357                                treffer = 1;
    351358                }
     
    366373        int height = getskinconfigint("epgheight", NULL);
    367374        int picheight = getskinconfigint("epgpicheight", NULL);
     375        int epgpicon = getconfigint("epgpicon", NULL);
     376        long deaktivcol = convertcol("deaktivcol");
    368377
    369378        if(height < 1) height = 35;
     
    376385                if(tmpchannel->name != NULL && (tmpchannel->name[0] == character || tmpchannel->name[0] == character + 32))
    377386                {
    378                         if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight) == 1)
     387                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgicon, deaktivcol) == 1)
    379388                                treffer = 1;
    380389                }
  • titan/titan/menulist.h

    r15189 r15253  
    260260                        break;
    261261                }
    262                 if(listbox->select != NULL && rcret==getrcconfigint("rcok",NULL))
     262                if(listbox->select != NULL && rcret==getrcconfigint("rcok", NULL))
    263263                {
    264264                        ret = (struct menulist*)listbox->select->handle;
  • titan/titan/sh4port.h

    r15252 r15253  
    478478}
    479479
    480 void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight)
     480void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight, int mwidth, int mheight, int halign, int valign)
    481481{
    482482        STMFBIO_BLT_EXTERN_DATA blt_data;
    483483        memset(&blt_data, 0, sizeof(STMFBIO_BLT_EXTERN_DATA));
     484       
     485        //auto scale to mwidth / mheight
     486        if(scalewidth == 1 && scaleheight == 1)
     487                calcautoscale(width, height, mwidth, mheight, &scalewidth, &scaleheight);
     488               
     489        if(scalewidth == 0)  scalewidth = width;
     490        if(scaleheight == 0) scaleheight = height;
     491
     492        if(width > mwidth) scalewidth = mwidth;
     493        if(height > mheight) scaleheight = mheight;
     494
     495        if(halign == CENTER)
     496                posx += mwidth / 2 - width / 2;
     497        else if(halign == RIGHT)
     498                posx += mwidth - width;
     499        if(valign == MIDDLE)
     500                posy += mheight / 2 - height / 2;
     501        else if(valign == BOTTOM)
     502                posy += mheight - height;
    484503
    485504        blt_data.operation  = BLT_OP_COPY;
     
    496515        blt_data.dst_top    = posy;
    497516       
    498         if(scalewidth == 0)  scalewidth = width;
    499         if(scaleheight == 0) scaleheight = height;
    500        
    501517        blt_data.dst_right  = posx + scalewidth;
    502518        blt_data.dst_bottom = posy + scaleheight;
  • titan/titan/skin.h

    r15251 r15253  
    15581558        png_bytepp row_pointers = NULL;
    15591559        png_bytep sig = NULL;
    1560         unsigned char* directbuf = NULL;
    15611560
    15621561        fd = fopen(filename, "rb");
     
    16421641                png_set_gamma(png_ptr, 2.2, gamma);
    16431642
    1644 /*
    1645         if(mwidth > 0 && mheight > 0 && *width <= mwidth && *height <= mheight)
    1646         {
    1647                 if(halign == CENTER)
    1648                         posx += mwidth / 2 - (*width) / 2;
    1649                 else if(halign == RIGHT)
    1650                         posx += mwidth - (*width);
    1651                 if(valign == MIDDLE)
    1652                         posy += mheight / 2 - (*height) / 2;
    1653                 else if(valign == BOTTOM)
    1654                         posy += mheight - (*height);
    1655                 directbuf = skinfb->fb + (posy * skinfb->pitch) + (posx * skinfb->colbytes);
    1656                 if(color_type == PNG_COLOR_TYPE_RGB)
    1657                         png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
    1658                 png_set_bgr(png_ptr);
    1659         }
    1660 */
    1661 
    16621643        png_read_update_info(png_ptr, info_ptr);
    16631644        *rowbytes = png_get_rowbytes(png_ptr, info_ptr);
    16641645        *channels = (int)png_get_channels(png_ptr, info_ptr);
    16651646
    1666         //if(directbuf == NULL)
    1667                 buf = malloc((*rowbytes) * (*height));
    1668         //else
    1669         //      buf = directbuf;
    1670 
     1647        buf = malloc((*rowbytes) * (*height));
    16711648        if(buf == NULL)
    16721649        {
     
    16841661                err("%s unknown error", filename);
    16851662                free(sig);
    1686                 if(directbuf == NULL) free(buf);
    16871663                fclose(fd);
    16881664                return NULL;
    16891665        }
    16901666
    1691         //if(directbuf == NULL)
    1692         //{
    1693                 for (y = 0; y < (*height); ++y)
    1694                         row_pointers[y] = (png_bytep)buf + y * (*rowbytes);
    1695         //}
    1696         //else
    1697         //{
    1698         //      for (y = 0;  y < (*height);  ++y)
    1699         //              row_pointers[y] = (png_bytep)buf + y * skinfb->pitch;
    1700         //}
     1667        for (y = 0; y < (*height); ++y)
     1668                row_pointers[y] = (png_bytep)buf + y * (*rowbytes);
    17011669
    17021670        png_read_image(png_ptr, row_pointers);
     
    17131681
    17141682        debug(1000, "out");
    1715         //if(directbuf == NULL)
    1716                 return buf;
    1717         //else
    1718         //      return NULL;
     1683        return buf;
    17191684}
    17201685
     
    17231688        debug(1000, "in");
    17241689        unsigned char *buf = NULL, *scalebuf = NULL;
    1725         int memfd = -1, py = 0, pyh = 0, pxw = 0, diff = 0; //px = 0
     1690        int memfd = -1, py = 0, pyh = 0, pxw = 0, diff = 0;
    17261691        unsigned long width, height, rowbytes;
    17271692        int channels, length;
    1728         unsigned char *src; // red, green, blue, alpha;
    1729         //unsigned long color;
     1693        unsigned char *src;
    17301694        png_uint_32 y, x;
    17311695        struct pic* picnode = NULL;
     
    17451709        {
    17461710                if(pictype == 0)
    1747                 {
    1748                         //deaktivate: draws transparent pixel
    1749                         //read direkt into framebuffer
    1750                         //if(scaleheight == 0 && scalewidth == 0)
    1751                         //      buf = readpng(filename, &width, &height, &rowbytes, &channels, posx, posy, mwidth, mheight, halign, valign);
    1752                         //else
    17531711                        buf = readpng(filename, &width, &height, &rowbytes, &channels, 0, 0, 0, 0, 0, 0);
    1754                 }
    17551712                else if(pictype == 1)
    17561713                        readjpg(filename, &width, &height, &rowbytes, &channels, &buf, &memfd);
     
    17951752        }
    17961753
    1797         if(width > mwidth) width = mwidth;
    1798         if(height > mheight) height = mheight;
    1799 
    1800         if(halign == CENTER)
    1801                 posx += mwidth / 2 - width / 2;
    1802         else if(halign == RIGHT)
    1803                 posx += mwidth - width;
    1804         if(valign == MIDDLE)
    1805                 posy += mheight / 2 - height / 2;
    1806         else if(valign == BOTTOM)
    1807                 posy += mheight - height;
    1808 
    18091754        if(pictype == 0)
    18101755        {
     1756                if(width > mwidth) width = mwidth;
     1757                if(height > mheight) height = mheight;
     1758
     1759                if(halign == CENTER)
     1760                        posx += mwidth / 2 - width / 2;
     1761                else if(halign == RIGHT)
     1762                        posx += mwidth - width;
     1763                if(valign == MIDDLE)
     1764                        posy += mheight / 2 - height / 2;
     1765                else if(valign == BOTTOM)
     1766                        posy += mheight - height;
     1767
    18111768                py = (posy * skinfb->width) + posx;
    18121769                pyh = py + (height * skinfb->width);
     
    18451802                        }
    18461803                }
    1847 /*
    1848                 for (y = 0; y < height; ++y)
    1849                 {
    1850                         py = (posy + y) * skinfb->width;
    1851                         src = buf + y * rowbytes;
    1852                         for (x = 0; x < width; x++)
    1853                         {
    1854                                 red = *src++;
    1855                                 green = *src++;
    1856                                 blue = *src++;
    1857                                 if(channels == 3)
    1858                                         alpha = 255;
    1859                                 else
    1860                                         alpha = *src++;
    1861 
    1862                                 if(alpha == 0) continue;
    1863                                 color = (alpha << 24) | (red << 16) | (green << 8) | blue;
    1864                                 //if(color & 0xff000000 == 0) continue;
    1865                                 drawpixelfast(posx + x, py, color);
    1866                         }
    1867                 }
    1868 */
    18691804        }
    18701805        else if(pictype == 1 && memfd > -1)
    1871                 blitjpg(buf, posx, posy, width, height, scalewidth, scaleheight );
     1806                blitjpg(buf, posx, posy, width, height, scalewidth, scaleheight, mwidth, mheight, halign, valign);
    18721807
    18731808        if(picnode == NULL)
Note: See TracChangeset for help on using the changeset viewer.