[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] PNG image reader

From: Marco Gerards
Subject: Re: [PATCH] PNG image reader
Date: Fri, 25 Jan 2008 10:05:25 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Bean <address@hidden> writes:

> On Jan 24, 2008 8:14 PM, Marco Gerards <address@hidden> wrote:
>> It would be nice, not required.  I don't expect too much problems
>> here...
>> Perhaps a better approach would be possible to do a check after
>> reading a size:
>> int size = foo();
>> Check the size of the file here
>> while (size--)
>> {
>>   read pixels;
>> }
> png is compressed, it's not easy to separate the pixels.

I know.  With size, I meant on disk data.  In many formats, compressed
data is stored like this:

struct foo
  int width;
  int height;
  int on_disk_size;
  char data[];

Some decompressors have to be initialized by this size.  It's an
optimization, so zeros that follow do not have to be stored:

3A 3E AA 00 4E 00 00 00 00

on_disk_size = 5

>> Or just check for grub_errno or so after reading the picture?
> yes, after the picture is decoded, grub_errno is checked, if it's non
> zero, the bitmap image will be deallocated.


(this wouldn't have worked if grub_errno was zero'ed, like it was
discussed yesterday ;-))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]