Closed Bug 1102617 Opened 10 years ago Closed 10 years ago

Replace imgIContainer::FrameIsOpaque with imgIContainer::IsOpaque

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file, 2 obsolete files)

So building the HAS_TRANSPARENCY patch (bug 1089880) made me realize:

- We determine whether an image is transparent using flags set in the image header in almost all cases.
- When animated images have some transparent frames, encoders generally mark all of the frames as transparent. (And generally, in real animations, most or all of the frames are *actually* transparent if any of them are transparent.)

So having per-frame transparency information doesn't buy us much. Let's move away from that and make HAS_TRANSPARENCY the single source of truth for whether an image is transparent. The plan is to replace imgIContainer::FrameIsOpaque with imigIContainer::IsOpaque, which takes no arguments and just answers based upon whether HAS_TRANSPARENCY has fired.

This cleans up our code slightly, but the real benefits are in patches I haven't landed yet, where routing aWhichFrame around just so that ApplyDecodeFlags can call FrameIsOpaque will cause a substantial increase in complexity if we don't make this change.
Here's the patch.
Attachment #8526433 - Flags: review?(tnikkel)
Whoops, forgot to remove the now unused aWhichFrame parameter to ApplyDecodeFlags. I've verified that this builds locally; since the parameter was unused, I don't think another try job is needed.
Attachment #8526445 - Flags: review?(tnikkel)
Attachment #8526433 - Attachment is obsolete: true
Attachment #8526433 - Flags: review?(tnikkel)
So I had to rebase this, and while doing so I realized that I'm pretty sure we only check whether the image is animated in nsDisplayImage::GetOpaqueRegion because we previously had to pessimistically assume that there could be some transparent frame. Now that we're using IsOpaque instead of FrameIsOpaque, we actually don't need to worry about that, so I removed the check.

(To be sure I'm right about this, I'll push another try job.)
Attachment #8527085 - Flags: review?(tnikkel)
Attachment #8526445 - Attachment is obsolete: true
Attachment #8526445 - Flags: review?(tnikkel)
No longer depends on: 1089880
Depends on: 1103328
Bug 1103328 fixes the failures that occurred as a result of the change I mentioned in comment 4. Here's a new try job, which should now be green:

https://tbpl.mozilla.org/?tree=Try&rev=1aabbd3916ee
Attachment #8527085 - Flags: review?(tnikkel) → review+
https://hg.mozilla.org/mozilla-central/rev/5ff89c5a8393
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Depends on: 1110085
Depends on: 1124610
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: