Closed Bug 379640 Opened 17 years ago Closed 17 years ago

[10.3] render to given CGContextRef in nsITheme DrawButton

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: jaas, Assigned: jaas)

Details

We can't use the following call because it is 10.4+:

[NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]

Because of that we are always rendering to the current context and not the given context. We need to fix that without breaking 10.3.
It seems we're unable to use NSImage, then. Asking a number of people, they've said that there's no "quick" way.

Assuming we want to keep our NSImage drawing code, we should:
-Do all our drawing with NSImage
-Convert from the image's NSBitmapImageRep to a CGImage
-Draw that into the CGContext.

I'm not sure if there's an easy way to blit one context to another (I didn't find one) but if there is, we could |lockFocus| on the NSView and then do [[NSGraphicsContext getGraphicsContext] graphicsPort] to get a CGContext out of it.
That is more or less the plan I had in mind.
Flags: blocking1.9+
Assignee: joshmoz → cbarrett
Target Milestone: --- → mozilla1.9alpha5
Adding 10.3 to the summary since this is really only a problem on 10.3. It works fine on 10.4 but we had to comment out the code because 10.3 can't handle it.
Summary: render to given CGContextRef in nsITheme DrawButton → [10.3] render to given CGContextRef in nsITheme DrawButton
Target Milestone: mozilla1.9alpha5 → mozilla1.9alpha6
Since we don't support 10.3 on the trunk any more and using a 10.4 SDK config fixes this, this is no longer a blocker. It will be fixed when we check in new configure files for tinderboxes.
Flags: blocking1.9+ → blocking1.9-
Target Milestone: mozilla1.9alpha6 → Future
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee: cbarrett → joshmoz
Status: REOPENED → NEW
Status: NEW → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.