//--------------------------------------------------------------------
    // The scanline rendering function itself.
    template<class Scanline> void render(const Scanline& sl)
    {
        unsigned num_spans = sl.num_spans();
        int y = sl.y();

        Scanline::const_iterator span = sl.begin();

        do
        {
            int len = span->len;
            int x;
            if(len > 0)
            {
                // pixel-by-pixel
                const Scanline::cover_type* covers = span->covers;
                x = span->x;
                do
                {
                    blend_pixel(x++, y, *covers++);
                }
                while(--len);
            }
            else
            {
                if(*span->covers == 255)
                {
                    // solid span. happens often
                    draw_solid_span(span->x, y, -len);
                }
                else
                {
                    // pixel-by-pixel again
                    x = span->x;
                    do
                    {
                        blend_pixel(x++, y, *span->covers);
                    }
                    while(++len);
                }
            }
            ++span;
        }
        while(--num_spans);
    }
Beispiel #2
0
        //--------------------------------------------------------------------
        template<class Scanline> void render(const Scanline& sl)
        {
            int y = sl.y();

            unsigned num_spans = sl.num_spans();
            typename Scanline::const_iterator span = sl.begin();

            do
            {
                int x = span->x;
                const typename Scanline::cover_type* covers = span->covers;
                int num_pix = span->len;
                
                do 
                {
                    int a = (*covers++ * m_color.a) >> 8;
                    m_ren.color(rgba8(m_color.r, m_color.g, m_color.b, a));
                    m_square.draw(m_ras, m_sl, m_ren, x, y);
                    ++x;
                }
                while(--num_pix);
            }
            while(--num_spans);
        }