Closed Bug 1185800 Opened 4 years ago Closed 4 years ago

Add a separate flags type for image decoder behavior

Categories

(Core :: ImageLib, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: seth, Assigned: seth)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 2 obsolete files)

Right now, image decoders accept "decode flags", but these flags are a subset of the "draw flags" that imgIContainer defines. It'd be much saner to have a separate type for "decode flags". Then we could add additional flags that are specific to decoders, which would allow us to get rid of the excessive boolean parameters to DecoderFactory::CreateDecoder(). If the two types of flags are distinct in the type system, that'd be even better, because right now it's error prone to remember to convert from one type to the other.
Whiteboard: [gfx-noted]
Here's the patch. There are a lot of changes but virtually all of them are
mechanical. The interesting changes are in DecoderFlags.h and SurfaceFlags.h
(where the new enum classes are defined) and Decoder.cpp/.h (where the Decoder
API is updated to use these new flags).

Essentially the FLAG_DECODE_* imgIContainer flags - the flags that actually
affect the *output* of the decoder - have become SurfaceFlags. The other boolean
flags that we pass to a Decoder, which affect its behavior but not the pixels it
generates, have become DecoderFlags. Separating these two is useful because in a
lot of places we only allow or only care about SurfaceFlags - for example,
lookups in the SurfaceCache *do* care about SurfaceFlags but do not care about
Decoderflags.

Note that SurfaceFlags.h has to be exported for now because SurfaceCache.h
includes it, and SurfaceCache.h is exported. (I'd like to eliminate the export
of SurfaceCache.h eventually, though.)
Attachment #8645094 - Flags: review?(tnikkel)
Assignee: nobody → seth
Status: NEW → ASSIGNED
Attachment #8645094 - Flags: review?(tnikkel) → review+
Thanks for the review! I foolishly put this in my patch queue after bug 1194059, so I won't be able to land it until that lands.
Depends on: 1194059
Attachment #8645094 - Attachment is obsolete: true
Attachment #8647874 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/3a12957a6bd3
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.