Logo Search packages:      
Sourcecode: blender version File versions

struct ImBuf* IMB_half_y ( struct ImBuf ibuf1  )  [read]

Attention:
defined in scaling.c

Definition at line 133 of file scaling.c.

References ImBuf::depth, IMB_allocImBuf(), IMB_dupImBuf(), IMB_half_y(), ImBuf::rect, ImBuf::x, and ImBuf::y.

Referenced by IMB_half_y(), and IMB_onehalf().

{
      struct ImBuf *ibuf2;
      uchar *p1,*p2,*_p1,*dest;
      short a,r,g,b,x,y;

      if (ibuf1==0) return (0);
      if (ibuf1->rect == 0) return (0);
      if (ibuf1->y <= 1) return(IMB_dupImBuf(ibuf1));

      ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth,1,0);
      if (ibuf2==0) return (0);

      _p1 = (uchar *) ibuf1->rect;
      dest=(uchar *) ibuf2->rect;

      for(y=ibuf2->y ; y>0 ; y--){
            p1 = _p1;
            p2 = _p1 + (ibuf1->x << 2);
            for(x = ibuf2->x ; x>0 ; x--){
                  a = *(p1++) ;
                  b = *(p1++) ;
                  g = *(p1++) ;
                  r = *(p1++);
                  a += *(p2++) ;
                  b += *(p2++) ;
                  g += *(p2++) ;
                  r += *(p2++);
                  *(dest++) = a >> 1;
                  *(dest++) = b >> 1;
                  *(dest++) = g >> 1;
                  *(dest++) = r >> 1;
            }
            _p1 += (ibuf1->x << 3);
      }
      return (ibuf2);
}


Generated by  Doxygen 1.6.0   Back to index