[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:

Colin Marquardt wrote:

I installed the package on my Ubuntu pre-Dapper system (updated
yesterday). After starting the binary, it took some time to bring up
the splash screen (which, BTW, you can't seem to click away, just
like OpenOffice.org - annoying!), and then something started to
consume a lot of CPU. Looking with top, I saw that it was Xgl. Xara
LX didn't come up in the minute I waited, so I killed it. I realize
that running Xgl is something unusual still, so I'm not complaining.

I'll be away until Monday, so I can't help with more info until
then, sorry.

Cheers,
 Colin
Colin,

I can reproduce exactly the problem you're reporting whilst using Xgl. For anyone who's interested what's causing it, it seem to be the conversion from wxBitmap to wxImage. Which we seem to be doing an awful lot, would it be possible to do it on demand like we do the actual loading of bitmaps?

   Luke

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
Index: ../wxOil/dibutil.cpp
===================================================================
--- ../wxOil/dibutil.cpp	(revision 787)
+++ ../wxOil/dibutil.cpp	(working copy)
@@ -2061,13 +2061,16 @@
 	// Writes all 256 values to each gun, and counts the number of different values which are 
 	// 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};
+	BYTE     Count[3] = {255, 255, 255};
+	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