/// <summary> /// Return the operation(s) to perform at the beginning or end of a /// scan line, given a dest and source word. /// </summary> private EdgeStrategy GetEdgeStrategy(CombinerFlags dstMask, CombinerFlags srcMask) { int lookup = (((int)_direction << 6) | (((int)dstMask & 0x6) << 3) | // XXX (((int)srcMask & 0x6) << 1) | // XXX ((_leftOver ? 1 : 0) << 1) | ((_extraSrcWord && _xOffset > 0) ? 1 : 0)); EdgeStrategy result = _rscTable[lookup]; #if TRACING_ENABLED if (Trace.TraceOn) { Trace.Log(LogType.RasterOp, "RasterOp: EdgeStrategy lookup {0:x3} --> {1}", lookup, result); } #endif #if DEBUG // Draw attention for debugging; should throw an exception in release version... if (result == EdgeStrategy.Unknown) { Console.WriteLine("==> Unknown edge strategy {0:x3}! <==", lookup); } #endif return(result); }
private RasterOp() { _ropShifter = new Shifter(); // Our own private Idaho _srcFifo = new Queue <ROpWord>(16); // 4 quads (hardware limit) _destFifo = new Queue <ROpWord>(4); // 1 quad _halfPipe = new ROpWord(); // 1 word, for overlap _rdsTable = new CombinerFlags[512]; // 9 bit index _rscTable = new EdgeStrategy[128]; // 7 bit index LoadRasterOpROMs(); }
/// <summary> /// Returns the correct Mask for a given source word in the current quad. /// </summary> /// <param name="index">Source word index 0..3</param> /// <returns>Combiner mask value</returns> private CombinerFlags SrcWordMask(int index) { // Create a 9-bit index into the RDS ROM lookup tablee int lookup = (((int)_phase & 0x3) << 7) | ((int)_direction << 6) | (_srcWordPosition << 4) | (_lastSrcPosition << 2) | index; // Same table as the dest word for source word mask! CombinerFlags result = _rdsTable[lookup]; #if TRACING_ENABLED if (Trace.TraceOn) { Trace.Log(LogType.RasterOp, "RasterOp: SrcWordMask lookup {0:x} --> {1}", lookup, result); } #endif return(result); }
/// <summary> /// Returns the correct Mask for a given destination word in the current quad. /// </summary> /// <param name="index">Destination word index 0..3</param> /// <returns>Combiner mask value</returns> private CombinerFlags DestWordMask(int index) { // Create the 9-bit index into the RDS ROM lookup table int lookup = (((int)_phase & 0x3) << 7) | ((int)_direction << 6) | (_destWordPosition << 4) | (_widthExtraWords << 2) | index; // Annnnd return the result! CombinerFlags result = _rdsTable[lookup]; #if TRACING_ENABLED if (Trace.TraceOn) { Trace.Log(LogType.RasterOp, "RasterOp: DestWordMask lookup {0:x} --> {1}", lookup, result); } #endif return(result); }