Closed
Bug 361299
Opened 18 years ago
Closed 17 years ago
read image directly from input stream in icon decoder
Categories
(Core :: Graphics: ImageLib, defect)
Tracking
()
VERIFIED
FIXED
mozilla1.9alpha8
People
(Reporter: jaas, Assigned: alfredkayser)
References
Details
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
tor
:
superreview+
|
Details | Diff | Splinter Review |
The mac icon decoder is broken under cocoa-cairo. No icons draw (see unknown content dialog). It works fine under cocoa-quickdraw.
In nsIconDecoder.cpp, "mFrame->GetAlphaBytesPerRow(&abpr);", abpr is 64 for a 16x16 image with 1 bit alpha. That is almost certainly incorrect. It should be 16, and it is when using gfx/src/mac instead of gfx/src/thebes.
PRInt32
nsThebesImage::GetLineStride()
{
return mStride;
}
PRInt32
nsThebesImage::GetAlphaLineStride()
{
return (mAlphaDepth > 0) ? mStride : 0;
}
Why would GetAlphaLineStride() return the same thing as GetLineStride() if the image has alpha and then 0 vs. mStride when the image does not have alpha?
Flags: blocking1.9+
Comment 2•18 years ago
|
||
Hmm, so this could be the cause of https://bugzilla.mozilla.org/attachment.cgi?id=246323&action=view (bug 361568)?
Assignee | ||
Comment 3•18 years ago
|
||
Actually doing mFrame->GetAlphaBytesPerRow(&abpr); to get the size of the 'alphabits' row for the image data fed through the pipe is wrong.
In the old world this happened to be the same, but the size of the alphabytes in the frame is not the same as the format of the bits sent through the pipe.
The format of the data through the pipe (from the OS specific decoders) is:
PRUint8 width;
PRUint8 height;
PRUint8 alphaBits; (1 or 8)
PRUint8 imageBytes; (width * height * 3) (each pixel is (PRUint8 R, PRUint8 G, PRUint8 B))
PRUint8 alphaBytes; (when alphaBits is 1: packed bits, otherwise 1 byte per pixel).
So the size of an alphaBytes row in this format is depending on alphaBits.
In the old gfx world, the mFrame would have the same format for alphaBits (set by the format), but in Cairo RGB_A1 and RGB_A8 are both mapped to ARGB (4 bytes) format.
So, actually the simple fix is to fix this alphaBytesRow calculation within nsIconDecoder (as it is only for this internal pipe format).
The better fix, if really everything will be Cairo, is to update this internal format to the Cairo format of passing PRUint32 per pixel (ARGB), so that there is no need for transcoding from the internal pipe format to the format of Cairo.
Assignee | ||
Comment 4•18 years ago
|
||
*** Bug 361568 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 6•18 years ago
|
||
Actually:
For Cairo, in nsIconDecoder we can directly read the data from the inputStream into the Image databuffer, as the os-dependent decoders (such as for gtk) all produce the imagedata already in Cairo format.
See attachment. This saves a buffer allocation, and image data copying, and also makes the code simpler.
Patch coming up
Status: NEW → ASSIGNED
Assignee | ||
Comment 7•18 years ago
|
||
Attachment #251570 -
Flags: review?(pavlov)
Assignee | ||
Comment 8•18 years ago
|
||
Note, it is not immediately obvious from the patch, but this patch removes any calls to GetAlphaBytesPerRow and its underlying GetAlphaLineStride which is plain wrong in Cairo. (actually thebes should define GetAlphaLineStride as not implemented/valid).
(In reply to comment #8)
> Note, it is not immediately obvious from the patch, but this patch removes any
> calls to GetAlphaBytesPerRow and its underlying GetAlphaLineStride which is
> plain wrong in Cairo. (actually thebes should define GetAlphaLineStride as not
> implemented/valid).
Is there a bug filed on doing that?
Comment 10•18 years ago
|
||
nsIImage and gfxIImageFrame are both on the to-kill list so their behavior shouldn't be too important here.
Updated•18 years ago
|
Attachment #251570 -
Flags: review?(pavlov) → review+
Assignee | ||
Updated•18 years ago
|
Attachment #251570 -
Flags: superreview?(tor)
Attachment #251570 -
Flags: superreview?(tor) → superreview+
Assignee | ||
Updated•18 years ago
|
Whiteboard: [checkin needed]
Reporter | ||
Comment 11•18 years ago
|
||
checked in
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Whiteboard: [checkin needed]
Reporter | ||
Comment 12•18 years ago
|
||
Problems with this patch that unfortunately nobody (including me) caught before checkin:
/Users/josh/src/mozilla/ff_cairo/mozilla/modules/libpr0n/decoders/icon/nsIconDecoder.cpp: In member function 'virtual nsresult nsIconDecoder::WriteFrom(nsIInputStream*, PRUint32, PRUint32*)':
/Users/josh/src/mozilla/ff_cairo/mozilla/modules/libpr0n/decoders/icon/nsIconDecoder.cpp:156: error: 'width' was not declared in this scope
/Users/josh/src/mozilla/ff_cairo/mozilla/modules/libpr0n/decoders/icon/nsIconDecoder.cpp:156: error: 'height' was not declared in this scope
/Users/josh/src/mozilla/ff_cairo/mozilla/modules/libpr0n/decoders/icon/nsIconDecoder.cpp:161: error: no matching function for call to 'nsDerivedSafe<gfxIImageFrame>::GetImageData(PRUint8**, PRUint8*)'
../../../../dist/include/gfx/gfxIImageFrame.h:124: note: candidates are: virtual nsresult gfxIImageFrame::GetImageData(PRUint8**, PRUint32*)
Whiteboard: [checkin needed]
Reporter | ||
Comment 13•18 years ago
|
||
bustage fixed (hopefully)
Updated•18 years ago
|
Whiteboard: [checkin needed]
Comment 14•18 years ago
|
||
Another fix was required to fix (hopefully :) sunbird linux/mac bustage due to all the #ifdefs.
Comment 15•18 years ago
|
||
For what it's worth, I tested that the Mac icon decoder did work under cairo when I tested and landed bug 333253, so I'm not sure why this was needed to get the icon decoder working unless something else broke since then. (And I'm pretty sure I was really using the code, since testing on Mac actually caught bugs in the initial revision of the patch.)
Could you please get bugs filed, and blocking1.9? for either fixing the broken APIs or removing them?
Comment 16•18 years ago
|
||
Oh, and the argo tinderbox on http://tinderbox.mozilla.org/Firefox/ is still orange following this checkin.
Comment 17•18 years ago
|
||
Backed out due to tinderbox orange.
Judging from the bustage fixes that had to land, this clearly wasn't even compiled, never mind tested.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 18•18 years ago
|
||
And, for confirmation, this was the cause of the orange.
Comment 19•18 years ago
|
||
Also, note that at the time the bug was filed, the icon decoder was broken in general under cairo -- that was fixed in bug 333253.
Assignee | ||
Comment 20•18 years ago
|
||
Also removed the non-cairo stuff, as it is no longer needed (and also removed from other image decoders), and to clear the confusion around the ifdef's.
Attachment #251570 -
Attachment is obsolete: true
Attachment #254150 -
Flags: review?(pavlov)
Comment 21•18 years ago
|
||
I just tried the latest nightly on 10.3.9 (06-Feb-2007 05:23). The patch that was checked in does not seem to fix bug 361568 (that was duped to this one).
Comment 22•18 years ago
|
||
(In reply to comment #17)
> Backed out due to tinderbox orange.
Oops...
Comment 23•18 years ago
|
||
OK, some new info:
I updated the relevant file (dbarons back-out), applied attachment #254150 [details] [diff] [review] and did a "make clean && make" in libpr0n. The patch doesn't seem to change the broken icons reported in bug 361568. Note: I'm building with the 3.0 sdk on 10.3.9.
Assignee | ||
Comment 24•18 years ago
|
||
Actually, this patch only fixes the nsIconDecoder.cpp part.
But the mac/nsIconChannel.cpp part also needs fixing, as it generates the icon data fed into nsIconDecoder.cpp in the old (gfx) format.
Fixing mac/nsIconChannel.cpp should not be to difficult.
For the record, the new format is:
PRUint8 width
PRUint8 height
PRUint32 pixels[width*height]
Whereby each pixel is a Cairo packed/premultiplied pixel (ARGB)(see Cairo specs).
Comment 25•18 years ago
|
||
mac/nsIconChannel.cpp shouldn't be used anymore for cairo builds. We use nsIconChannelCocoa.mm.
Comment 26•18 years ago
|
||
Also, bug 361568 doesn't have anything to do with the icon decoder. I reopened it and commented further there.
Comment 27•18 years ago
|
||
could someone add a screen grab or something to demonstrate what the issue is?
"The mac icon decoder is broken under cocoa-cairo. No icons draw (see unknown content dialog)."
what icons aren't being drawn?
Reporter | ||
Comment 28•18 years ago
|
||
As dbaron said in comment #15, the original issue for this bug has been fixed. Alfred's patch is followup to "read image directly from inputstream to image".
Assignee | ||
Comment 29•18 years ago
|
||
Attachment #254150 -
Attachment is obsolete: true
Attachment #256700 -
Flags: review?(pavlov)
Attachment #254150 -
Flags: review?(pavlov)
Updated•18 years ago
|
Attachment #256700 -
Flags: review?(pavlov) → review+
Assignee | ||
Updated•18 years ago
|
Attachment #256700 -
Flags: superreview?(cbiesinger)
Comment 30•18 years ago
|
||
Comment on attachment 256700 [details] [diff] [review]
Updated to the recent Cairo cleanup
+ if (mObserver)
+ mObserver->OnStartDecode(nsnull);
why the nullcheck?
urg, I see, the rest of this file nullchecks too. sigh.
Attachment #256700 -
Flags: superreview?(cbiesinger) → superreview+
Reporter | ||
Comment 32•18 years ago
|
||
I was going to check this in but it doesn't compile on Mac OS X trunk.
In file included from nsIconDecoder.cpp:50:
nsIImage.h:44:21: error: gfxRect.h: No such file or directory
nsIImage.h:204: error: expected ',' or '...' before '&' token
nsIImage.h:205: error: ISO C++ forbids declaration of 'gfxRect' with no type
Comment 33•18 years ago
|
||
Changing bug summary and dependencies to reflect what this bug has morphed into (despite my protests).
No longer blocks: 334729
Summary: [cocoa-cairo] mac icon decoder broken under cairo → read image directly from input stream in icon decoder
Assignee | ||
Comment 34•18 years ago
|
||
Note, do we still need to fix mac/nsIconChannel.cpp ?
If so, it needs a separate bug.
Attachment #256700 -
Attachment is obsolete: true
Updated•18 years ago
|
Assignee: joshmoz → alfredkayser
Status: REOPENED → NEW
Comment 35•18 years ago
|
||
Does this need a re-review? And the new patches should indeed probably have gone into a separate bug...
Assignee | ||
Comment 36•18 years ago
|
||
Comment on attachment 262994 [details] [diff] [review]
V6: Include 'thebes' in the Makefile for dependencies...
Can you check this out and in? Only the Makefile.in is changed since previous patch version
Attachment #262994 -
Flags: superreview?(cbiesinger)
Target Milestone: --- → mozilla1.9beta1
Comment 37•18 years ago
|
||
Since this waits for a review, getting it off the [checkin needed] radar.
Whiteboard: [checkin needed]
Assignee | ||
Comment 38•17 years ago
|
||
Comment on attachment 262994 [details] [diff] [review]
V6: Include 'thebes' in the Makefile for dependencies...
Tor, can you approve this one? cbiesinger did already do the SR, but the Makefile.in change was lost from the patch, so it failed to compile. This is corrected in the latest patch
Attachment #262994 -
Flags: superreview?(cbiesinger) → superreview?(tor)
Attachment #262994 -
Flags: superreview?(tor) → superreview+
Comment 40•17 years ago
|
||
Checking in modules/libpr0n/decoders/icon/Makefile.in;
/cvsroot/mozilla/modules/libpr0n/decoders/icon/Makefile.in,v <-- Makefile.in
new revision: 1.24; previous revision: 1.23
done
Checking in modules/libpr0n/decoders/icon/nsIconDecoder.cpp;
/cvsroot/mozilla/modules/libpr0n/decoders/icon/nsIconDecoder.cpp,v <-- nsIconDecoder.cpp
new revision: 1.28; previous revision: 1.27
done
Status: NEW → ASSIGNED
Whiteboard: [checkin needed]
Reporter | ||
Comment 41•17 years ago
|
||
"Note, do we still need to fix mac/nsIconChannel.cpp"
Please file another bug about investigating this. I don't want to forget to look. I don't know exactly what you mean by "fix" otherwise I'd file it myself.
Assignee | ||
Comment 42•17 years ago
|
||
If the non-Cocoa based Mac icon decoder is still needed, we need to fix the mac/nsIconChannel.cpp, as described in comment #24.
Marking this bug as fixed.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago → 17 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•17 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•