Closed Bug 1255104 Opened 4 years ago Closed 4 years ago

Use SurfacePipe in the Icon decoder


(Core :: ImageLib, defect)

Not set



Tracking Status
firefox48 --- fixed


(Reporter: seth, Assigned: seth)


(Blocks 1 open bug)



(1 file, 1 obsolete file)

SurfacePipe is intended to eliminate the possibility of output buffer overflows in ImageLib, so we want to use it for all decoders. That includes Icon.

This is a good opportunity to introduce downscale-during-decode support for the Icon format, since it's trivial with SurfacePipe.
Blocks: 1255109
Silly me - of course we already introduced downscale-during-decode for Icon. I went ahead and did this one because the patch is so simple, and I figured it'd be nice to have this as a simple example for both SurfacePipe and StreamingLexer.
Here's the patch. nsIconDecoder is truly minimal at this point. We could even
get rid of mBytesPerRow but I think it makes things a bit clearer.

I preferred WritePixels to WriteRows here. Unlike in the GIF decoder, there's
probably not enough work per pixel to make this effectively free (i.e. memcpy
with WriteRows would undoubtedly be faster) but I would prefer the additional
memory safety unless we run into an issue.
Attachment #8728682 - Flags: review?(n.nethercote)
Whoops, forgot to commit before attaching.
Attachment #8728684 - Flags: review?(n.nethercote)
Attachment #8728682 - Attachment is obsolete: true
Attachment #8728682 - Flags: review?(n.nethercote)
Assignee: nobody → seth
Attachment #8728684 - Flags: review?(n.nethercote) → review+
Thanks for the review!
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Depends on: 1256198
No longer depends on: 1256198
You need to log in before you can comment on or make changes to this bug.