[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: Please test static .deb package Was: [XaraXtreme-dev] 0.4 Release



Luke Hart wrote:

Further investigation indicates that the real issue is GetPixel @ dibutil.cpp:2070, commenting this makes the startup run in a more normal time. It seems that getting a pixel from an on-screen DC is very slow indeed, which I surpose is to be expected. I've attached a patch which works, but doesn't maintain the full fucntionality of CalcConvertHint. Instead of using the passed DC it creates its own memory DC and bitmap and uses these (they will of course be at the same bit-depth and layout as the physical screen).

Phil/Gerry: Is pDC every likely to a non-screen DC?

   Luke

Updated patch without a part of my initial bodge.

   Luke
Index: ../wxOil/dibutil.cpp
===================================================================
--- ../wxOil/dibutil.cpp	(revision 787)
+++ ../wxOil/dibutil.cpp	(working copy)
@@ -2062,12 +2062,15 @@
 	// returned - i.e. a 5 bit gun cannot return more than 32 values
 	BYTE LastValue[3] = {0, 0, 0};
 	BYTE     Count[3] = {0, 0, 0};
+	wxMemoryDC	memdc;
+	wxBitmap	bitmap( 1, 1 );
+	memdc.SelectObject( bitmap );
 	for ( UINT32 Value=0x00; Value<0x100; Value++ )
 	{
 		wxColour colour;
-		pDC->SetPen(wxPen(wxColour(Value,Value,Value)));
-		pDC->DrawPoint(0,0);
-		pDC->GetPixel(0,0,&colour);
+		memdc.SetPen(wxPen(wxColour(Value,Value,Value)));
+		memdc.DrawPoint(0,0);
+		memdc.GetPixel(0,0,&colour);
 		if ( colour.Red()!=LastValue[0] )
 		{
 			LastValue[0] = colour.Red();
@@ -2084,6 +2087,7 @@
 			Count[2]++;
 		}
 	}
+	memdc.SelectObject( wxNullBitmap );
 
 	// Now determine how many bits would be needed to store the number of values we generated
 	// for each gun. Note that this code will return (eg) 5 bits for all values between 17-32 inclusive