// Sweeps one scanline with one style index. The style ID can be
        // determined by calling style().
        //template<class Scanline>
        public bool sweep_scanline(IScanlineCache sl, int style_idx)
        {
            int scan_y = m_scan_y - 1;

            if (scan_y > m_Rasterizer.max_y())
            {
                return(false);
            }

            sl.ResetSpans();

            int master_alpha = aa_mask;

            if (style_idx < 0)
            {
                style_idx = 0;
            }
            else
            {
                style_idx++;
                master_alpha = m_master_alpha[(int)(m_ast[(int)style_idx] + m_min_style - 1)];
            }

            style_info st = m_styles[m_ast[style_idx]];

            int     num_cells  = (int)st.num_cells;
            int     CellOffset = st.start_cell;
            cell_aa cell       = m_cells[CellOffset];

            int cover = 0;

            while (num_cells-- != 0)
            {
                int alpha;
                int x    = cell.x;
                int area = cell.area;

                cover += cell.cover;

                cell = m_cells[++CellOffset];

                if (area != 0)
                {
                    alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area,
                                            master_alpha);
                    sl.add_cell(x, alpha);
                    x++;
                }

                if (num_cells != 0 && cell.x > x)
                {
                    alpha = calculate_alpha(cover << (poly_subpixel_shift + 1),
                                            master_alpha);
                    if (alpha != 0)
                    {
                        sl.add_span(x, cell.x - x, alpha);
                    }
                }
            }

            if (sl.num_spans() == 0)
            {
                return(false);
            }
            sl.finalize(scan_y);
            return(true);
        }
예제 #2
0
        // Sweeps one scanline with one style index. The style ID can be 
        // determined by calling style(). 
        //template<class Scanline> 
        public bool sweep_scanline(IScanlineCache sl, int style_idx)
        {
            int scan_y = m_scan_y - 1;
            if(scan_y > m_Rasterizer.max_y()) return false;

            sl.ResetSpans();

            int master_alpha = aa_mask;

            if(style_idx < 0) 
            {
                style_idx = 0;
            }
            else 
            {
                style_idx++;
                master_alpha = m_master_alpha[(int)(m_ast[(int)style_idx] + m_min_style - 1)];
            }

            style_info st = m_styles[m_ast[style_idx]];

            int num_cells = (int)st.num_cells;
            int CellOffset = st.start_cell;
            cell_aa cell = m_cells[CellOffset];

            int cover = 0;
            while(num_cells-- != 0)
            {
                int alpha;
                int x = cell.x;
                int area = cell.area;

                cover += cell.cover;

                cell = m_cells[++CellOffset];

                if(area != 0)
                {
                    alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area,
                                            master_alpha);
                    sl.add_cell(x, alpha);
                    x++;
                }

                if(num_cells != 0 && cell.x > x)
                {
                    alpha = calculate_alpha(cover << (poly_subpixel_shift + 1),
                                            master_alpha);
                    if(alpha != 0)
                    {
                        sl.add_span(x, cell.x - x, alpha);
                    }
                }
            }

            if(sl.num_spans() == 0) return false;
            sl.finalize(scan_y);
            return true;
        }
예제 #3
0
        //--------------------------------------------------------------------
        public bool sweep_scanline(IScanlineCache scanlineCache)
        {
            for (; ;)
            {
                if (m_scan_y > m_outline.max_y())
                {
                    return(false);
                }

                scanlineCache.ResetSpans();
                int       num_cells = (int)m_outline.scanline_num_cells(m_scan_y);
                cell_aa[] cells;
                int       Offset;
                m_outline.scanline_cells(m_scan_y, out cells, out Offset);
                int cover = 0;

                while (num_cells != 0)
                {
                    cell_aa cur_cell = cells[Offset];
                    int     x        = cur_cell.x;
                    int     area     = cur_cell.area;
                    int     alpha;

                    cover += cur_cell.cover;

                    //accumulate all cells with the same X
                    while (--num_cells != 0)
                    {
                        Offset++;
                        cur_cell = cells[Offset];
                        if (cur_cell.x != x)
                        {
                            break;
                        }

                        area  += cur_cell.area;
                        cover += cur_cell.cover;
                    }

                    if (area != 0)
                    {
                        alpha = calculate_alpha((cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1)) - area);
                        if (alpha != 0)
                        {
                            scanlineCache.add_cell(x, alpha);
                        }
                        x++;
                    }

                    if ((num_cells != 0) && (cur_cell.x > x))
                    {
                        alpha = calculate_alpha(cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1));
                        if (alpha != 0)
                        {
                            scanlineCache.add_span(x, (cur_cell.x - x), alpha);
                        }
                    }
                }

                if (scanlineCache.num_spans() != 0)
                {
                    break;
                }
                ++m_scan_y;
            }

            scanlineCache.finalize(m_scan_y);
            ++m_scan_y;
            return(true);
        }
