Logo Search packages:      
Sourcecode: blender version File versions

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

Attention:
defined in scaling.c

Definition at line 286 of file scaling.c.

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

Referenced by IMB_halflace().

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

      if (ibuf1 == 0) return (0);
      if (ibuf1->rect == 0) return (0);

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

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

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


Generated by  Doxygen 1.6.0   Back to index