Closed Bug 1255104 Opened 4 years ago Closed 4 years ago
Pipe in the Icon decoder
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.
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.
Whoops, forgot to commit before attaching.
Attachment #8728684 - Flags: review?(n.nethercote)
Attachment #8728684 - Flags: review?(n.nethercote) → review+
Thanks for the review!
https://hg.mozilla.org/integration/mozilla-inbound/rev/033d603cd91d2a6ec256c23cb26f7aa4310e47b0 Bug 1255104 - Use SurfacePipe in nsIconDecoder. r=njn
Depends on: 1261964
You need to log in before you can comment on or make changes to this bug.