⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 render_rend.c.svn-base

📁 A Flash Player with ActionScript support. Write in C and C++. It have two part, one is Player and an
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
voidfillLineBitmap(GraphicDevice *gd,FillStyleDef *f, long y, long start, long end) {    static int flag;    int coun;    int n;    long x1,y1,dx,dy;    Matrix *m;    long start1,end1;    struct DefineBitsJPEG *b;    unsigned char *pixels;    TYPE *p,*p1,*line1,*ppmax,*ppmin;    unsigned char *point2,*line2;    Color *cmap;    long pixbpl;    TYPE pixel;    int offset;    unsigned char *alpha_table;    // b=(struct DefineBitsJPEG *)(DictionaryP->dict[f->BitmapId]);    b=(struct DefineBitsJPEG *)(player_p->_level0_p->dict_p->dict[f->BitmapId]);    m = &f->BitmapMatrix;    if (!b)        return;    // printf("to fill bitmap    ...............................................\n");    //   if (clip(gd,&y,&start,&end))    //      return;    start1=start;    end1=end;    if(save==1&&currentpic&&gmaskflag==0) {        ppmax=(unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin+1)*(idrect.Ymax-idrect.Ymin+1);        ppmin=(unsigned long*)(currentpic->pp);        start /= FRAC;        end /= FRAC;        n = end - start;        //  printf("y is %ld start is %ld end is %ld\n",y,start,end);        p = (TYPE *) (gd->canvasBuffer + gd->bpl*y + start * 2);        x1 = (long) (m->ScaleX * start + m->RotateSkew0 * y + m->TranslateX);        y1 = (long) (m->RotateSkew1 * start + m->ScaleY * y + m->TranslateY);        dx = (long) (m->ScaleX);        dy = (long) (m->RotateSkew1);        pixels = b->PixelsP;        pixbpl = b->Bpl;        cmap = f->cmap;        if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))>ppmax)            return;        if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))<ppmin)            return;        line1=(TYPE *)(currentpic->pp+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin));        /* if(currentpic->fillflag==0)           {           printf("to fillflag===0\n");           currentpic->sp[y-idrect.Ymin].x1=start-idrect.Xmin+1;           currentpic->sp[y-idrect.Ymin].x2=end-idrect.Xmin-1;           }*/        p1=&line1[start-idrect.Xmin];        if (b->Alpha_bufP == NULL) {            while (n) {                if (x1 >= 0 && y1 >= 0 &&                        (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                    pixel = cmap[pixels[(y1 >> 16) * pixbpl + (x1 >> 16)]].pixel;                    if((p1<ppmax)&&(p1>ppmin))                        *p1=(pixel&0x00FFFFFF)|((0xFF000000));                    //*p1=pixel|((alpha)&(0x000000ff));                    //*p1 = pixel;                    //*p1=*p;                }                x1 += dx;                y1 += dy;                p1++;                n--;            }        } else if (f->alpha_table) {            alpha_table = f->alpha_table;            while (n) {                if (x1 >= 0 && y1 >= 0 &&                        (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                    offset = (y1 >> 16) * pixbpl + (x1 >> 16);                    pixel = cmap[pixels[offset]].pixel;                    if((p1<ppmax)&&(p1>ppmin))                        *p1=(pixel&0x00FFFFFF)|((alpha_table[b->Alpha_bufP[offset]]<<24)&(0xFF000000));                    // *p1 = mix_alpha(*p, pixel, alpha_table[b->Alpha_bufP[offset]]);                    //*p1=*p;                }                x1 += dx;                y1 += dy;                //p++;                p1++;                n--;            }        } else {            while (n) {                if (x1 >= 0 && y1 >= 0 &&                        (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                    offset = (y1 >> 16) * pixbpl + (x1 >> 16);                    pixel = cmap[pixels[offset]].pixel;                    if((p1<ppmax)&&(p1>ppmin))                        *p1=(pixel&0x00FFFFFF)|((b->Alpha_bufP[offset]<<24)&(0xFF000000));                    //*p1 = mix_alpha(*p, pixel, b->Alpha_bufP[offset]);                    //*p1=*p;                }                x1 += dx;                y1 += dy;                // p++;                p1++;                n--;            }        }    }    else        if(gmaskflag==1) {            {                struct MaskEntry *currentmaskentry;                unsigned char *currentmaskpointer;                currentmaskentry=player_p->_level0_p->mask_stack_p;                currentmaskpointer=currentmaskentry->maskpointer;                start /= FRAC;                end /= FRAC;                n = end - start;                //  printf("y is %ld start is %ld end is %ld\n",y,start,end);                p = (TYPE *) (gd->canvasBuffer + gd->bpl*y + start * 2);                x1 = (long) (m->ScaleX * start + m->RotateSkew0 * y + m->TranslateX);                y1 = (long) (m->RotateSkew1 * start + m->ScaleY * y + m->TranslateY);                dx = (long) (m->ScaleX);                dy = (long) (m->RotateSkew1);                pixels = b->PixelsP;                pixbpl = b->Bpl;                cmap = f->cmap;                /* if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))>ppmax)                return;                if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))<ppmin)                return;*/                // line1=(TYPE *)(currentpic->pp+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin));                line2 = (unsigned char *)currentmaskpointer +(gd->bpl*y)/2;                /* if(currentpic->fillflag==0)                   {                   printf("to fillflag===0\n");                   currentpic->sp[y-idrect.Ymin].x1=start-idrect.Xmin+1;                   currentpic->sp[y-idrect.Ymin].x2=end-idrect.Xmin-1;                   }*/                point2=&line2[start];                //   p1=&line1[start-idrect.Xmin];                if (b->Alpha_bufP == NULL) {                    while (n) {                        if (x1 >= 0 && y1 >= 0 &&                                (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                            pixel = cmap[pixels[(y1 >> 16) * pixbpl + (x1 >> 16)]].pixel;                            if((((unsigned long)(point2)-(unsigned long)(currentmaskpointer))>0)&&(((unsigned long)(point2)-(unsigned long)(currentmaskpointer))<canvassize))                                *point2=1;                            //*p1=pixel|((alpha)&(0x000000ff));                            //*p1 = pixel;                            //*p1=*p;                        }                        x1 += dx;                        y1 += dy;                        point2++;                        n--;                    }                } else if (f->alpha_table) {                    alpha_table = f->alpha_table;                    while (n) {                        if (x1 >= 0 && y1 >= 0 &&                                (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                            offset = (y1 >> 16) * pixbpl + (x1 >> 16);                            pixel = cmap[pixels[offset]].pixel;                            if((((unsigned long)(point2)-(unsigned long)(currentmaskpointer))>0)&&(((unsigned long)(point2)-(unsigned long)(currentmaskpointer))<canvassize))                                *point2=1;                            // *p1 = mix_alpha(*p, pixel, alpha_table[b->Alpha_bufP[offset]]);                            //*p1=*p;                        }                        x1 += dx;                        y1 += dy;                        //p++;                        point2++;                        n--;                    }                } else {                    while (n) {                        if (x1 >= 0 && y1 >= 0 &&                                (x1 >> 16) < b->Width && (y1 >> 16) < b->Height) {                            offset = (y1 >> 16) * pixbpl + (x1 >> 16);                            pixel = cmap[pixels[offset]].pixel;                            if((((unsigned long)(point2)-(unsigned long)(currentmaskpointer))>0)&&(((unsigned long)(point2)-(unsigned long)(currentmaskpointer))<canvassize))                                *point2=1;                            //*p1 = mix_alpha(*p, pixel, b->Alpha_bufP[offset]);                            //*p1=*p;                        }                        x1 += dx;                        y1 += dy;                        // p++;                        *point2++;                        n--;                    }                }            }        }}voidfillLineLG16(GraphicDevice *gd,struct Gradient *grad, long y, long start, long end) {    long dr,r,v,r2;    register long n;    TYPE *line,*line1,*ppmax,*ppmin;    TYPE *point,*point1;    unsigned char *point2,*line2;    Color *cp,*ramp;    Matrix *m = &grad->imat;    unsigned int start_alpha,end_alpha;    struct grend  *lgr;    long start1,end1;    //lgr=gd->gradientrend;    //if(end<start)end=start;    if(start>end)        start=end;    start1=start;    end1=end;    //printf("to filllg ..........................................................\n");    if(save==1&&currentpic&&gmaskflag==0) {        ppmax=(unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin+1)*(idrect.Ymax-idrect.Ymin+1);        ppmin=(unsigned long*)(currentpic->pp);        start_alpha = 255 - ((start & (FRAC-1)) << (8-FRAC_BITS));        end_alpha = (end & (FRAC-1)) << (8-FRAC_BITS);        //printf("start_alpha is %d end_alpha is %d\n",start_alpha,end_alpha);        start /= FRAC;        end /= FRAC;        n = end-start;        //printf("n is %ld \n",n);        r = (long) (m->ScaleX * start + m->RotateSkew0 * y + m->TranslateX);        //printf("r is %ld \n",r);        dr = (long) (m->ScaleX);        //printf("dr is %ld \n",dr);        ramp = grad->g_ramp;        line = (TYPE *)(gd->canvasBuffer + gd->bpl*y);        point = &line[start];        if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))>ppmax)            return;        if(((unsigned long*)(currentpic->pp)+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin))<ppmin)            return;        line1=(TYPE *)(currentpic->pp+(idrect.Xmax-idrect.Xmin)*(y-idrect.Ymin));        /* if(currentpic->fillflag==0)         {         currentpic->sp[y-idrect.Ymin].x1=start-idrect.Xmin;         currentpic->sp[y-idrect.Ymin].x2=end-idrect.Xmin;         }*/        point1=&line1[start-idrect.Xmin];        r2 = r + n * dr;        if ( ((r | r2) & ~255) == 0 ) {            if (!grad->g_has_alpha) {#ifdef FULL_AA                if (start_alpha < 255) {                    v = r>>16;                    if((point1<ppmax)&&(point1>ppmin))                        *point1=(((TYPE)ramp[v].pixel)&0x00FFFFFF)|(((start_alpha)<<24)&(0xFF000000));                    // *point1 = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);                    //*point1=*point;                    point1++;                    r += dr;                    n--;                }#endif /* FULL_AA */                while (n>0) {                    v = r>>16;                    //*point1 = (TYPE)ramp[v].pixel;                    if((point1<ppmax)&&(point1>ppmin))                        *point1=(((TYPE)ramp[v].pixel)&0x00FFFFFF)|((0xFF000000));                    //*point1=*point;                    point1++;                    r += dr;                    n--;                }#ifdef FULL_AA                if (end_alpha > 0) {                    v = r>>16;                    if((point1<ppmax)&&(point1>ppmin))                        *point1=(((TYPE)ramp[v].pixel)&0x00FFFFFF)|(((end_alpha)<<24)&(0xFF000000));                    //*point1 = mix_alpha(*point, (TYPE)ramp[v].pixel, end_alpha);                    //*point1=*point;                }#endif /* FULL_AA */            } else {                while (n--) {                    v = r>>16;                    cp = &ramp[v];                    if((point1<ppmax)&&(point1>ppmin))                        *point1=((cp->pixel)&0x00FFFFFF)|(((cp->Alpha)<<24)&(0xFF000000));                    //*point1 = mix_alpha(*point, cp->pixel, cp->Alpha);                    //*point1=*point;                    point1++;                    r += dr;                }            }        } else {            if (!grad->g_has_alpha) {//printf("to fill lineaa ...........................................................................................................................\n");#ifdef FULL_AA                if (start_alpha < 255)                {                    v = r>>16;                    if (v < 0)                        v = 0;                    else if (v > 255)                        v = 255;                    if((point1<ppmax)&&(point1>ppmin))                        *point1=(((TYPE)ramp[v].pixel)&0x00FFFFFF)|(((start_alpha)<<24)&(0xFF000000));                    // *point1 = mix_alpha(*point, (TYPE)ramp[v].pixel, start_alpha);                    //*point1=*point;                    point1++;                    r += dr;                    n--;                }#endif /* FULL_AA */                while (n>0) {                    v = r>>16;                    if (v < 0)                        v = 0;                    else if (v > 255)                        v = 255;                    if((point1<ppmax)&&(point1>ppmin)) {                        *point1 = (TYPE)ramp[v].pixel;                        *point1=(((TYPE)ramp[v].pixel)&0x00FFFFFF)|((0xFF000000));                    }                    //*point1=*point;                    point1++;                    r += dr;                    n--;                }#ifdef FULL_AA                if (end_alpha > 0) {                    v = r>>16;                    if (v < 0)                        v = 0;                    else if (v > 255)                        v = 255;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -