Closed Bug 148551 Opened 22 years ago Closed 22 years ago

SetImageData/SetAlphaData incorrectly converting offset on XP_PC

Categories

(Core Graveyard :: Image: Painting, defect)

x86
All
defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.1beta

People

(Reporter: paper, Assigned: paper)

References

Details

Attachments

(1 file)

SetImageData & SetAlphaData (mozilla/gfx2/src/) assume aOffset is referencing
data in a top-down manner.  PCs (XP_PC) use a bottom-up storage, so these
functions adjust the passed in offset to the proper top-down position. The
current code does not take into account an offset within the middle of a row.

Simple Example to help clarify:
We want to set (1,0) to (7,0) on a 8x11 image.
Let's assume 1 byte == 1 pixel for simplification of calculations.  This will
result in a 88 byte image (positions 0 to 87).
We call SetImageData(data, 7, 1) (data, numBytes, top-down offset)

For XP_PC, top-down needs to be converted to bottom-up..

Expected Result: position 81 to 87 of imgData should be set to the new data
Expected newOffset: 81

Currently SetImageData calculates
newOffset = ((mSize.height - 1) * row_stride) - aOffset;
newOffset = (10 * 8) - 1
newOffset = 79
Actual Result: position 79 to 85 (inclusive) of imgData will be set to new data


Upcoming patch will fix this problem
Correction to line 3 of Description:

these functions adjust the passed-in offset to the proper _bottom-up_ PC storage
position.
ccing pav & tor

pav, tor, I'll need this r='d, sr='d, and checked-in before Bug 85595
Blocks: 85595
No longer blocks: 85595
Blocks: 85595
Severity: normal → major
Keywords: patch, review
Target Milestone: --- → mozilla1.1alpha
confirming to get this on radar
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment on attachment 85964 [details] [diff] [review]
Correctly set newOffset

sr=tor
Attachment #85964 - Flags: superreview+
pav, can you r=?
Target Milestone: mozilla1.1alpha → mozilla1.1beta
Comment on attachment 85964 [details] [diff] [review]
Correctly set newOffset

r=pavlov
Attachment #85964 - Flags: review+
checked in on the trunk.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Fixed on branch, because adt+ bug 85595 depended on this.
Keywords: fixed1.0.1
Verified patch checked into lxr.mozilla.org(trunk) and bonsai.mozilla.org(branch)
Status: RESOLVED → VERIFIED
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: