Closed Bug 250531 Opened 20 years ago Closed 20 years ago

nsImageGTK::LockImagePixels(PR_TRUE) does not retrieve mAlphaBits

Categories

(Core Graveyard :: GFX: Gtk, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

Details

(Keywords: fixed-aviary1.0)

Attachments

(1 file, 2 obsolete files)

Calling LockImagePixels(PR_TRUE) should allow the alpha mask to be accessed via
GetAlphaBits().  However, if the alpha mask has been stored onto a server-side
pixmap (mAlphaPixmap), LockImagePixels does not fetch the image data into
mAlphaBits.
Attached patch patch (obsolete) — Splinter Review
Attached patch diff -w of the above (obsolete) — Splinter Review
Attachment #152670 - Flags: superreview?(tor)
Attachment #152670 - Flags: review?(tor)
What do you need this for?  As far as I know the only user of GetAlphaBits,
directly or indirectly, is imglib2 when decoding.
I'm going to use it in bug 242254.
Comment on attachment 152670 [details] [diff] [review]
diff -w of the above

> NS_IMETHODIMP
> nsImageGTK::LockImagePixels(PRBool aMaskPixels)
> {
>-  if (mOptimized && mImagePixmap) {
>+  if (!mOptimized)
>+    return NS_OK;

The mImagePixmap test is still needed, as 8-bit alpha images get marked
as optimized, yet don't have a backing pixmap.
Attachment #152670 - Flags: superreview?(tor)
Attachment #152670 - Flags: review?(tor)
Attached patch new diff -wSplinter Review
add back mImagePixmap check when aMaskPixels is false.
Attachment #152669 - Attachment is obsolete: true
Attachment #152670 - Attachment is obsolete: true
Attachment #153335 - Flags: superreview?(tor)
Attachment #153335 - Flags: review?(tor)
Comment on attachment 153335 [details] [diff] [review]
new diff -w

>+    mAlphaRowBytes = (mWidth + 7) / 8;
>+    // 32-bit align each row
>+    mAlphaRowBytes = (mAlphaRowBytes + 3) & ~0x3;

You don't need to recompute mAlphaRowBytes.  Remove that and r+sr+tor
Attachment #153335 - Flags: superreview?(tor)
Attachment #153335 - Flags: superreview+
Attachment #153335 - Flags: review?(tor)
Attachment #153335 - Flags: review+
checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Keywords: fixed-aviary1.0
Resolution: --- → FIXED
hm... is this sufficient? As is, gfxIImageFrame::LockAlphaData will fail because
GetHasAlphaMask returns false; and thus, LockImagePixels(PR_TRUE) is never called.

(The code at
http://lxr.mozilla.org/seamonkey/source/browser/components/shell/src/nsGNOMEShellService.cpp#357
does not deal with that very well (i.e. it crashes, because alphaBytesPerRow
will be uninitialized, and thus probably be a large number, and thus *maskPixel
causes a SIGSEGV))
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: