سؤال

I'm writing a Safari NPAPI plugin using CoreAnimationDrawingModel. This lets me create high performance CAOpenGLLayer and return it to the browser (I'm using this: https://wiki.mozilla.org/NPAPI:CoreAnimationDrawingModel).

Unfortunately, I'm having trouble supporting Retina displays in this setup because I cannot find a way of working out whether or not the plugin is hosted on a Retina display. Without this information I cannot set the CALayer's contentScale property properly.

In native applications I'd host the CALayer in an NSView and watch viewDidChangeBackingProperties to obtain the required resolution information. I'm not sure whether there is a way of obtaining the layer host in the NPAPI world? Even if that was possible, I'd be annoying to have to poll it for the resolution, ideally I'd want to register some kind of a notification listener.

I'm writing my plugin using FireBreath (http://www.firebreath.org/) and talked with the devs there (Richard Bateman) on IRC, but they suggested asking here (Stuart Morgan was mentioned as a good person to ask).

هل كانت مفيدة؟

المحلول

There's a spec for passing this information to NPAPI plugins. I'm not completely sure of the implementation status; Chrome doesn't implement it, casual inspection of Firefox source suggests it does, and since it was authored by an Apple engineer it's likely that Safari does.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top