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 » Developing U++ » U++ Developers corner » Optimizing DrawImage across platforms
Re: MILESTONE: gtk3 replaces gtk2 as default linux backend [message #53685 is a reply to message #53684] Mon, 20 April 2020 20:59 Go to previous messageGo to previous message
Tom1
Messages: 1303
Registered: March 2007
Ultimate Contributor
Hi,

One Win32 question: Is it really necessary to cache the image if it is actually going to be drawn as a colored rect or via SetSurface?

Best regards,

Tom

[EDIT] Did some testing and this is faster than using SetSurface after caching:

void SystemDraw::SysDrawImageOp(int x, int y, const Image& img, const Rect& src, Color color)
{
	GuiLock __;
	if(img.GetLength() == 0)
		return;
	LLOG("SysDrawImageOp " << img.GetSerialId() << ' ' << img.GetSize());

// Insert this optimization here:
	int kind = img.GetKindNoScan();
	if(kind == IMAGE_OPAQUE && !IsNull(color)) {
		Size sz=img.GetSize();
		DrawRect(x, y, sz.cx, sz.cy, color);
		return;
	}
	if(kind == IMAGE_OPAQUE && (GetDeviceCaps(GetHandle(), RASTERCAPS) & RC_DIBTODEV)) {
		LTIMING("Image Opaque direct set");
		Size sz=img.GetSize();
		SetSurface(*this, x, y, sz.cx, sz.cy, ~img);
		return;
	}
// End of insertion

	ImageSysDataMaker m;
	...


Or is there some other reason to cache the image before display?

[Updated on: Mon, 20 April 2020 22:49]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rapsberry PI - cpu dilemma
Next Topic: U++ on Telegram
Goto Forum:
  


Current Time: Wed Jun 04 15:11:44 CEST 2025

Total time taken to generate the page: 0.12299 seconds