Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Request: completion 64 bit support in Draw and Stream
Re: Request: completion 64 bit support in Draw and Stream [message #39026 is a reply to message #39013] Thu, 07 February 2013 17:35 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
nixnixnix wrote on Wed, 06 February 2013 09:13

Here is my patch.

void Image::Serialize(Stream& s)
{
	int version = 0;
	s / version;
	Size sz = GetSize();
	Point p = GetHotSpot();
	Size dots = GetDots();
	s % sz % p % dots;
	int64 len = (int64)sz.cx * (int64)sz.cy * (int64)sizeof(RGBA);
	if(s.IsLoading())
		if(len) {
			ImageBuffer b(sz);
			
			int64 offset = 0;
			const byte* ptr = (byte*)~b;
			
			while(len>INT_MAX)
			{
				if(!s.GetAll((void*)(ptr+offset), INT_MAX))
				{
					s.SetError();
					return;
				}
				len -= INT_MAX;
				offset += INT_MAX;
			}			
			if(!s.GetAll((void*)(ptr+offset), len))
				s.SetError();
			
			b.SetDots(dots);
			b.SetHotSpot(p);
			*this = b;
		}
		else
			Clear();
	else
	{
		int64 offset = 0;
		const byte* ptr = (byte*)~*this;
				
		while(len>INT_MAX)
		{
			s.Put(ptr+offset, INT_MAX);
			len -= INT_MAX;
			offset += INT_MAX;
		}
		s.Put(ptr+offset, len);
	}
}


I realised that what I was asking would necessitate a lot of rewriting of other code in UPP. I have tested this and it works with an image of 3.45GB.

Can we make this change in the SVN please?

Cheers,

Nick


It is in svn now. I think I will add direct support to Stream soon.

I also think that you might consider whether you really need to store the image expanded. Note that you can e.g. draw compressed TIFF in Paint with some effort. Or you can rescale it to something smaller without decompressing original.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Jsonize int64 surprise
Next Topic: Gcc compile option proposal
Goto Forum:
  


Current Time: Mon May 06 11:50:44 CEST 2024

Total time taken to generate the page: 0.02536 seconds