Changeset 28311


Ignore:
Timestamp:
04/02/14 13:18:37 (10 years ago)
Author:
gost
Message:

[titan] mipsel.. workaround for blitscale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/mipselport.h

    r28309 r28311  
    646646void blitscale(int posx, int posy, int width, int height, int scalewidth, int scaleheight, int flag)
    647647{
     648#ifdef BLITHELP
     649        unsigned char *quelle = NULL;
     650        unsigned char *ziehl = NULL;
     651        unsigned char *helpbuf = NULL;
     652        int zpitch = 0;
     653        int zheight = 0;
     654
     655        if(scalewidth == 0) scalewidth = width;
     656        if(scaleheight == 0) scaleheight = height;
     657
     658        if(posx < 0) posx = 0;
     659        if(posx > skinfb->width) posx = skinfb->width;
     660        if(posy < 0) posy = 0;
     661        if(posy > skinfb->height) posy = skinfb->height;
     662        if(posx + scalewidth > skinfb->width) scalewidth = skinfb->width - posx;
     663        if(posy + scaleheight > skinfb->height) scaleheight = skinfb->height - posy;
     664       
     665        if(width <= 0 || height <= 0 || scalewidth <= 0 || scaleheight <= 0) return;
     666       
     667        if(flag == 1 && (scalewidth * scaleheight * 4) > accelfb->varfbsize)
     668        {
     669                err("accelfb to small %d -> %lu ", scalewidth * scaleheight * 4, accelfb->varfbsize);
     670                return;
     671        }
     672        if(flag == 0)
     673        {
     674                quelle = accelfb->fb;
     675                ziehl = skinfb->fb + (posy * skinfb->pitch) + (posx*4);
     676                zpitch = skinfb->pitch;
     677                zheight = skinfb->height;
     678        }
     679        else
     680        {
     681                quelle = skinfb->fb;
     682                ziehl = accelfb->fb + (posy * accelfb->pitch) + (posx*4);
     683                zpitch = accelfb->pitch;
     684                zheight = accelfb->height;
     685        }
     686        helpbuf = scale(quelle, width, height, 4, scalewidth, scaleheight, 0);
     687       
     688        size_t helpb = 0;
     689        size_t helpz = 0;
     690        size_t help = 0;
     691       
     692        while(helpz < scaleheight && helpz < (zheight - posy)) {
     693                memcpy(ziehl[help], helpbuf[helpb], scalewidth*4);
     694                help = help + zpitch;
     695                helpb = helpb + scalewidth*4;
     696                helpz = helpz + 1;
     697        }
     698               
     699        free(helpbuf);
     700        if(flag == 0)
     701                blit();
     702
     703#endif
     704
    648705/*
    649706#ifndef SIMULATE
     
    743800//void blitjpg(unsigned char* buf, int posx, int posy, int width, int height, int scalewidth, int scaleheight)
    744801{
    745 #ifdef MIPSEL
     802#ifdef BLITHELP
    746803        unsigned char *helpbuf = NULL;
    747804        unsigned char *framebuf = NULL;
Note: See TracChangeset for help on using the changeset viewer.