-- CGBrickBLTImpl.mesa -- Last changed by Ken Pier, 30-Mar-82 14:46:36 DIRECTORY CGBrickBLT, CGBandFormat, BitBlt; CGBrickBLTImpl: PROGRAM IMPORTS BitBlt EXPORTS CGBrickBLT = { OPEN BB: BitBlt, BFormat: CGBandFormat, CGBrickBLT; --InitializeBrickBLT is called with a client BBTableSpace. --Procedure makes bbtable and fills in constant values for blitting --scanline buffer into band buffer. Clients will pass this bbtable --to other routines for filling and blitting. bitsPerWord: CARDINAL = 16; InitializeBrickBLT: PUBLIC PROC [ptr: POINTER TO BB.BBTableSpace] RETURNS [bbptr: BB.BBptr] = { bbf: BB.BitBltFlags = [ direction: forward, disjoint: TRUE, disjointItems: FALSE, gray: FALSE, srcFunc: null, dstFunc: null, reserved: 0]; nullBitAddress: BB.BitAddress _ [word: NIL, reserved: 0, bit: 0]; bbptr _ BB.AlignedBBTable[ptr]; bbptr^ _ [ dst: nullBitAddress, dstBpl: 0, src: nullBitAddress, srcDesc: [srcBpl[0]], width: 0, height: 1, flags: bbf, reserved: 0]; };--InitializeBrickBLT BrickBLT:PUBLIC PROC [bbptr: BB.BBptr, tBrick: BFormat.TBrickRef, destLine: LONG POINTER, hx, hy: CARDINAL, xmin,xmax: CARDINAL, lineBuffer: LONG POINTER] = { w, wmax: CARDINAL; L: CARDINAL _ tBrick.L; brickIndex: CARDINAL _ L*hy; --put a line from the tBrick into the line buffer bbptr^ _ [ dst: [word: lineBuffer, reserved: , bit: 0], dstBpl: 0, src: [word: @tBrick.brick+(brickIndex/bitsPerWord)+1, reserved: , bit: brickIndex MOD bitsPerWord], srcDesc: [srcBpl[0]], width: L, height: 1]; BB.BITBLT[bbptr]; --now replicate the brick line of length L to form a scan line, --doubling the replication length each time thru the loop bbptr.src _ [word: lineBuffer, bit: 0]; wmax _ hx+xmax-xmin; --max number of bits needed w _ L; --start with L bits in lineBuffer UNTIL w >= wmax/2 DO bbptr.dst _ [word: lineBuffer+(w/bitsPerWord), reserved: , bit: w MOD bitsPerWord]; bbptr.width _ w; BB.BITBLT[bbptr]; w _ w+w; ENDLOOP; bbptr.dst _ [word: lineBuffer+(w/bitsPerWord), reserved: , bit: w MOD bitsPerWord]; bbptr.width _ wmax-w; BB.BITBLT[bbptr]; --now BLT the lineBuffer into the bitmap bbptr.dst.word _ destLine+xmin/16; bbptr.dst.bit _ xmin MOD 16; bbptr.src.word _ lineBuffer+hx/bitsPerWord; bbptr.src.bit _ hx MOD bitsPerWord; bbptr.width _ xmax-xmin; BB.BITBLT[bbptr]; };--BrickBLT }.--CGBrickBLTImpl LOG --created 2/3/82 by Pier --changed BrickBLT to use BITBLT to build scanlines