[Lazarus] More grid issues

Michael Van Canneyt michael at freepascal.org
Sat Jun 21 16:05:21 CEST 2008


Mattias Gaertner wrote:
> On Fri, 20 Jun 2008 21:24:13 -0300
> Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:
> 
>> Marc Weustink wrote:
>>> Luiz Americo Pereira Camara wrote:
>>>   
>>>> One old issue i have with TBitmap (not introduced now but that
>>>> could be resolved with this refactoring) is that when a image is
>>>> loaded with LoadFromStream or LoadFromFile a copy of the image
>>>> buffer is kept in memory. This can speedup if is necessary to
>>>> access the image data directly but for the more common case of
>>>> loading a file to display is waste of memory.
>>>>     
>>> This is no error, this is by design. And is only kept once and as
>>> long as the image isn't changed. Indeed, for cases where you know
>>> you never want to save it, we can add an property.
>>>   
>> Since the most common case is not save it, just display, the default 
>> should be not keep a copy of the stream. This my point.
> 
> 1. Many images are only loaded, but never displayed.

ow ? which ones ?

> 2. SaveStream often contains information, that is not stored in the
> corresponding TGraphic class. For example header information or higher
> resolution.

Not anymore. Most important info is stored in a rawimage description 
and/or the object itself. The stream is only kept to save an image in 
its original format.

> 3. The SaveStream is kept to make sure, that loading/saving creates the
> same stream. For example the IDE uses this a lot (TGraphics.Equals).

imo, except for jpeg maybe, load and save image code should reproduce 
the same image. TGraphic.Equals might get adapted to use better 
comarisation based on imagedata.

> Therefore:
> Iff the SaveStream is freed by default, *all* images of the LCL must be
> checked and the biggest part must be enabled to keep SaveStream at
> least at designtime.

I see no reason to check all images.

Marc




More information about the Lazarus mailing list