void CopyBlits8_8 ( const PixMapHandle, const PixMapHandle, const Rect, const Rect ); void CopyBlits8_8 ( const PixMapHandle srcPixMapHdl, const PixMapHandle dstPixMapHdl, const Rect *srcRect, const Rect *dstRect ) { UInt32 doubleCount,lineCount,count; UInt8 startFlags, endFlags; UInt8 *src, *dst; UInt32 srcSkip, dstSkip; UInt32 width,height; width = srcRect->right - srcRect->left; height = srcRect->bottom - srcRect->top; if (!width || !height) return; #if DO_LOCKING { GWorldFlags srcGWFlags = GetPixelsState(srcPixMapHdl); GWorldFlags dstGWFlags = GetPixelsState(dstPixMapHdl); if (0 == (srcGWFlags & pixelsLocked)) // if source not locked if (!LockPixels(srcPixMapHdl)) // and we can't lock it return; // give up if (0 == (dstGWFlags & pixelsLocked)) // if dest not locked if (!LockPixels(dstPixMapHdl)) // and we can't lock it goto unlock; #endif srcSkip = (*srcPixMapHdl)->rowBytes & 0x3FFF; dstSkip = (*dstPixMapHdl)->rowBytes & 0x3FFF; src = (UInt8*) GetPixBaseAddr(srcPixMapHdl) + (srcSkip * (srcRect->top - (*srcPixMapHdl)->bounds.top)) + srcRect->left - (*srcPixMapHdl)->bounds.left; dst = (UInt8*) GetPixBaseAddr(dstPixMapHdl) + (dstSkip * (dstRect->top - (*dstPixMapHdl)->bounds.top)) + dstRect->left - (*dstPixMapHdl)->bounds.left; startFlags = ((UInt8 *) (((UInt32) src + 7U) & ~7U)) - src; endFlags = ((UInt32) (src + width)) & 7U; doubleCount = ((width - startFlags) - endFlags) / 8; // pre-fix skip values srcSkip -= width; dstSkip -= width; for (lineCount = 0; lineCount < height; lineCount++) { if (startFlags & 1) // byte align *dst++ = *src++; if (startFlags & 2) // word align { *(UInt16*) dst = *(UInt16*) src; src += 2; dst += 2; } if (startFlags & 4) // long align { *(UInt32*) dst = *(UInt32*) src; src += 4; dst += 4; } // copy doubles for (count = 0; count < doubleCount; count++) { *(double*) dst = *(double*) src; src += 8; dst += 8; } // copy remaining long if (endFlags & 4) { *(UInt32*) dst = *(UInt32*) src; src += 4; dst += 4; } // copy remaining word if (endFlags & 2) { *(UInt16*) dst = *(UInt16*) src; src += 2; dst += 2; } // copy remaining byte if (endFlags & 1) *dst++ = *src++; src += srcSkip; dst += dstSkip; } #if DO_LOCKING unlock: if (0 == (srcGWFlags & pixelsLocked)) // if source wasn't locked UnlockPixels(srcPixMapHdl); // unlock it if (0 == (dstGWFlags & pixelsLocked)) // if dest wasn't locked UnlockPixels(dstPixMapHdl); // unlock it } #endif }