jdk/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
changeset 7766 42c1e9741ed0
parent 5506 202f599c92aa
child 9035 1255eb81cc2f
equal deleted inserted replaced
7765:a9e4a2c0600e 7766:42c1e9741ed0
    86 }
    86 }
    87 
    87 
    88 /*      blend (lerp between) two rgb quads
    88 /*      blend (lerp between) two rgb quads
    89         src and dst alpha is ignored
    89         src and dst alpha is ignored
    90         the algorithm: src*alpha+dst*(1-alpha)=(src-dst)*alpha+dst, rb and g are done separately
    90         the algorithm: src*alpha+dst*(1-alpha)=(src-dst)*alpha+dst, rb and g are done separately
    91         it's possible to verify that it's almost accurate indeed */
    91 */
    92 
       
    93 INLINE rgbquad_t
    92 INLINE rgbquad_t
    94 blendRGB(rgbquad_t dst, rgbquad_t src, rgbquad_t alpha)
    93 blendRGB(rgbquad_t dst, rgbquad_t src, rgbquad_t alpha)
    95 {
    94 {
    96     const rgbquad_t dstrb = dst & 0xFF00FF;
    95     const rgbquad_t a = alpha;
    97     const rgbquad_t dstg = dst & 0xFF00;
    96     const rgbquad_t a1 = 0xFF - alpha;
    98     const rgbquad_t srcrb = src & 0xFF00FF;
    97 
    99     const rgbquad_t srcg = src & 0xFF00;
    98     return MAKE_QUAD(
   100 
    99         (rgbquad_t)((QUAD_RED(src) * a + QUAD_RED(dst) * a1) / 0xFF),
   101     rgbquad_t drb = srcrb - dstrb;
   100         (rgbquad_t)((QUAD_GREEN(src) * a + QUAD_GREEN(dst) * a1) / 0xFF),
   102     rgbquad_t dg = srcg - dstg;
   101         (rgbquad_t)((QUAD_BLUE(src) * a + QUAD_BLUE(dst) * a1) / 0xFF),
   103 
   102         0);
   104     alpha += 1;
       
   105 
       
   106     drb *= alpha;
       
   107     dg *= alpha;
       
   108     drb >>= 8;
       
   109     dg >>= 8;
       
   110 
       
   111     return ((drb + dstrb) & 0xFF00FF) | ((dg + dstg) & 0xFF00);
       
   112 }
   103 }
   113 
   104 
   114 /*      scales rgb quad by alpha. basically similar to what's above. src alpha is retained.
   105 /*      scales rgb quad by alpha. basically similar to what's above. src alpha is retained.
   115         used for premultiplying alpha
   106         used for premultiplying alpha
   116 
   107