 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Eric Carlson Guest
|
Posted: Sun Aug 21, 2005 7:39 am Post subject: TCanvas.StretchDraw GDI leak |
|
|
Image1, Image2: TBitmap;
Image2.LoadFromFile('C:windowsgreenstone.bmp');
Image2 is valid, the file load is for example, Image1 has only had this done
to it
Image1.Width := 100;
Image1.Height := 100;
Image1.Canvas.StretchDraw(Image1.Canvas.ClipRect, Image2);
Image1 and Image2 are in a custom class and are created in its contstructor.
Its destructor is
Image1.FreeImage;
freeAndNil(Image1);
Image2.FreeImage;
freeAndNil(Image2);
The custom class is created each time. In a timer loop of 200ms I'm getting
2 GDI leaks every 30 secs or so. When I slow the loop to 1 sec its every few
minutes. What have I missed please?
|
|
| Back to top |
|
 |
Mat Ballard Guest
|
Posted: Sun Aug 21, 2005 11:20 pm Post subject: Re: TCanvas.StretchDraw GDI leak |
|
|
Eric Carlson wrote:
| Quote: | Image1, Image2: TBitmap;
Image2.LoadFromFile('C:windowsgreenstone.bmp');
Image2 is valid, the file load is for example, Image1 has only had this done
to it
Image1.Width := 100;
Image1.Height := 100;
Image1.Canvas.StretchDraw(Image1.Canvas.ClipRect, Image2);
Image1 and Image2 are in a custom class and are created in its contstructor.
Its destructor is
Image1.FreeImage;
freeAndNil(Image1);
Image2.FreeImage;
freeAndNil(Image2);
The custom class is created each time. In a timer loop of 200ms I'm getting
2 GDI leaks every 30 secs or so. When I slow the loop to 1 sec its every few
minutes. What have I missed please?
|
i've run into a few oddities myself with graphics operations not being carried
out. after going mildly nuts i found out about the Windows.GdiFlush function -
check it out in the Win32 SDK. the bad news was that adding calls to GdiFlush
did not help.
what did help in the end was code like:
j := Image1.Picture.Bitmap.Handle; // look at what GetHandle does
inc(j); // so the compiler does not remove the above line
not sure if it will help, but the GDI does some weird things.
cheers,
Mat
|
|
| Back to top |
|
 |
Eric Carlson Guest
|
Posted: Tue Aug 23, 2005 10:25 am Post subject: Re: TCanvas.StretchDraw GDI leak |
|
|
| Quote: | what did help in the end was code like:
j := Image1.Picture.Bitmap.Handle; // look at what GetHandle does
inc(j); // so the compiler does not remove the above
line
not sure if it will help, but the GDI does some weird things.
Hey thanks! Was that before or after the stretchDraw? |
|
|
| Back to top |
|
 |
Mat Ballard Guest
|
Posted: Tue Aug 23, 2005 11:26 pm Post subject: Re: TCanvas.StretchDraw GDI leak |
|
|
g'day Eric,
re:
| Quote: | what did help in the end was code like:
j := Image1.Picture.Bitmap.Handle; // look at what GetHandle does
inc(j); // so the compiler does not remove the above
line
not sure if it will help, but the GDI does some weird things.
Hey thanks! Was that before or after the stretchDraw?
|
it occurred randomly after intensive graphics operations - sometimes Draw or
StretchDraw, sometimes pixel manipulation through ScanLine, sometimes simple
Assigning.
it was as though the GDI engine ran out of of puff and just skipped a few
operations.
cheers,
Mat
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|