diff --git a/game/RawBitmap.cpp b/game/RawBitmap.cpp deleted file mode 100644 index c3d0d00..0000000 --- a/game/RawBitmap.cpp +++ /dev/null @@ -1,257 +0,0 @@ -#include "ht.h" - -namespace wi { - -// This exists soley for the purpose of being overridden - -HtBitmap::~HtBitmap() -{ -} - -RawBitmap *LoadRawBitmap(char *pszFn) -{ - RawBitmap *prbm = new RawBitmap(); - if (prbm == NULL) - return NULL; - if (!prbm->Init(pszFn)) { - delete prbm; - return NULL; - } - return prbm; -} - -RawBitmap::RawBitmap() -{ - m_pfil = NULL; - m_cx = 0; - m_cy = 0; -} - -RawBitmap::~RawBitmap() -{ - if (m_pfil != NULL) { - gpakr.fclose(m_pfil); - m_pfil = NULL; - } -} - -bool RawBitmap::Init(char *pszFn) -{ - File *pfil = gpakr.fopen(pszFn, "rb"); - if (pfil == NULL) - return false; - - short cx; - if (gpakr.fread(&cx, sizeof(cx), 1, pfil) != 1) { - gpakr.fclose(pfil); - return false; - } - - short cy; - if (gpakr.fread(&cy, sizeof(cy), 1, pfil) != 1) { - gpakr.fclose(pfil); - return false; - } - - m_pfil = pfil; - m_cx = BigWord(cx); - m_cy = BigWord(cy); - return true; -} - -void RawBitmap::GetSize(Size *psiz) -{ - psiz->cx = m_cx; - psiz->cy = m_cy; -} - -#if 0 -// fread based blt - -void RawBitmap::BltTo(DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc) -{ - // Get dib dimensions - - Size sizDib; - pbmDst->GetSize(&sizDib); - - // Src rect to blt from - - if (prcSrc == NULL) { - Rect rcSrcT; - rcSrcT.Set(0, 0, sizDib.cx, sizDib.cy); - prcSrc = &rcSrcT; - } - - // Right and bottom edge clipping - - if (sizDib.cx - xDst < prcSrc->Width()) - prcSrc->right = prcSrc->left + sizDib.cx - xDst; - if (sizDib.cy - yDst < prcSrc->Height()) - prcSrc->bottom = prcSrc->top + sizDib.cy - yDst; - - // Left and top edge clipping - - int xDstT = xDst; - if (xDstT < 0) { - prcSrc->left -= xDstT; - xDstT = 0; - } - int yDstT = yDst; - if (yDstT < 0) { - prcSrc->top -= yDstT; - yDstT = 0; - } - - // Anything to blt? - - if (prcSrc->IsEmpty()) - return; - - // Get destination address and dest row bytes - - int cbRow = pbmDst->GetRowBytes(); - byte *pbDst = pbmDst->GetBits() + (long)yDstT * cbRow + xDstT; - - // Seek to the start of bits - - gpakr.fseek(m_pfil, sizeof(word) * 2 + (long)prcSrc->top * m_cx + prcSrc->left, SEEK_SET); - - // Can't use the scratch buffer to chunk because the decompressor - // uses it! Use this lame approach for now. - - int cbSrcReturn = m_cx - prcSrc->Width(); - int cy = prcSrc->Height(); - for (int y = 0; y < cy; y++) { - if (gpakr.fread(pbDst, prcSrc->Width(), 1, m_pfil) != 1) - return; - if (cbSrcReturn != 0) - gpakr.fseek(m_pfil, cbSrcReturn, SEEK_CUR); - pbDst += cbRow; - } -} -#else -// Record mapping based blt - -void RawBitmap::BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc) -{ - BltTo(pbmDst, xDst, yDst, prcSrc); -} - -void RawBitmap::BltTo(DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc) -{ - // Src rect to blt from - - Rect rcSrcT; - if (prcSrc == NULL) { - rcSrcT.Set(0, 0, m_cx, m_cy); - prcSrc = &rcSrcT; - } - - // Right and bottom edge clipping - - Size sizDib; - pbmDst->GetSize(&sizDib); - if (sizDib.cx - xDst < prcSrc->Width()) - prcSrc->right = prcSrc->left + sizDib.cx - xDst; - if (sizDib.cy - yDst < prcSrc->Height()) - prcSrc->bottom = prcSrc->top + sizDib.cy - yDst; - - // Left and top edge clipping - - int xDstT = xDst; - if (xDstT < 0) { - prcSrc->left -= xDstT; - xDstT = 0; - } - int yDstT = yDst; - if (yDstT < 0) { - prcSrc->top -= yDstT; - yDstT = 0; - } - - // Anything to blt? - - if (prcSrc->IsEmpty()) - return; - - // Get destination address and dest row bytes - - int cbRowDst = pbmDst->GetRowBytes(); - byte *pbDst = pbmDst->GetBits() + (long)yDstT * cbRowDst + xDstT; - - // Seek to the start of bits - - dword offBits = sizeof(word) * 2 + prcSrc->top * m_cx + prcSrc->left; - gpakr.fseek(m_pfil, offBits, SEEK_SET); - int nRecCurrent = BigWord(m_pfil->nRecFirst) + m_pfil->nRecOffStream; - dword offRecCurrent = m_pfil->offRecStart; - - // Try to blt chunks as large as possible. If a scan intersects a record boundary, handle it - // specially. - - int cxBlt = prcSrc->Width(); - int cyLeft = prcSrc->Height(); - byte *pbRec = NULL; - word cbRec; - void *pvCookie; - while (cyLeft > 0) { - // See how much we can blt from the current record - - if (pbRec == NULL) { - pbRec = m_pfil->prnfo->ppdbReader->MapRecord(nRecCurrent, &pvCookie, &cbRec); - if (pbRec == NULL) - break; - } - - dword cbRecLeft = offRecCurrent + cbRec - offBits; - int cyRecWholeScans = cbRecLeft / m_cx; - - // Blt as much as we can - - int cyBlt = _min(cyLeft, cyRecWholeScans); - LeftToRightBltThunk(&pbRec[offBits - offRecCurrent], m_cx, pbDst, cbRowDst, cxBlt, cyBlt); - cyLeft -= cyBlt; - if (cyLeft == 0) - break; - offBits += (long)cyBlt * m_cx; - pbDst += (long)cyBlt * cbRowDst; - - // Does the next scan intersect a record boundary? - - if (offRecCurrent + cbRec - offBits < (word)cxBlt) { - // Blt left half, unlock current record, lock next record, blt right half - - int cbLeftHalf = (int)(offRecCurrent + cbRec - offBits); - memcpy(pbDst, &pbRec[offBits - offRecCurrent], cbLeftHalf); - m_pfil->prnfo->ppdbReader->UnmapRecord(nRecCurrent, pvCookie); - offRecCurrent += cbRec; - nRecCurrent++; - pbRec = m_pfil->prnfo->ppdbReader->MapRecord(nRecCurrent, &pvCookie, &cbRec); - if (pbRec == NULL) - return; - memcpy(pbDst + cbLeftHalf, pbRec, cxBlt - cbLeftHalf); - pbDst += cbRowDst; - offBits += m_cx; - cyLeft--; - continue; - } - - // Next scan doesn't intersect a record boundary - - memcpy(pbDst, &pbRec[offBits - offRecCurrent], cxBlt); - m_pfil->prnfo->ppdbReader->UnmapRecord(nRecCurrent, pvCookie); - pbRec = NULL; - offRecCurrent += cbRec; - offBits += m_cx; - nRecCurrent++; - pbDst += cbRowDst; - cyLeft--; - } - - if (pbRec != NULL) - m_pfil->prnfo->ppdbReader->UnmapRecord(nRecCurrent, pvCookie); -} -#endif - -} // namespace wi diff --git a/game/bitmap.cpp b/game/bitmap.cpp index ff0dc6b..e69de29 100644 --- a/game/bitmap.cpp +++ b/game/bitmap.cpp @@ -1,546 +0,0 @@ -#include "ht.h" - -namespace wi { - -// Dib bitmaps - -DibBitmap *CreateDibBitmap(byte *pb, int cx, int cy) -{ - DibBitmap *pbm = new DibBitmap; - Assert(pbm != NULL, "out of memory!"); - if (pbm == NULL) - return NULL; - if (!pbm->Init(pb, cx, cy)) { - delete pbm; - return NULL; - } - return pbm; -} - -DibBitmap::DibBitmap() -{ - m_cbRow = 0; - m_cb = 0; - m_pb = NULL; - m_siz.cx = 0; - m_siz.cy = 0; - m_wf = 0; -} - -DibBitmap::~DibBitmap() -{ - if (m_wf & kfDibFreeMem) - delete[] m_pb; - m_pb = NULL; -} - -bool DibBitmap::Init(byte *pb, int cx, int cy) -{ - m_cbRow = (cx + 1) & ~1; - m_cb = (int)cy * m_cbRow; - if (pb == NULL) { - m_pb = new byte[m_cb]; - Assert(m_pb != NULL, "out of memory!"); - m_wf |= kfDibFreeMem; - } else { - m_pb = pb; - } - m_siz.cx = cx; - m_siz.cy = cy; - return m_pb != NULL; -} - -byte *DibBitmap::GetBits() -{ - return m_pb; -} - -int DibBitmap::GetRowBytes() -{ - return m_cbRow; -} - -#define TopToBottomBltThunk LeftToRightBltThunk -#define FastestBltThunk LeftToRightBltThunk -#define BottomToTopBltThunk RightToLeftBltThunk - -void DibBitmap::Blt(DibBitmap *pbmSrc, Rect *prcSrc, int xDst, int yDst) -{ - // Get src dib dimensions - - Size sizSrc; - pbmSrc->GetSize(&sizSrc); - - // Clip to source rect - - if (prcSrc->left < 0) - prcSrc->left = 0; - if (prcSrc->top < 0) - prcSrc->top = 0; - if (prcSrc->right > sizSrc.cx) - prcSrc->right = sizSrc.cx; - if (prcSrc->bottom > sizSrc.cy) - prcSrc->bottom = sizSrc.cy; - - // Clip to dest - - if (xDst < 0) { - prcSrc->left -= xDst; - xDst = 0; - } - if (yDst < 0) { - prcSrc->top -= yDst; - yDst = 0; - } - - int xRightDst = xDst + prcSrc->Width(); - if (xRightDst > m_siz.cx) - prcSrc->right -= xRightDst - m_siz.cx; - int yBottomDst = yDst + prcSrc->Height(); - if (yBottomDst > m_siz.cy) - prcSrc->bottom -= yBottomDst - m_siz.cy; - - // Anything to blt? - - if (prcSrc->IsEmpty()) - return; - - // Figure out direction to blt if we're doing a blt in the same dib - - if (this == pbmSrc) { - // Calc addresses - - byte *pbSrc = m_pb + (long)prcSrc->top * m_cbRow + prcSrc->left; - byte *pbDst = m_pb + (long)yDst * m_cbRow + xDst; - - // If same y, ... - - if (yDst == prcSrc->top) { - // Overlap? - - int cxInterval = prcSrc->right - xDst; - if (cxInterval > 0 && cxInterval < prcSrc->Width() * 2) { - // Overlap. If bltting to the left, copy from left to right - - if (xDst < prcSrc->left) { - LeftToRightBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } else { - RightToLeftBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } - } else { - // No overlap. Do the fastest blt - - FastestBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } - } else { - int cyInterval = prcSrc->bottom - yDst; - if (cyInterval > 0 && cyInterval < prcSrc->Height() * 2) { - // Overlap. If bltting upwards, copy from top to bottom - - if (yDst < prcSrc->top) { - TopToBottomBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } else { - BottomToTopBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } - } else { - // No overlap. Do the fastest blt - - FastestBltThunk(pbSrc, m_cbRow, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } - } - } else { - // No overlap. Do the fastest blt - - int cbRowBytesSrc = pbmSrc->GetRowBytes(); - byte *pbSrc = pbmSrc->GetBits() + (long)prcSrc->top * cbRowBytesSrc + prcSrc->left; - byte *pbDst = m_pb + (long)yDst * m_cbRow + xDst; - - FastestBltThunk(pbSrc, cbRowBytesSrc, pbDst, m_cbRow, prcSrc->Width(), prcSrc->Height()); - } -} - -void DibBitmap::Clear(Color clr) -{ -#ifdef __CPU_68K - if (gfArmPresent) { - memsetArm(m_pb, (byte)clr, m_cb); - return; - } -#endif - memset(m_pb, (byte)clr, m_cb); -} - -void DibBitmap::Fill(int x, int y, int cx, int cy, Color clr) -{ - // Destination clipping - - if (x < 0) { - cx += x; - x = 0; - } - if (y < 0) { - cy += y; - y = 0; - } - if (x + cx > m_siz.cx) - cx = m_siz.cx - x; - if (y + cy > m_siz.cy) - cy = m_siz.cy - y; - - if (cx <= 0 || cy <= 0) - return; - - // Drawing - - byte *pbDst = m_pb + (long)y * m_cbRow + x; - FillThunk(pbDst, cx, cy, m_cbRow, (byte)clr); -} - -void DibBitmap::Shadow(int x, int y, int cx, int cy) -{ - // Destination clipping - - if (x < 0) { - cx += x; - x = 0; - } - if (y < 0) { - cy += y; - y = 0; - } - if (x + cx > m_siz.cx) - cx = m_siz.cx - x; - if (y + cy > m_siz.cy) - cy = m_siz.cy - y; - - if (cx <= 0 || cy <= 0) - return; - - byte *pbRow = m_pb + (long)y * m_cbRow + x; - FillShadowThunk(pbRow, m_cbRow, cx, cy, gmpiclriclrShadow); -} - -void DibBitmap::GetSize(Size *psiz) -{ - *psiz = m_siz; -} - -#ifdef DRAW_LINES - -#define LEFT 1 -#define RIGHT 2 -#define BOTTOM 4 -#define TOP 8 - -#define SWAP(x, y) { int _t = x; x = y; y = _t; } - -#define OUTCODE(x, y, outcode, type) \ -{ \ - if (x < xl) outcode = LEFT, type = 1; \ - else if (x > xr) outcode = RIGHT, type = 1; \ - else outcode = type = 0; \ - if (y < yb) outcode |= BOTTOM, type++; \ - else if (y > yt) outcode |= TOP, type++; \ -} - -#define CLIP(a1, a2, b1, da, da2, db2, as, bs, sa, sb, \ - amin, AMIN, amax, AMAX, bmin, BMIN, bmax, BMAX) \ -{ \ - if (out1) { \ - if (out1 & AMIN) { ca = db2 * (amin - a1); as = amin; } \ - else if (out1 & AMAX) { ca = db2 * (a1 - amax); as = amax; } \ - if (out1 & BMIN) { cb = da2 * (bmin - b1); bs = bmin; } \ - else if (out1 & BMAX) { cb = da2 * (b1 - bmax); bs = bmax; } \ - if (type1 == 2) \ - out1 &= (ca + da < cb) ? ~(AMIN | AMAX) : ~(BMAX | BMIN); \ - if (out1 & (AMIN | AMAX)) { \ - cb = (ca + da) / da2; \ - if (sb >= 0) { if ((bs = b1 + cb) > bmax) return; } \ - else { if ((bs = b1 - cb) < bmin) return; } \ - r += ca - da2 * cb; \ - } \ - else { \ - ca = (cb - da + db2 - 1) / db2; \ - if (sa >= 0) { if ((as = a1 + ca) > amax) return; } \ - else { if ((as = a1 - ca) < amin) return; } \ - r += db2 * ca - cb; \ - } \ - } \ - else { as = a1; bs = b1; } \ - alt = 0; \ - if (out2) { \ - if (type2 == 2) { \ - ca = db2 * ((out2 & AMIN) ? a1 - amin : amax - a1); \ - cb = da2 * ((out2 & BMIN) ? b1 - bmin : bmax - b1); \ - out2 &= (cb + da < ca + 1) ? ~(AMIN | AMAX) : ~(BMIN | BMAX); \ - } \ - if (out2 & (AMIN | AMAX)) n = (out2 & AMIN) ? as - amin : amax - as; \ - else { n = (out2 & BMIN) ? bs - bmin : bmax - bs; alt = 1; } \ - } \ - else n = (a2 >= as) ? a2 - as : as - a2; \ -} - -#define plot(x, y) (*(m_pb + (y * m_cbRow) + x) = (byte)clr) - -void DibBitmap::DrawLine(short x1, short y1, short x2, short y2, Color clr) -{ - int xl = 0, yb = 0; - int xr = m_siz.cx - 1; - int yt = m_siz.cy - 1; - - int adx, ady, adx2, ady2, sx, sy; - int out1, out2, type1, type2; - int ca, cb, r, diff, xs, ys, n, alt; - - OUTCODE(x1, y1, out1, type1); - OUTCODE(x2, y2, out2, type2); - if (out1 & out2) return; - if ((type1 != 0 && type2 == 0) || (type1 == 2 && type2 == 1)){ - SWAP(out1, out2); - SWAP(type1, type2); - SWAP(x1, x2); - SWAP(y1, y2); - } - xs = x1; - ys = y1; - sx = 1; - adx = x2 - x1; - if (adx < 0) { adx = -adx; sx = -1; } - sy = 1; - ady = y2 - y1; - if (ady < 0) { ady = -ady; sy = -1; } - adx2 = adx + adx; - ady2 = ady + ady; - if (adx >= ady) { - /* - * line is semi-horizontal - */ - r = ady2 - adx; - CLIP(x1, x2, y1, adx, adx2, ady2, xs, ys, sx, sy, - xl, LEFT, xr, RIGHT, yb, BOTTOM, yt, TOP); - diff = ady2 - adx2; - if (alt) { - for (;; xs += sx) { /* alternate Bresenham */ - plot(xs, ys); - if (r >= 0 ) { - if (--n < 0) break; - r += diff; - ys += sy; - } - else r += ady2; - } - } - else{ - for (;; xs += sx) { /* standard Bresenham */ - plot(xs, ys); - if (--n < 0) break; - if (r >= 0 ) { r += diff; ys += sy; } - else r += ady2; - } - } - } - else { - /* - * line is semi-vertical - */ - r = adx2 - ady; - CLIP(y1, y2, x1, ady, ady2, adx2, ys, xs, sy, sx, - yb, BOTTOM, yt, TOP, xl, LEFT, xr, RIGHT); - diff = adx2 - ady2; - if (alt) { - for (;; ys += sy) { /* alternate Bresenham */ - plot(xs, ys); - if (r >= 0 ) { - if (--n < 0) break; - r += diff; - xs += sx; - } - else r += adx2; - } - } - else { - for (;; ys += sy) { /* standard Bresenham */ - plot(xs, ys); - if (--n < 0) break; - if (r >= 0 ) { r += diff; xs += sx; } - else r += adx2; - } - } - } -} -#endif // DRAW_LINES - -DibBitmap *DibBitmap::Suballoc(int yTop, int cy) -{ - Assert(yTop < m_siz.cy && yTop + cy <= m_siz.cy); - byte *pb = m_pb + (long)m_siz.cx * yTop; - return CreateDibBitmap(pb, m_siz.cx, cy); -} - -void DibBitmap::Scroll(Rect *prcSrc, int xDst, int yDst) -{ - // Some implementations do blts differently (such as rotated dibs). - // That is why this method - essentially a blt from and to the - // destination - exists. - Blt(this, prcSrc, xDst, yDst); -} - -#ifdef __CPU_68K -void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) -{ - // OS5 path usually not executed - - if (IsOS50Compat()) { - bool fFirst = true; - Rect rc; - while (pupd->EnumUpdateRects(fFirst, NULL, &rc)) { - fFirst = false; - Blt(pbmSrc, &rc, rc.left, rc.top + yTopDst); - } - return; - } - - // Init - - bool *pfMap = pupd->GetInvalidMap(); - MapInfo *pmnfo = pupd->GetMapInfo(); - Size sizMap; - pupd->GetMapSize(&sizMap); - - dword cbOffset = yTopDst * (dword)m_siz.cx; - byte *pbSrc = pbmSrc->GetBits(); - byte *pbDst = m_pb + cbOffset; - - switch (gcxTile) { - case 16: - UpdateScreen816(pfMap, sizMap.cx, sizMap.cy, pbSrc, pbDst, m_siz.cx, - pmnfo->cxLeftTile, pmnfo->cyTopTile, pmnfo->cxRightTile, pmnfo->cyBottomTile, pmnfo->ctxInside, pmnfo->ctyInside); - break; - - case 24: - UpdateScreen824(pfMap, sizMap.cx, sizMap.cy, pbSrc, pbDst, m_siz.cx, - pmnfo->cxLeftTile, pmnfo->cyTopTile, pmnfo->cxRightTile, pmnfo->cyBottomTile, pmnfo->ctxInside, pmnfo->ctyInside); - break; - } -} - -#else -void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) -{ - bool fFirst = true; - Rect rc; - while (pupd->EnumUpdateRects(fFirst, NULL, &rc)) { - fFirst = false; - Blt(pbmSrc, &rc, rc.left, rc.top + yTopDst); - } -} - -#if 0 -void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) -{ - MapInfo *pmnfo = pupd->GetMapInfo(); - bool *pfInvalid = pupd->GetInvalidMap(); - Size sizMap; - pupd->GetMapSize(&sizMap); - int cbReturn = sizMap.cx - ((pmnfo->cxLeftTile != 0 ? 1 : 0) + pmnfo->ctxInside + (pmnfo->cxRightTile != 0 ? 1 : 0)); - - Rect rcSrc; - int xT = 0; - int yDst = yTopDst; - int ySrc = 0; - if (pmnfo->cyTopTile != 0) { - // Upper left corner - - if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + pmnfo->cyTopTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += pmnfo->cxLeftTile; - - // Upper edge - - for (int tx = 0; tx < pmnfo->ctxInside; tx++) { - if (*pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + pmnfo->cyTopTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += gcxTile; - } - - // Upper right corner - - if (pmnfo->cxRightTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + pmnfo->cyTopTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT = 0; - yDst += pmnfo->cyTopTile; - ySrc += pmnfo->cyTopTile; - pfInvalid += cbReturn; - } - - // Inside - - for (int ty = 0; ty < pmnfo->ctyInside; ty++) { - - // Inside left - - if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + gcyTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += pmnfo->cxLeftTile; - - // Inside - - for (int tx = 0; tx < pmnfo->ctxInside; tx++) { - if (*pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + gcyTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += gcxTile; - } - - // Inside right - - if (pmnfo->cxRightTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + gcyTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT = 0; - yDst += gcyTile; - ySrc += gcyTile; - pfInvalid += cbReturn; - } - - if (pmnfo->cyBottomTile != 0) { - // Bottom left tile - - if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + pmnfo->cyBottomTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += pmnfo->cxLeftTile; - - // Bottom edge - - for (int tx = 0; tx < pmnfo->ctxInside; tx++) { - if (*pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + pmnfo->cyBottomTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - xT += gcxTile; - } - - // Bottom right corner - - if (pmnfo->cxRightTile != 0 && *pfInvalid++) { - rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + pmnfo->cyBottomTile); - Blt(pbmSrc, &rcSrc, xT, yDst); - } - } -} -#endif -#endif - -} // namespace wi diff --git a/game/game.cpp b/game/game.cpp index 59e32f3..7f8e506 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -366,11 +366,6 @@ bool Game::Init(int imm) ClearDisplay(); gshl.SetPalette(); - // Init TBitmapCode - - TBitmap::InitClass(); - m_wf |= kfGameInitBitmap; - // Init form / control requirements ButtonControl::InitClass(); @@ -2037,13 +2032,6 @@ void Game::Exit() ListControl::ExitClass(); DamageMeterControl::ExitClass(); - FreeSharedTBitmaps(); - - if (m_wf & kfGameInitBitmap) { - TBitmap::ExitClass(); - m_wf &= ~kfGameInitBitmap; - } - gshl.Exit(); delete gpstrtbl; diff --git a/game/ht.h b/game/ht.h index f73ed30..919e5a8 100644 --- a/game/ht.h +++ b/game/ht.h @@ -304,44 +304,6 @@ const int knDecreasedDamagePercent = 90; typedef word Color; // clr -// Dib bitmap - -#define kfDibFreeMem 0x0001 -#define kfDibBackWindow 0x0002 -#define kfDibWantScrolls 0x0004 - -class Rect; -class UpdateMap; -class DibBitmap // bm -{ -public: - DibBitmap() secDibBitmap; - virtual ~DibBitmap() secDibBitmap; - bool Init(byte *pb, int cx, int cy) secDibBitmap; - virtual byte *GetBits() secDibBitmap; - virtual void Clear(Color clr) secDibBitmap; - virtual void Fill(int x, int y, int cx, int cy, Color clr) secDibBitmap; - virtual void Shadow(int x, int y, int cx, int cy) secDibBitmap; - virtual void GetSize(Size *psiz) secDibBitmap; - virtual int GetRowBytes() secDibBitmap; - virtual void DrawLine(short x1, short y1, short x2, short y2, Color clr) secDibBitmap; - virtual void Blt(DibBitmap *pbmSrc, Rect *prcSrc, int xDst, int yDst) secDibBitmap; - virtual void BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) secDibBitmap; - virtual void Scroll(Rect *prcSrc, int xDst, int yDst); - virtual DibBitmap *Suballoc(int yTop, int cy) secDibBitmap; - word GetFlags() { - return m_wf; - } - -protected: - word m_wf; - Size m_siz; - byte *m_pb; - dword m_cb; - int m_cbRow; -}; -DibBitmap *CreateDibBitmap(byte *pb, int cx, int cy) secDibBitmap; - // Network stuff class ITransportCallback; @@ -1093,108 +1055,6 @@ struct TBitmapHeader // tbh TBitmapEntry atbe[1]; }; -// Abstract base bitmap class so TBitmaps and RawBitmaps can be used -// interchangeably in certain basic situations - -class HtBitmap -{ -public: - virtual ~HtBitmap() secRawBitmap; - virtual bool Init(char *pszFn) = 0; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc = NULL) = 0; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc = NULL) = 0; - virtual void GetSize(Size *psiz) = 0; -}; - -#define kfTbCloseFile 1 -#define kfTbShared 2 - -#define kcCopyBy4Procs 32 -#define kcColoredSides 6 -class TBitmap : public HtBitmap -{ -public: - TBitmap() secTBitmap; - - bool Init(File *pfil, word ib) secTBitmap; - void BltTo(int itbm, class DibBitmap *pbmDst, int xDst, int yDst, Side side = ksideNeutral, Rect *prcSrc = NULL) secTBitmap; - void GetSize(int itbm, Size *psiz) secTBitmap; - void FillTo(int itbm, class DibBitmap *pbmDst, int xDst, int yDst, - int cxDst, int cyDst, int xOrigin = 0, int yOrigin = 0) secTBitmap; - - int GetBaseline() { - return (int)m_atbe[0].yBaseline; - } - - int GetBaseline(int itbm) { - Assert(itbm >= 0 && itbm < m_ctbm); - return (int)m_atbe[itbm].yBaseline; - } - - void SetShared() { - m_wf |= kfTbShared; - } - - void ClearShared() { - m_wf &= ~kfTbShared; - } - - static bool InitClass() secTBitmap; - static void ExitClass() secTBitmap; - - // HtBitmap overrides - - virtual ~TBitmap() secTBitmap; - virtual bool Init(char *pszFn) secTBitmap; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc = NULL) secTBitmap; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc = NULL) secTBitmap; - virtual void GetSize(Size *psiz) secTBitmap; - -private: - byte *GetCompiledBits(int itbm, bool fOdd) secTBitmap; - static void MakeSideCodeMapping(Color *aclr, dword *mpscaiclrSide) secTBitmap; - void BltToScan(byte *pbDraw, int cx, int cy, DibBitmap *pbmDst, - int xDst, int yDst, Side side, Rect *prcSrc); - - File *m_pfil; - word m_ibtbh; - word m_wf; - int m_ctbm; - TBitmapEntry *m_atbe; - CacheHandle *m_ahc; - -public: - static dword *s_ampscaiclrSide[kcColoredSides]; -}; -TBitmap *LoadTBitmap(char *pszFn) secTBitmap; -void FreeSharedTBitmaps() secTBitmap; -TBitmap *GetSharedTBitmap(char *pszFn) secTBitmap; -void FindSharedTBitmapFilename(TBitmap *ptbm, char *psz, int cb) secTBitmap; - -// For bltting raw bitmaps in a non-clipped, streamed manner - -class RawBitmap : public HtBitmap // rbm -{ -public: - RawBitmap() secRawBitmap; - - // HtBitmap overrides - - virtual ~RawBitmap() secRawBitmap; - virtual bool Init(char *pszFn) secRawBitmap; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc = NULL) secRawBitmap; - virtual void BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc = NULL) secRawBitmap; - virtual void GetSize(Size *psiz) secRawBitmap; - -public: - File *m_pfil; - int m_cx; - int m_cy; -}; -RawBitmap *LoadRawBitmap(char *pszFn) secRawBitmap; - -// Font / Text output - struct FontHeader // fnth { word cy; diff --git a/game/tbitmap.cpp b/game/tbitmap.cpp deleted file mode 100644 index ca0af94..0000000 --- a/game/tbitmap.cpp +++ /dev/null @@ -1,1586 +0,0 @@ -#include "ht.h" - -namespace wi { - -dword *TBitmap::s_ampscaiclrSide[kcColoredSides]; - -int gcyClipBuffer; -TBitmap *LoadTBitmap(char *pszFn) -{ - // Init clip buffer size for quick query - - if (gpbmClip != NULL) { - Size sizClip; - gpbmClip->GetSize(&sizClip); - gcyClipBuffer = sizClip.cy; - } - - TBitmap *ptbm = new TBitmap(); - if (ptbm == NULL) - return NULL; - if (!ptbm->Init(pszFn)) { - delete ptbm; - return NULL; - } - - return ptbm; -} - -// Some things want to pool shared TBitmaps - -struct SharedRecord -{ - TBitmap *ptbm; - char sz[1]; -}; - -int gcshr; -int gcshrAlloc; -SharedRecord **gapshr; - -void FreeSharedTBitmaps() -{ - for (int n = 0; n < gcshr; n++) { - SharedRecord *pshr = gapshr[n]; - TBitmap *ptbm = pshr->ptbm; - ptbm->ClearShared(); - delete pshr->ptbm; - gmmgr.FreePtr(pshr); - } - delete[] gapshr; - gapshr = NULL; - gcshr = 0; - gcshrAlloc = 0; -} - -void FindSharedTBitmapFilename(TBitmap *ptbm, char *psz, int cb) -{ - *psz = 0; - for (int n = 0; n < gcshr; n++) { - SharedRecord *pshr = gapshr[n]; - if (pshr->ptbm == ptbm) { - strncpyz(psz, pshr->sz, cb); - return; - } - } - - Assert(); -} - -#define kcshrGrow 32 - -TBitmap *GetSharedTBitmap(char *pszFn) -{ - // First try to find it - // Note could be faster with a binary search assuming the names are sorted - - SharedRecord **ppshrMax = &gapshr[gcshr]; - for (SharedRecord **ppshr = gapshr; ppshr < ppshrMax; ppshr++) { - SharedRecord *pshr = *ppshr; - if (strcmp(pszFn, pshr->sz) == 0) { - return pshr->ptbm; - } - } - - // Couldn't find it, add it to the list - // Grow list? - - if (gcshr == gcshrAlloc) { - SharedRecord **ppshr = new SharedRecord *[gcshrAlloc + kcshrGrow]; - if (ppshr == NULL) - return NULL; - if (gapshr != NULL) { - memcpy(ppshr, gapshr, sizeof(SharedRecord *) * gcshr); - delete[] gapshr; - } - gapshr = ppshr; - gcshrAlloc += kcshrGrow; - } - Assert(gcshrAlloc > gcshr); - - // Load the TBitmap - - TBitmap *ptbm = LoadTBitmap(pszFn); - if (ptbm == NULL) - return NULL; - ptbm->SetShared(); - - // Alloc record - - SharedRecord *pshr = (SharedRecord *)gmmgr.AllocPtr(sizeof(SharedRecord) - 1 + strlen(pszFn) + 1); - if (pshr == NULL) { - delete ptbm; - return NULL; - } - - // Add it to the list and fill structure - - gapshr[gcshr] = pshr; - gcshr++; - gmmgr.WritePtr(pshr, OFFSETOF(SharedRecord, ptbm), &ptbm, sizeof(ptbm)); - gmmgr.WritePtr(pshr, OFFSETOF(SharedRecord, sz), pszFn, strlen(pszFn) + 1); - - // Done - - return ptbm; -} - -bool TBitmap::InitClass() -{ - static int aiclr[kcColoredSides][2] = { - { kiclrNeutralSideFirst, kiclrNeutralSideLast }, - { kiclrBlueSideFirst, kiclrBlueSideLast }, - { kiclrRedSideFirst, kiclrRedSideLast }, - { kiclrYellowSideFirst, kiclrYellowSideLast }, - { kiclrCyanSideFirst, kiclrCyanSideLast }, - { kiclrWhite, kiclrWhite } - }; - - // Create the side code lookup tables - -#define kcSideColors 5 -#define kcSideCodeEntries (kcSideColors * kcSideColors * kcSideColors * kcSideColors) - - dword *mpscaiclrSideT = new dword[kcSideCodeEntries]; - word cbAlloc = kcSideCodeEntries * sizeof(dword); - - for (int i = 0; i < kcColoredSides; i++) { - Color aclr[5]; - int iclrFirst = aiclr[i][0]; - int iclrLast = aiclr[i][1]; - if (iclrFirst == iclrLast) { - for (int i = 0; i < 5; i++) - aclr[i] = GetColor(iclrFirst); - } else { - Assert(iclrLast - iclrFirst + 1 == 5); - for (int iclr = iclrFirst; iclr <= iclrLast; iclr++) - aclr[iclr - iclrFirst] = GetColor(iclr); - } - - MakeSideCodeMapping(aclr, mpscaiclrSideT); - - // We need more side code entries in order to flash a hires Replicator white - - if (iclrFirst == iclrLast && gcxTile >= 24) - s_ampscaiclrSide[i] = (dword *)gmmgr.AllocPtr(cbAlloc * 2); - else - s_ampscaiclrSide[i] = (dword *)gmmgr.AllocPtr(cbAlloc); - if (s_ampscaiclrSide[i] == NULL) { - delete[] mpscaiclrSideT; - return false; - } - gmmgr.WritePtr(s_ampscaiclrSide[i], 0, mpscaiclrSideT, cbAlloc); - if (iclrFirst == iclrLast && gcxTile >= 24) - gmmgr.WritePtr(s_ampscaiclrSide[i], cbAlloc, mpscaiclrSideT, cbAlloc); - } - delete[] mpscaiclrSideT; - - // Done - - return true; -} - -void TBitmap::MakeSideCodeMapping(Color *aclr, dword *mpscaiclrSide) -{ - int sc = 0; - for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - for (int k = 0; k < 5; k++) { - for (int m = 0; m < 5; m++) { - byte ab[4]; - ab[0] = (byte)aclr[i]; - ab[1] = (byte)aclr[j]; - ab[2] = (byte)aclr[k]; - ab[3] = (byte)aclr[m]; - mpscaiclrSide[sc++] = *((dword *)ab); - } - } - } - } -} - -void TBitmap::ExitClass() -{ - for (int i = 0; i < kcColoredSides; i++) { - gmmgr.FreePtr(s_ampscaiclrSide[i]); - s_ampscaiclrSide[i] = NULL; - } -} - -TBitmap::TBitmap() -{ - m_pfil = NULL; - m_ibtbh = 0; - m_wf = 0; - m_ctbm = 0; - m_atbe = NULL; - m_ahc = NULL; -} - -TBitmap::~TBitmap() -{ - Assert(!(m_wf & kfTbShared)); - - delete[] m_ahc; - m_ahc = NULL; - if (m_atbe != NULL) { - gmmgr.FreePtr(m_atbe); - m_atbe = NULL; - } - if (m_pfil != NULL && (m_wf & kfTbCloseFile) != 0) { - gpakr.fclose(m_pfil); - m_pfil = NULL; - } -} - -bool TBitmap::Init(char *pszFn) -{ - File *pfil = gpakr.fopen(pszFn, "rb"); - if (pfil == NULL) { - return false; - } - if (!Init(pfil, 0)) { - gpakr.fclose(pfil); - return false; - } - m_wf |= kfTbCloseFile; - return true; -} - -bool TBitmap::Init(File *pfil, word ib) -{ - // How many? - - if (gpakr.fseek(pfil, ib, SEEK_SET) != 0) - return false; - word ctbmT; - if (gpakr.fread(&ctbmT, sizeof(ctbmT), 1, pfil) == 0) - return false; - m_ctbm = BigWord(ctbmT); - - // Alloc array of cache handles. These get stored in ram - - m_ahc = new CacheHandle[m_ctbm * 2]; - if (m_ahc == NULL) - return false; - memset(m_ahc, 0, sizeof(CacheHandle) * m_ctbm * 2); - - // Allocate space for entry headers, read them in, store - // in db ram. - - TBitmapEntry *ptbe = new TBitmapEntry[m_ctbm]; - if (ptbe == NULL) - return false; - for (int itbe = 0; itbe < m_ctbm; itbe++) { - TBitmapEntry *ptbeT = &ptbe[itbe]; - if ((int)gpakr.fread(ptbeT, kcbTBitmapEntry, 1, pfil) != 1) { - return false; - } -#ifndef __CPU_68K - // Swap bytes (non-Palm only) - - ptbeT->cx = BigWord(ptbeT->cx); - ptbeT->cy = BigWord(ptbeT->cy); - ptbeT->yBaseline = BigWord(ptbeT->yBaseline); - ptbeT->ibsd = BigWord(ptbeT->ibsd); - ptbeT->cbsd = BigWord(ptbeT->cbsd); -#endif - } - - word cbAlloc = sizeof(TBitmapEntry) * m_ctbm; - TBitmapEntry *ptbeT = (TBitmapEntry *)gmmgr.AllocPtr(cbAlloc); - if (ptbeT == NULL) { - delete[] ptbe; - return false; - } - gmmgr.WritePtr(ptbeT, 0, ptbe, cbAlloc); - m_atbe = ptbeT; - delete[] ptbe; - - // Remember file and offset - - m_pfil = pfil; - m_ibtbh = ib; - return true; -} - -void TBitmap::GetSize(Size *psiz) -{ - GetSize(0, psiz); -} - -void TBitmap::GetSize(int itbm, Size *psiz) -{ - Assert(itbm >= 0 && itbm < m_ctbm); - psiz->cx = (int)m_atbe[itbm].cx; - psiz->cy = (int)m_atbe[itbm].cy; -} - -extern "C" { -void CopyBits128Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits124Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits120Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits116Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits112Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits108Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits104Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits100Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits96Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits92Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits88Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits84Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits80Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits76Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits72Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits68Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits64Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits60Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits56Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits52Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits48Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits44Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits40Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits36Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits32Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits28Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits24Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits20Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits16Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits12Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits8Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -void CopyBits4Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) secCode8; -}; - -typedef void (*CopyBy4Proc)(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy); -CopyBy4Proc gapfnCopyBy4[kcCopyBy4Procs] = { - CopyBits4Wide, CopyBits8Wide, CopyBits12Wide, CopyBits16Wide, CopyBits20Wide, CopyBits24Wide, - CopyBits28Wide, CopyBits32Wide, CopyBits36Wide, CopyBits40Wide, CopyBits44Wide, CopyBits48Wide, - CopyBits52Wide, CopyBits56Wide, CopyBits60Wide, CopyBits64Wide, CopyBits68Wide, CopyBits72Wide, - CopyBits76Wide, CopyBits80Wide, CopyBits84Wide, CopyBits88Wide, CopyBits92Wide, CopyBits96Wide, - CopyBits100Wide, CopyBits104Wide, CopyBits108Wide, CopyBits112Wide, CopyBits116Wide, CopyBits120Wide, - CopyBits124Wide, CopyBits128Wide -}; - -void TBitmap::BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc) -{ - BltTo(0, pbmDst, xDst, yDst, side, prcSrc); -} - -void TBitmap::BltTo(class DibBitmap *pbmDst, int xDst, int yDst, Rect *prcSrc) -{ - BltTo(0, pbmDst, xDst, yDst, ksideNeutral, prcSrc); -} - -void TBitmap::BltTo(int itbm, class DibBitmap *pbmDst, int xDst, int yDst, Side side, Rect *prcSrc) -{ - // Get tbm dimensions - - Assert(itbm >= 0 && itbm < m_ctbm); - int cx = (int)m_atbe[itbm].cx; - int cy = (int)m_atbe[itbm].cy; - - // Source rect to blt from - - Rect rcSrc; - if (prcSrc != NULL) { - rcSrc = *prcSrc; - } else { - rcSrc.left = 0; - rcSrc.top = 0; - rcSrc.right = cx; - rcSrc.bottom = cy; - } - - // Get dib dimensions - - Size sizT; - pbmDst->GetSize(&sizT); - - // Right and bottom edge clipping - - if (sizT.cx - xDst < rcSrc.Width()) - rcSrc.right = rcSrc.left + sizT.cx - xDst; - if (sizT.cy - yDst < rcSrc.Height()) - rcSrc.bottom = rcSrc.top + sizT.cy - yDst; - - // Left and top edge clipping - - int xDstT = xDst; - if (xDstT < 0) { - rcSrc.left -= xDstT; - xDstT = 0; - } - int yDstT = yDst; - if (yDstT < 0) { - rcSrc.top -= yDstT; - yDstT = 0; - } - - // Anything to blt? - - if (rcSrc.IsEmpty()) - return; - -#ifdef STATS_DISPLAY - extern int gcBitmapsDrawn; - gcBitmapsDrawn++; -#endif - -#if 1 - byte *pbBits = pbmDst->GetBits(); -#else - BitmapType *pbmpScreen = WinGetBitmap(WinGetDisplayWindow()); - byte *pbBits = (byte *)BmpGetBits(pbmpScreen); - Fill(pbBits, 160, 160, 160, 1); -#endif - - // Look in the cache to see if this tbitmap has been compiled - - byte *pbDraw = GetCompiledBits(itbm, (xDst & 1) != 0); - if (pbDraw == NULL) - return; - - // If it is not clipped, draw directly to the dib, otherwise clip. - - if (rcSrc.Width() == cx && rcSrc.Height() == cy) { - // Draw - - int cbRowDst = (sizT.cx + 1) & ~1; - byte *pbDst = pbBits + (long)yDstT * cbRowDst + xDstT; - - if ((short)side < 0) { - DrawDispatchThunk(pbDraw, (byte *)s_ampscaiclrSide[5], pbDst, cbRowDst - cx, s_ampscaiclrSide[5], gmpiclriclrShadow); - } else { - DrawDispatchThunk(pbDraw, NULL, pbDst, cbRowDst - cx, s_ampscaiclrSide[side], gmpiclriclrShadow); - } - } else { - // If there is no fast copy proc for this size, then blt this slower - // way, which can clip any size. - - int cxMax = kcCopyBy4Procs * 4; - if (cx > cxMax || cy > cxMax) { - BltToScan(pbDraw, cx, cy, pbmDst, xDstT, yDstT, side, &rcSrc); - return; - } - - if (gpbmClip != NULL && gcyClipBuffer >= cy) { - Rect rc; - rc.left = xDstT & ~3; - rc.top = yDstT; - rc.right = rc.left + (((xDstT & 3) + rcSrc.Width() + 3) & ~3); - rc.bottom = rc.top + rcSrc.Height(); - int xDstClip = (((xDst & 3) + rcSrc.left) & ~3); - - gpbmClip->Blt(pbmDst, &rc, xDstClip, rcSrc.top); - byte *pbDrawAt = gpbmClip->GetBits() + (xDst & 3); - Size sizClip; - gpbmClip->GetSize(&sizClip); - int cbDrawReturn = sizClip.cx - cx; - - if ((short)side < 0) { - DrawDispatchThunk(pbDraw, (byte *)s_ampscaiclrSide[5], pbDrawAt, cbDrawReturn, s_ampscaiclrSide[5], gmpiclriclrShadow); - } else { - DrawDispatchThunk(pbDraw, NULL, pbDrawAt, cbDrawReturn, s_ampscaiclrSide[side], gmpiclriclrShadow); - } - - rc.Offset(xDstClip - rc.left, rcSrc.top - rc.top); - pbmDst->Blt(gpbmClip, &rc, xDstT & ~3, yDstT); - } else { - // We want to use gpbScratch to hold the screen bits, so if our cache alloc failed, don't - // do the operation - - if (pbDraw == gpbScratch) - return; - - // Copy from screen, draw, copy back to screen - - int xCopy = xDstT & ~3; - byte *pbDib = pbBits + (long)yDstT * sizT.cx + xCopy; - - int cbRunCopy = ((xDst & 3) + cx + 3) & ~3; - byte *pbCopy = gpbScratch + rcSrc.top * cbRunCopy + (((xDst & 3) + rcSrc.left) & ~3); - - int cxCopy = ((xDstT & 3) + rcSrc.Width() + 3) & ~3; - Assert((cxCopy >> 2) - 1 < kcCopyBy4Procs); - if (cxCopy > kcCopyBy4Procs * 4) - return; - CopyBy4Proc pfnCopy = gapfnCopyBy4[(cxCopy >> 2) - 1]; - pfnCopy(pbDib, sizT.cx - cxCopy, pbCopy, cbRunCopy - cxCopy, rcSrc.Height()); - - // Draw into buffer - - byte *pbDrawAt = gpbScratch + (xDst & 3); - int cbDrawReturn = cbRunCopy - cx; - - if ((short)side < 0) { - DrawDispatchThunk(pbDraw, (byte *)s_ampscaiclrSide[5], pbDrawAt, cbDrawReturn, s_ampscaiclrSide[5], gmpiclriclrShadow); - } else { - DrawDispatchThunk(pbDraw, NULL, pbDrawAt, cbDrawReturn, s_ampscaiclrSide[side], gmpiclriclrShadow); - } - - // Copy back to screen - - pfnCopy(pbCopy, cbRunCopy - cxCopy, pbDib, sizT.cx - cxCopy, rcSrc.Height()); - } - } -} - -void TBitmap::BltToScan(byte *pbDraw, int cx, int cy, DibBitmap *pbmDst, - int xDst, int yDst, Side side, Rect *prcSrc) -{ - // Clipping has already been performed - -#ifdef STATS_DISPLAY - extern int gcBitmapsDrawn; - gcBitmapsDrawn++; -#endif - - byte *pbBits = pbmDst->GetBits(); - Size sizT; - pbmDst->GetSize(&sizT); - - int cbRowDst = (sizT.cx + 1) & ~1; - byte *pbDst = pbBits + (long)yDst * cbRowDst + xDst; - - word *pw = (word *)pbDraw; - word *psc = (word *)(pbDraw + pw[0]); - byte *pbSrc = pbDraw + pw[1]; - byte *pop = pbDraw + sizeof(word) + sizeof(word); - - // Scan past any piece of the source vertically clipped - // at the top - - int y = 0; - int xoffset = 0; - if (prcSrc->top > 0) { - xoffset = YClipToScan(prcSrc->top, cx, pop, pbSrc, psc); - y = prcSrc->top; - } - - if (prcSrc->Width() == cx) { - // Not horz clipped; draw each scan directly to dest - pbDst += xoffset; - for (; y < prcSrc->bottom; y++) { - xoffset = DrawScan(pbDst, cx, pbSrc, pop, psc, - s_ampscaiclrSide[side], gmpiclriclrShadow); - pbDst += xoffset + (cbRowDst - cx); - } - } else { - // Horz clipped; copy from dst to temp scan, draw onto scan, - // copy from scan back to dst - - byte *pbScan = gpbmClip->GetBits(); - byte *pbCopyTo = pbScan + prcSrc->left; - - // Draw the scans - for (; y < prcSrc->bottom; y++) { - memcpy(pbCopyTo, pbDst, prcSrc->Width()); - xoffset += DrawScan(&pbScan[xoffset], cx, pbSrc, pop, psc, - s_ampscaiclrSide[side], gmpiclriclrShadow) - cx; - memcpy(pbDst, pbCopyTo, prcSrc->Width()); - pbDst += cbRowDst; - } - } -} - -byte *TBitmap::GetCompiledBits(int itbm, bool fOdd) -{ - CacheHandle *phc = &m_ahc[itbm * 2 + (fOdd ? 1 : 0)]; - byte *pbDraw = (byte *)gcam.GetPtr(*phc); - if (pbDraw == NULL) { - // Need to get the ScanData first. This may fail. - // Note: load ScanData into end gpbScratch, compile to - // beginning. _Should_ work. - - TBitmapEntry *ptbe = &m_atbe[itbm]; - if (gpakr.fseek(m_pfil, m_ibtbh + ptbe->ibsd, SEEK_SET) != 0) - return NULL; - ScanData *psd = (ScanData *)(gpbScratch + gcbScratch - ((ptbe->cbsd + 1) & ~1)); - if (gpakr.fread(psd, ptbe->cbsd, 1, m_pfil) != 1) - return NULL; - word cb = Compile8Thunk(gpbScratch, psd, (fOdd ? 1 : 0)); - *phc = gcam.NewObject(gpbScratch, cb); - pbDraw = (byte *)gcam.GetPtr(*phc); - if (pbDraw == NULL) - pbDraw = gpbScratch; - } - return pbDraw; -} - -void TBitmap::FillTo(int itbm, class DibBitmap *pbmDst, int xDst, int yDst, int cxDst, int cyDst, int xOrigin, int yOrigin) -{ - // Clip to the dib - - int cxTbm = m_atbe[itbm].cx; - int cyTbm = m_atbe[itbm].cy; - - if (xDst < 0) { - xOrigin = -(xDst - xOrigin) % cxTbm; - cxDst += xDst; - xDst = 0; - } - if (yDst < 0) { - yOrigin = -(yDst - yOrigin) % cyTbm; - cyDst += yDst; - yDst = 0; - } - Size sizDib; - pbmDst->GetSize(&sizDib); - if (xDst + cxDst > sizDib.cx) - cxDst = sizDib.cx - xDst; - if (yDst + cyDst > sizDib.cy) - cyDst = sizDib.cy - yDst; - - // Determine what the non-clipped "inside" is - - int xLeftInside; - if (xOrigin == 0) { - xLeftInside = xDst; - } else { - xLeftInside = xDst + cxTbm - xOrigin; - } - - int yTopInside; - if (yOrigin == 0) { - yTopInside = yDst; - } else { - yTopInside = yDst + cyTbm - yOrigin; - } - - int xRightInside; - if (xOrigin == 0 && cxDst == cxTbm) { - xRightInside = xDst + cxDst; - } else { - xRightInside = xDst + cxDst - ((xDst + cxDst) - (xDst - xOrigin)) % cxTbm; - } - - int yBottomInside; - if (yOrigin == 0 && cyDst == cyTbm) { - yBottomInside = yDst + cyDst; - } else { - yBottomInside = yDst + cyDst - ((yDst + cyDst) - (yDst - yOrigin)) % cyTbm; - } - - // Draw inside if there is anything to do - // OPT: Could write this part in assembly - - if (yTopInside < yBottomInside && xLeftInside < xRightInside) { - int cbRowDst = pbmDst->GetRowBytes(); - byte *pbRow = pbmDst->GetBits() + (long)yTopInside * sizDib.cx + xLeftInside; - word cbNextRow = cyTbm * cbRowDst; - byte *pbDraw = GetCompiledBits(itbm, (xLeftInside & 1) != 0); - if (pbDraw == NULL) - return; - for (int y = yTopInside; y < yBottomInside; y += cyTbm) { - byte *pbDst = pbRow; - for (int x = xLeftInside; x < xRightInside; x += cxTbm) { - DrawDispatchThunk(pbDraw, NULL, pbDst, cbRowDst - cxTbm, s_ampscaiclrSide[kside1], gmpiclriclrShadow); - pbDst += cxTbm; - } - pbRow += cbNextRow; - } - } - - // Draw edges - - if (xLeftInside <= xRightInside) { - if (xLeftInside != xDst) { - Rect rcT; - rcT.Set(-xOrigin, -yOrigin, cxTbm - xOrigin, cyTbm - yOrigin); - for (int y = yDst; y < yDst + cyDst; y += cyTbm) { - BltTo(itbm, pbmDst, xLeftInside - cxTbm, y, kside1, /*&rcT*/ NULL); - rcT.top = 0; - rcT.bottom = (yDst + cyDst) - y; - if (rcT.bottom > cyTbm) - rcT.bottom = cyTbm; - } - } - if (xRightInside != xDst + cxDst) { - Rect rcT; - rcT.Set(0, -yOrigin, xDst + cxDst - xRightInside, cyTbm - yOrigin); - for (int y = yDst; y < yDst + cyDst; y += cyTbm) { - BltTo(itbm, pbmDst, xRightInside, y, kside1, /*&rcT*/ NULL); - rcT.top = 0; - rcT.bottom = (yDst + cyDst) - y; - if (rcT.bottom > cyTbm) - rcT.bottom = cyTbm; - } - } - } - if (yTopInside <= yBottomInside) { - if (yTopInside != yDst) { - Rect rcT; - rcT.Set(0, -yOrigin, cxTbm, cyTbm - yOrigin); - for (int x = xLeftInside; x < xRightInside; x += cxTbm) { - rcT.right = xRightInside - x; - if (rcT.right > cxTbm) - rcT.right = cxTbm; - BltTo(itbm, pbmDst, x, yTopInside, kside1, &rcT); - } - } - if (yBottomInside != yDst + cyDst) { - Rect rcT; - rcT.Set(0, -yOrigin, cxTbm, cyTbm - yOrigin); - for (int x = xLeftInside; x < xRightInside; x += cxTbm) { - rcT.right = xRightInside - x; - if (rcT.right > cxTbm) - rcT.right = cxTbm; - BltTo(itbm, pbmDst, x, yBottomInside, kside1, &rcT); - } - } - } -} - -// C code for compiling / drawing - -#ifndef __CPU_68K -void CopyBits128Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits124Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits120Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits116Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits112Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits108Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits104Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits100Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits96Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits92Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits88Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits84Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits80Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits76Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits72Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits68Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits64Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits60Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits56Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits52Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits48Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits44Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits40Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits36Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits32Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits28Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits24Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits20Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits16Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits12Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits8Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} - -void CopyBits4Wide(byte *pbSrc, int cbSrcReturn, byte *pbDst, int cbDstReturn, int cy) -{ - dword *pdwSrc = (dword *)pbSrc; - dword *pdwDst = (dword *)pbDst; - while (cy-- != 0) { - *pdwDst++ = *pdwSrc++; - pdwSrc = (dword *)((byte *)pdwSrc + cbSrcReturn); - pdwDst = (dword *)((byte *)pdwDst + cbDstReturn); - } -} -#endif - -} // namespace wi