Spurious white block in animated GIF

RESOLVED FIXED

Status

()

Core
ImageLib
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Justin Kerk, Unassigned)

Tracking

Trunk
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
Spun off from bug 376446 - the animated GIF in the URL shows a white (transparent, really) square during part of the animation which is not shown with other programs like IE7 and IrfanView.

Bug 376446 comment 40 suggests this might be fixed by the patch for bug 317748, so marking dependent for now.

Comment 1

11 years ago
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a5pre) Gecko/20070531 Minefield/3.0a5pre

RyanVM asked me to see if the patch in bug 317748 fixed this for me. I applied the patch and can confirm it fixes this issue.
OS: Windows XP → All
Hardware: PC → All

Comment 2

11 years ago
The following code in imgContainer.cpp SetMaskVisibility is suspicious:

 928 asqueella  1.45   PRUint8* alphaData;
 929                   PRUint32 alphaDataLength;
 930                   const PRUint8 setMaskTo = aVisible ? 0xFF : 0x00;
 931                 
 932                   aFrame->LockImageData();
 933                   nsresult res = aFrame->GetImageData(&alphaData, &alphaDataLength);
 934                   if (NS_SUCCEEDED(res)) {
 935                 #ifdef IS_LITTLE_ENDIAN
 936                     alphaData += aY*frameWidth*4 + 3;
 937                 #else
 938                     alphaData += aY*frameWidth*4;
 939                 #endif
 940                     for (PRInt32 j = height; j > 0; --j) {
 941                       for (PRInt32 i = (aX+width-1)*4; i >= aX; i -= 4) {
 942                         alphaData[i] = setMaskTo;
 943                       }
 944                       alphaData += frameWidth*4;
 945                     }
 946                   }
 947                   aFrame->UnlockImageData();

Especially the line:
 941                       for (PRInt32 i = (aX+width-1)*4; i >= aX; i -= 4) {
i is column position multiplied by 4 (so that it steps by the 4 bytes per pixel). But the end check: i > aX is then not right, and should be i >= aX*4.

Instead of trying to fix this buggy code, bug 317748 completely removes this, so let we do that. 
(Reporter)

Comment 3

11 years ago
Fixed by the patch for bug 317748.
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.