Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
244 chris 1
// This file is included by SWTri.cpp and should not be built directly by the project.
2
{
3
        int premult;
4
        #if defined(MOD_ARGB) && defined(GLOBAL_ARGB)
5
        {
6
                premult = ((globalDiffuse.a*a)>>24);
7
                alpha = (alpha * premult) >> 8;
8
                tex =   ((((tex&0xff0000)*((globalDiffuse.r*r)>>24))>>8)&0xff0000)|
9
                        ((((tex&0x00ff00)*((globalDiffuse.g*g)>>24))>>8)&0x00ff00)|
10
                        ((((tex&0x0000ff)*((globalDiffuse.b*b)>>24))>>8)&0x0000ff);
11
        }
12
        #elif !defined(MOD_ARGB) && defined(GLOBAL_ARGB)
13
        {
14
                premult = globalDiffuse.a;
15
                alpha = (alpha * premult) >> 8;
16
                tex =   ((((tex&0xff0000)*globalDiffuse.r)>>8)&0xff0000)|
17
                        ((((tex&0x00ff00)*globalDiffuse.g)>>8)&0x00ff00)|
18
                        ((((tex&0x0000ff)*globalDiffuse.b)>>8)&0x0000ff);
19
        }
20
        #elif defined(MOD_ARGB) && !defined(GLOBAL_ARGB)
21
        {
22
                premult = a>>16;
23
                alpha = (alpha * premult) >> 8;
24
                tex =   ((((tex&0xff0000)*(r>>16))>>8)&0xff0000)|
25
                        ((((tex&0x00ff00)*(g>>16))>>8)&0x00ff00)|
26
                        ((((tex&0x0000ff)*(b>>16))>>8)&0x0000ff);
27
        }
28
        #endif
29
 
30
        // linear blend expects pixel to already be premultiplied by alpha
31
        #if defined(LINEAR_BLEND) && (defined(MOD_ARGB) || defined(GLOBAL_ARGB))
32
        {
33
                int r = (((tex&0xff0000)*premult)>>8)&0xff0000;
34
                int g = (((tex&0x00ff00)*premult)>>8)&0x00ff00;
35
                int b = (((tex&0x0000ff)*premult)>>8)&0x0000ff;
36
                tex = r|g|b;
37
        }      
38
        #endif
39
}