private void drawsegment_gouraud_alpha(float leftadd,
                                         float rghtadd,
                                         int ytop,
                                         int ybottom) {
    ytop *= SCREEN_WIDTH;
    ybottom *= SCREEN_WIDTH;
//    int p = m_index;

    float irf = iradd;
    float igf = igadd;
    float ibf = ibadd;
    float iaf = iaadd;

    while (ytop < ybottom) {
      int xstart = (int) (xleft + PIXEL_CENTER);
      if (xstart < 0)
        xstart = 0;
      int xend = (int) (xrght + PIXEL_CENTER);
      if (xend > SCREEN_WIDTH)
        xend = SCREEN_WIDTH;
      float xdiff = (xstart + PIXEL_CENTER) - xleft;

      int ir = (int) (irf * xdiff + rleft);
      int ig = (int) (igf * xdiff + gleft);
      int ib = (int) (ibf * xdiff + bleft);
      int ia = (int) (iaf * xdiff + aleft);
      float iz = izadd * xdiff + zleft;

      xstart+=ytop;
      xend+=ytop;

      for ( ; xstart < xend; xstart++ ) {
        if (noDepthTest || (iz <= m_zbuffer[xstart])) {
          //m_zbuffer[xstart] = iz;

          //
          int red = (ir & 0xFF0000);
          int grn = (ig >> 8) & 0xFF00;
          int blu = (ib >> 16);

          // get buffer pixels
          int bb = m_pixels[xstart];
          int br = (bb & 0xFF0000);  // 0x00FF0000
          int bg = (bb & 0xFF00);    // 0x0000FF00
          bb = (bb & 0xFF);          // 0x000000FF

          // blend alpha
          int al = ia >> 16;

          //
          m_pixels[xstart] = 0xFF000000 | 
            ((br + (((red - br) * al) >> 8)) & 0xFF0000) | 
            ((bg + (((grn - bg) * al) >> 8)) & 0xFF00) | 
            ((bb + (((blu - bb) * al) >> 8)) & 0xFF);
//          m_stencil[xstart] = p;
        }

        //
        ir+=iradd;
        ig+=igadd;
        ib+=ibadd;
        ia+=iaadd;
        iz+=izadd;
      }

      ytop+=SCREEN_WIDTH;
      xleft+=leftadd;
      xrght+=rghtadd;
      rleft+=rleftadd;
      gleft+=gleftadd;
      bleft+=bleftadd;
      aleft+=aleftadd;
      zleft+=zleftadd;
    }
  }