[Lazarus] Graphics changes (r15472)

Luiz Americo Pereira Camara luizmed at oi.com.br
Sat Jun 21 02:24:13 CEST 2008


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.

>> There's also another problem with it: if the image is modified using 
>> LCLIntf functions like BitBlt the buffer will not be updated and next 
>> time SaveToFile/Stream is called, the buffer (with the outdated data) 
>>     
>  > will be used.
>
> Which buffer do you mean ?
>
>   

The SaveStream.

Luiz



More information about the Lazarus mailing list