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 » Draw, Display, Images, Bitmaps, Icons » Crash in Painter
Re: Crash in Painter [message #39045 is a reply to message #38956] Sat, 09 February 2013 13:05 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I have examined the code, looks OK. I have put a new assert there:

Image DownScale(const Image& img, int nx, int ny)
{
	ASSERT(nx > 0 && ny > 0);
	Size ssz = img.GetSize();
	Size tsz = Size((ssz.cx + nx - 1) / nx, (ssz.cy + ny - 1) / ny);
	int div = nx * ny;
	Buffer<RGBAV> b(tsz.cx);
	ImageBuffer ib(tsz);
	RGBA *it = ~ib;
	int scx0 = ssz.cx / nx * nx;
	for(int yy = 0; yy < ssz.cy; yy += ny) {
		for(int i = 0; i < tsz.cx; i++)
			b[i].Clear();
		for(int yi = 0; yi < ny; yi++) {
			int y = yy + yi;
			if(y < ssz.cy) {
				const RGBA *s = img[y];
				const RGBA *e = s + scx0;
				const RGBA *e2 = s + ssz.cx;
				RGBAV *t = ~b;
				while(s < e) {
					for(int n = nx; n--;)
						t->Put(*s++);
					t++;
				}
				while(s < e2)
					t->Put(*s++);
				ASSERT(s <= ~img + img.GetLength());
			}
		}
		const RGBAV *s = ~b;
		for(int x = 0; x < tsz.cx; x++)
			*it++ = (s++)->Get(div);
	}
	return ib;
}


and played for a while with PainterExamples, still OK.

-> I am afraid that I will need more detailed information. E.g. DDUMPs of ssz, tsz, div, it and scx0.

Is not it possible that Image was somewhat damaged?

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: Painter and transformations
Next Topic: Draw/Paint speed slow
Goto Forum:
  


Current Time: Sun Apr 28 12:11:14 CEST 2024

Total time taken to generate the page: 0.07365 seconds