Closed Bug 413933 Opened 17 years ago Closed 17 years ago

APNGs flash while loading

Categories

(Core :: Graphics: ImageLib, defect, P2)

x86
All
defect

Tracking

()

VERIFIED FIXED
mozilla1.9beta4

People

(Reporter: pavlov, Assigned: alfredkayser)

References

()

Details

Attachments

(1 file)

I'm very disturbed to find animated 3d dolphins on the internet. I'm more disturbed that they flash while loading. Would be great if we can fix this somehow. Alfred: Any chance you could take a look at this?
Flags: blocking1.9?
The animations there are all quite large (The dolphin is ~1MB), could be that we're displaying frames that are only partially downloaded/decoded?
Yeah, that's almost certainly what's happening -- but I was pretty sure we'd only display fully decoded frames when an animation is involved. It looks like we're getting to a partially-decoded frame and then holding on it while it loads, then going on to the next one, etc.
Probably quite simple. In the GIF decoder we made sure that the ImageUpdated (and OnDataAvailable) are only called on the first frame (as only the first frame is allowed to be displayed incrementally). So, in the PNG decoder the same needs to happen, about here: http://lxr.mozilla.org/seamonkey/source/modules/libpr0n/decoders/png/nsPNGDecoder.cpp 787 nsIntRect r(0, row_num, width, 1); 788 nsCOMPtr<nsIImage> img(do_GetInterface(decoder->mFrame)); 789 img->ImageUpdated(nsnull, nsImageUpdateFlags_kBitsChanged, &r); 790 decoder->mObserver->OnDataAvailable(nsnull, decoder->mFrame, &r);
Version: unspecified → Trunk
I see this on Linux as well.
OS: Windows XP → All
Flags: blocking1.9? → blocking1.9+
Priority: -- → P2
Assignee: nobody → alfredkayser
Attached patch V1: Fix the flickering... (deleted) — Splinter Review
Notes: * Replaced the apngFlags with a PRPackedBool * Added 'EndImageFrame' to consolidate the end frame code into one place * passing png's frame_num to EndFrameDecode doesn't work (as it may be one ahead), so replaced with GetNumFrames() * Removed the use of GetPreferredAlphaChannelFormat (it always returns RGB_A8). * Removed the ibpr/bpr code (allocating an frame to just get bpr) (as it was not used). * Replaced decoder->mFrame->GetFormat() with decoder->format (as it is the same). * Only do incremental image updates for the first frame, as for other frames it will cause fickering...
Attachment #300863 - Flags: review?(pavlov)
Status: NEW → ASSIGNED
Comment on attachment 300863 [details] [diff] [review] V1: Fix the flickering... save the animated dolphins!
Attachment #300863 - Flags: review?(pavlov) → review+
Keywords: checkin-needed
Attachment #300863 - Flags: approval1.9?
Comment on attachment 300863 [details] [diff] [review] V1: Fix the flickering... This is a blocker. You don't need approval.
Attachment #300863 - Flags: approval1.9?
Sorry, I overlooked the 'blocker' flag.
Checking in modules/libpr0n/decoders/png/nsPNGDecoder.cpp; /cvsroot/mozilla/modules/libpr0n/decoders/png/nsPNGDecoder.cpp,v <-- nsPNGDecoder.cpp new revision: 1.80; previous revision: 1.79 done Checking in modules/libpr0n/decoders/png/nsPNGDecoder.h; /cvsroot/mozilla/modules/libpr0n/decoders/png/nsPNGDecoder.h,v <-- nsPNGDecoder.h new revision: 1.21; previous revision: 1.20 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta4
Verified fix on Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b4pre) Gecko/2008022704 Minefield/3.0b4pre. Flashing in URL testcase is gone.
Status: RESOLVED → VERIFIED
Verified on minefield 20080226 on Gutsy. Looks great.
Depends on: 411852
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: