public static MemClear ( Byte dest, int destIndex, int count ) : void | ||
dest | Byte | |
destIndex | int | |
count | int | |
return | void |
public void combine_hspan(int x, int y, byte[] buffer, int bufferIndex, int num_pix) { int xmax = (int)m_rbuf.Width - 1; int ymax = (int)m_rbuf.Height - 1; int count = num_pix; byte[] covers = buffer; int coversIndex = bufferIndex; if (y < 0 || y > ymax) { AggMemMx.MemClear(buffer, bufferIndex, num_pix); return; } if (x < 0) { count += x; if (count <= 0) { AggMemMx.MemClear(buffer, bufferIndex, num_pix); return; } AggMemMx.MemClear(covers, coversIndex, -x); coversIndex -= x; x = 0; } if (x + count > xmax) { int rest = x + count - xmax - 1; count -= rest; if (count <= 0) { AggMemMx.MemClear(buffer, bufferIndex, num_pix); return; } AggMemMx.MemClear(covers, coversIndex + count, rest); } int maskIndex = m_rbuf.GetBufferOffsetXY(x, y); byte[] mask = m_rbuf.GetBuffer(); unsafe { fixed(byte *maskHead = &mask[maskIndex]) fixed(byte *coverHead = &covers[coversIndex]) { byte *c_mask_index = maskHead; byte *c_cover_index = coverHead; do { *c_cover_index = (byte)((*c_cover_index * (*c_mask_index) + 255) >> 8); c_cover_index++; c_mask_index++; }while (--count != 0); } } }
public void combine_hspanFullCover(int x, int y, byte[] covers, int coversIndex, int num_pix) { int xmax = (int)m_rbuf.Width - 1; int ymax = (int)m_rbuf.Height - 1; int count = num_pix; if (y < 0 || y > ymax) { AggMemMx.MemClear(covers, coversIndex, num_pix); return; } if (x < 0) { count += x; if (count <= 0) { AggMemMx.MemClear(covers, coversIndex, num_pix); return; } AggMemMx.MemClear(covers, coversIndex, -x); coversIndex -= x; x = 0; } if (x + count > xmax) { int rest = x + count - xmax - 1; count -= rest; if (count <= 0) { AggMemMx.MemClear(covers, coversIndex, num_pix); return; } AggMemMx.MemClear(covers, coversIndex + count, rest); } int maskIndex = m_rbuf.GetByteBufferOffsetXY(x, y); unsafe { TempMemPtr maskPtr = m_rbuf.GetBufferPtr(); byte * mask = (byte *)maskPtr.Ptr; do { covers[coversIndex++] = mask[maskIndex++]; }while (--count != 0); maskPtr.Release(); } }