Date: Thu, 07 Mar 2002 06:03:39 +0900 From: Takuo Nakamura Subject: Re: Slow scanline access Newsgroups: borland.public.delphi.graphics In-Reply-To: References: X-NewsReader: Datula version 1.51.08 for Windows Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII NNTP-Posting-Host: 211.132.37.125 Message-ID: <3c8683b4$1_1@dnews> X-Trace: dnews 1015448500 211.132.37.125 (6 Mar 2002 13:01:40 -0800) Lines: 33 Path: dnews Xref: dnews borland.public.delphi.graphics:46875 John Carlyle-Clarkewrote >I haven't got to the bottom of this yet, but I have some code that always >has worked OK, and even now is working OK some of the time. > >However, sometimes, it seems to slow down by about 1000 times. The bit that >is taking the time I think is accessing a TBitmap by scanline. It seems, >from stepping through the VCL code, that every time I access the scanline >the bitmap is getting deleted and recreated. I'm not totally sure, because >I don't really follow the VCL code. Maybe, you encountered the famous Scanline's Bug. When Scanline property is read(GetScanline is Called) and TBitmap has DDB and DIB Section or TBitmap has only DDB, TBitmap discards DIB Section if necessary and and create DIB Section from DDB without Freeing DDB. Subsequent References of Scanline proeprty cause same thing. This behaviour make scanline property extremely slow!! To avoid this problem, you should discard DDB in TBitmap before accessing Scanline property as follows. Bitmap.HandleType := bmDIB; or Bitmap.Dormant; I think Borland should reconstruct TBitmap and throw away the complex implementation which allow DDB and DIB Section exist simultaneuosly in Single TBitmap. -- Takuo Nakamura mailto:nakamuri@asahi.email.ne.jp