예제 #4
0
        //--------------------------------------------------------------------
        public bool SweepScanline(IScanlineCache sl)
        {
#if use_timers
            SweepSacanLine.Start();
#endif
            for (; ;)
            {
                if (m_scan_y > m_outline.MaxY)
                {
#if use_timers
                    SweepSacanLine.Stop();
#endif
                    return(false);
                }

                sl.ResetSpans();
                uint scan_y_uint = 0; // it is going to get initialize to 0 anyway so make it clear.
                if (m_scan_y > 0)
                {
                    scan_y_uint = (uint)m_scan_y;
                }
                uint     num_cells = m_outline.ScanlineNumCells(scan_y_uint);
                CellAA[] cells;
                uint     Offset;
                m_outline.ScanlineCells(scan_y_uint, out cells, out Offset);
                int cover = 0;

                while (num_cells != 0)
                {
                    CellAA cur_cell = cells[Offset];
                    int    x        = cur_cell.X;
                    int    area     = cur_cell.Area;
                    uint   alpha;

                    cover += cur_cell.Cover;

                    //accumulate all cells with the same X
                    while (--num_cells != 0)
                    {
                        Offset++;
                        cur_cell = cells[Offset];
                        if (cur_cell.X != x)
                        {
                            break;
                        }

                        area  += cur_cell.Area;
                        cover += cur_cell.Cover;
                    }

                    if (area != 0)
                    {
                        alpha = CalculateAlpha((cover << ((int)poly_subpixel_scale_e.Shift + 1)) - area);
                        if (alpha != 0)
                        {
                            sl.AddCell(x, alpha);
                        }
                        x++;
                    }

                    if ((num_cells != 0) && (cur_cell.X > x))
                    {
                        alpha = CalculateAlpha(cover << ((int)poly_subpixel_scale_e.Shift + 1));
                        if (alpha != 0)
                        {
                            sl.AddSpan(x, (cur_cell.X - x), alpha);
                        }
                    }
                }

                if (sl.NumSpans != 0)
                {
                    break;
                }
                ++m_scan_y;
            }

            sl.Finalize(m_scan_y);
            ++m_scan_y;
#if use_timers
            SweepSacanLine.Stop();
#endif
            return(true);
        }
예제 #5
0
		//--------------------------------------------------------------------
		public bool sweep_scanline(IScanlineCache scanlineCache)
		{
			for (; ; )
			{
				if (m_scan_y > m_outline.max_y())
				{
					return false;
				}

				scanlineCache.ResetSpans();
				int num_cells = (int)m_outline.scanline_num_cells(m_scan_y);
				cell_aa[] cells;
				int Offset;
				m_outline.scanline_cells(m_scan_y, out cells, out Offset);
				int cover = 0;

				while (num_cells != 0)
				{
					cell_aa cur_cell = cells[Offset];
					int x = cur_cell.x;
					int area = cur_cell.area;
					int alpha;

					cover += cur_cell.cover;

					//accumulate all cells with the same X
					while (--num_cells != 0)
					{
						Offset++;
						cur_cell = cells[Offset];
						if (cur_cell.x != x)
						{
							break;
						}

						area += cur_cell.area;
						cover += cur_cell.cover;
					}

					if (area != 0)
					{
						alpha = calculate_alpha((cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1)) - area);
						if (alpha != 0)
						{
							scanlineCache.add_cell(x, alpha);
						}
						x++;
					}

					if ((num_cells != 0) && (cur_cell.x > x))
					{
						alpha = calculate_alpha(cover << ((int)poly_subpixel_scale_e.poly_subpixel_shift + 1));
						if (alpha != 0)
						{
							scanlineCache.add_span(x, (cur_cell.x - x), alpha);
						}
					}
				}

				if (scanlineCache.num_spans() != 0) break;
				++m_scan_y;
			}

			scanlineCache.finalize(m_scan_y);
			++m_scan_y;
			return true;
		}
        // Sweeps one scanline with one style index. The style ID can be
        // determined by calling style().
        //template<class Scanline>
        public bool SweepScanline(IScanlineCache sl, int style_idx)
        {
            int scan_y = m_scan_y - 1;

            if (scan_y > m_Rasterizer.MaxY)
            {
                return(false);
            }

            sl.ResetSpans();

            uint master_alpha = AAMask;

            if (style_idx < 0)
            {
                style_idx = 0;
            }
            else
            {
                style_idx++;
                master_alpha = m_master_alpha[(uint)(m_ast[(uint)style_idx] + m_min_style - 1)];
            }

            StyleInfo st = m_styles[m_ast[style_idx]];

            int    num_cells  = (int)st.num_cells;
            uint   CellOffset = st.start_cell;
            CellAA cell       = m_cells[CellOffset];

            int cover = 0;

            while (num_cells-- != 0)
            {
                uint alpha;
                int  x    = cell.X;
                int  area = cell.Area;

                cover += cell.Cover;

                cell = m_cells[++CellOffset];

                if (area != 0)
                {
                    alpha = CalculateAlpha((cover << (PolySubpixelShift + 1)) - area,
                                           master_alpha);
                    sl.AddCell(x, alpha);
                    x++;
                }

                if (num_cells != 0 && cell.X > x)
                {
                    alpha = CalculateAlpha(cover << (PolySubpixelShift + 1),
                                           master_alpha);
                    if (alpha != 0)
                    {
                        sl.AddSpan(x, cell.X - x, alpha);
                    }
                }
            }

            if (sl.NumSpans == 0)
            {
                return(false);
            }
            sl.Finalize(scan_y);
            return(true);
        }