Closed Bug 393336 Opened 18 years ago Closed 18 years ago

Don't do ARGB->RGBA translation in nsClipboard.mm

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: cbarrett, Assigned: bugzilla)

Details

Attachments

(1 file, 3 obsolete files)

Now that we don't support 10.3, we should get rid of the ARGB->RGBA code in nsClipboard.mm. Instead we should pass bitmapFormat:NSAlphaFirstBitmapFormat as one of the arguments to initWithBitmapDataPlanes... http://mxr.mozilla.org/seamonkey/source/widget/src/cocoa/nsClipboard.mm#351
Attached patch fix (obsolete) — Splinter Review
Proposed fix. Gets rid of all the reorderedData code and just calls initWithBitmapDataPlanes with the bitmapFormat argument.
Attachment #278033 - Flags: review?(cbarrett)
Comment on attachment 278033 [details] [diff] [review] fix >- planes[0] = (PRUint8*)reorderedData; >+ planes[0] = image->GetBits(); > planes[1] = nsnull; > isPlanar:NO Since the data isn't planar, we don't need a null terminating plane either. Other than that looks fine.
Attachment #278033 - Flags: review?(cbarrett) → review-
Flags: blocking1.9+
Attached patch fix v2 (obsolete) — Splinter Review
New fix incorporating the change in the above comment as well.
Attachment #278033 - Attachment is obsolete: true
Attachment #278110 - Flags: review?(cbarrett)
Attachment #278110 - Flags: superreview?(roc)
Attachment #278110 - Flags: review?(cbarrett)
Attachment #278110 - Flags: review+
Assignee: cbarrett → bugzilla
Attachment #278110 - Flags: superreview?(roc) → superreview+
Ergh, when doing pre-checkin sanity tests, I noticed that on my little endian machine, this doesn't work right. Seems NSBitmapImageFormat doesn't respect the native architecture and forces big-endian? Ugh.
Comment on attachment 278110 [details] [diff] [review] fix v2 marking the patch r- so nobody drive-by checkins it.
Attachment #278110 - Flags: review+ → review-
Attached patch fix v3 (obsolete) — Splinter Review
New fix that copies the image data directly into the bitmapData of the NSBitmapImageRep. Works on my PPC, and hopefully it'll work on a little-endian Intel machine too.
Attachment #278110 - Attachment is obsolete: true
Attachment #278160 - Flags: review?(cbarrett)
Attached patch fix v4Splinter Review
This one actually works on one PPC machine and one Intel machine. I chucked NSBitmapRep entirely and instead use Quartz functions to convert the image to TIFF for the pasteboard. CGImageCreate takes endianness into account, solving the architecture problem.
Attachment #278160 - Attachment is obsolete: true
Attachment #278191 - Flags: review?(cbarrett)
Attachment #278160 - Flags: review?(cbarrett)
Comment on attachment 278191 [details] [diff] [review] fix v4 looks good, tested it here, seems to work fine. Tried loading large images from NASA (5MB or so), no noticeable beachballing.
Attachment #278191 - Flags: superreview?(roc)
Attachment #278191 - Flags: review?(cbarrett)
Attachment #278191 - Flags: review+
Comment on attachment 278191 [details] [diff] [review] fix v4 I want to look too before this lands, but go ahead with sr.
Attachment #278191 - Flags: review?(joshmoz)
ah sure, that's fine. Probably should have requested r from you anyway, given that I'm not an actual peer.
Comment on attachment 278191 [details] [diff] [review] fix v4 + [pasteboardOutputDict setObject:(NSMutableData *)tiffData forKey:NSTIFFPboardType]; No space between "NSMutableData" and the "*". Just fix that on checkin.
Attachment #278191 - Flags: review?(joshmoz) → review+
Attachment #278191 - Flags: superreview?(roc) → superreview?(pavlov)
Flags: blocking1.9+ → blocking1.9-
Attachment #278191 - Flags: superreview?(pavlov) → superreview?(mikepinkerton)
Comment on attachment 278191 [details] [diff] [review] fix v4 sr=pink
Attachment #278191 - Flags: superreview?(mikepinkerton) → superreview+
Attachment #278191 - Flags: approval1.9?
Attachment #278191 - Flags: approval1.9? → approval1.9+
landed on trunk, thanks 'Ili!
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: