From b67f88a3a21c446f0c30e52cea45d8ff28942ec0 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 10 May 2008 12:45:41 +0000 Subject: * Two more OutPacket refactors. TextureSender. * The split image packet sender doesn't like to be refactored (images don't load after it's been refactored), so left that as is for the moment. --- .../Modules/Agent/TextureSender/TextureSender.cs | 33 ++++++++-------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs') diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs index e19274e..ea84436 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/TextureSender.cs @@ -150,37 +150,27 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender { if (NumPackets == 0) { - ImageDataPacket im = new ImageDataPacket(); - im.Header.Reliable = false; - im.ImageID.Packets = 1; - im.ImageID.ID = m_asset.FullID; - im.ImageID.Size = (uint) m_asset.Data.Length; - im.ImageData.Data = m_asset.Data; - im.ImageID.Codec = 2; - im.Header.Zerocoded = true; - RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); + + RequestUser.SendImagePart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); + PacketCounter++; } else { - ImageDataPacket im = new ImageDataPacket(); - im.Header.Reliable = false; - im.ImageID.Packets = (ushort) (NumPackets); - im.ImageID.ID = m_asset.FullID; - im.ImageID.Size = (uint) m_asset.Data.Length; - im.ImageData.Data = new byte[600]; - Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); - im.ImageID.Codec = 2; - im.Header.Zerocoded = true; - RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); + + byte[] ImageData1 = new byte[600]; + Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); + + RequestUser.SendImagePart((ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); PacketCounter++; } } else { + // Doesn't like to be refactored... ImagePacketPacket im = new ImagePacketPacket(); im.Header.Reliable = false; - im.ImageID.Packet = (ushort) (PacketCounter); + im.ImageID.Packet = (ushort)(PacketCounter); im.ImageID.ID = m_asset.FullID; int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); if (size > 1000) size = 1000; @@ -195,8 +185,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender m_asset.FullID.ToString()); return; } - im.Header.Zerocoded = true; RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); + + PacketCounter++; } } -- cgit v1.1