Пример #1
0
ZDCPixmapRaster_Simple::ZDCPixmapRaster_Simple(ZRef<ZDCPixmapRaster> iOther)
:	ZDCPixmapRaster(iOther->GetRasterDesc())
	{
	fCanModify = true;
	const size_t bufferSize = fRasterDesc.fRowBytes * fRasterDesc.fRowCount;

	// Oversize the buffer slightly, to allow for some code in ZDCPixmapBlit that
	// may *read* past the end of a buffer in some situations.
	fBuffer = new uint8[bufferSize + 4];
	fBaseAddress = fBuffer;
	sMemCopy(fBuffer, iOther->GetBaseAddress(), bufferSize);
	}
Пример #2
0
static void sReadImageData(const ZStreamR& iStream,
	bool iInterlaced, const ZRect& iBounds, ZRef<ZDCPixmapRaster> ioRaster)
	{
	uint8 initialCodeSize = iStream.ReadUInt8();

	StreamR_Chunk theSIC(iStream);
	ZStreamR_LZWDecode theSILZW(initialCodeSize, theSIC);

	ZDCPixmapNS::PixvalDesc sourcePixvalDesc(8, true);

	void* destBaseAddress = ioRaster->GetBaseAddress();

	ZDCPixmapNS::RasterDesc destRasterDesc = ioRaster->GetRasterDesc();

	vector<uint8> theRowBufferVector(iBounds.Width());
	void* theRowBuffer = &theRowBufferVector[0];

	if (iInterlaced)
		{
		for (int pass = 0; pass < 4; ++pass)
			{
			for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
				currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
				{
				theSILZW.Read(theRowBuffer, iBounds.Width());
				void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

				ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
					destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
					iBounds.Width());
				}
			}
		}
	else
		{
		for (ZCoord currentY = iBounds.top; currentY < iBounds.bottom; ++currentY)
			{
			theSILZW.Read(theRowBuffer, iBounds.Width());
			void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

			ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
				destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
				iBounds.Width());
			}
		}
	}