mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Improved performance on drawing image. (2-10 times faster in some cases)
This commit is contained in:
		| @@ -225,15 +225,10 @@ Bitmap* CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, | |||||||
| 				if (Ok == bitmap->GetLastStatus()) | 				if (Ok == bitmap->GetLastStatus()) | ||||||
| 				{ | 				{ | ||||||
| 					//////////////////////////////////////////// | 					//////////////////////////////////////////// | ||||||
| 					// Workaround to avoid image corruption with JPEG in some cases | 					// Convert loaded image to faster blittable bitmap (may increase memory usage slightly) | ||||||
| 					if (CSystem::GetOSPlatform() < OSPLATFORM_7) |  | ||||||
| 					{ |  | ||||||
| 						GUID guid; |  | ||||||
| 						bitmap->GetRawFormat(&guid); |  | ||||||
| 						if (guid == ImageFormatJPEG) |  | ||||||
| 					{ | 					{ | ||||||
| 						Rect r(0, 0, bitmap->GetWidth(), bitmap->GetHeight()); | 						Rect r(0, 0, bitmap->GetWidth(), bitmap->GetHeight()); | ||||||
| 							Bitmap* clone = new Bitmap(r.Width, r.Height, PixelFormat24bppRGB); | 						Bitmap* clone = new Bitmap(r.Width, r.Height, PixelFormat32bppPARGB); | ||||||
| 						{ | 						{ | ||||||
| 							Graphics graphics(clone); | 							Graphics graphics(clone); | ||||||
| 							graphics.DrawImage(bitmap, r, 0, 0, r.Width, r.Height, UnitPixel); | 							graphics.DrawImage(bitmap, r, 0, 0, r.Width, r.Height, UnitPixel); | ||||||
| @@ -244,7 +239,6 @@ Bitmap* CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, | |||||||
| 						::GlobalFree(hBuffer); | 						::GlobalFree(hBuffer); | ||||||
| 						hBuffer = NULL; | 						hBuffer = NULL; | ||||||
| 					} | 					} | ||||||
| 					} |  | ||||||
| 					//////////////////////////////////////////// | 					//////////////////////////////////////////// | ||||||
| 					*ppCache = new ImageCache(bitmap, hBuffer); | 					*ppCache = new ImageCache(bitmap, hBuffer); | ||||||
| 					return bitmap; | 					return bitmap; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 spx
					spx