Plugins:CoreAnimationDrawingModelR2: Difference between revisions

(Created page with '= Status = Under consideration == Background == Currently, the only way for a plug-in on Mac to use OpenGL is to attach an AGL surface manually. This has a number of drawback…')
 
Line 71: Line 71:
The browser is not responsible for releasing retained CALayer objects it receives via the "NPPVpluginCoreAnimationLayer" variable. The browser may additionally retain layers (perhaps by attaching them to views). A plugin may release the layer for an instance during or after the instance's NPP_Destroy call.
The browser is not responsible for releasing retained CALayer objects it receives via the "NPPVpluginCoreAnimationLayer" variable. The browser may additionally retain layers (perhaps by attaching them to views). A plugin may release the layer for an instance during or after the instance's NPP_Destroy call.


== Redraw ==
== Redrawing ==


The plug-in is responsible for ensuring that nextFrameTime is correctly implemented. The browser may query nextFrameTime. This should indicate when the plug-in needs to be redrawn. If the plug-in returns 'inf' no further redraw will happen.  
Plugin-ins can schedule repaints via their CALayer's nextFrameTime or they may paint at any time using [[https://developer-stage.mozilla.org/en/NPN_InvalidateRect NPN_InvalidateRect]].


The plug-in can then call [[https://developer-stage.mozilla.org/en/NPN_InvalidateRect NPN_InvalidateRect]] to redraw. After NPN_InvalidateRect, the browser may resume querying nextFrameTime for the next redraw time.
All plugin-ins should implement nextFrameTime for their CALayer. Plug-ins that never want to schedule drawing via nextFrameTime can return 'inf'.
 
Browsers should re-check nextFrameTime any time a paint happens, whether it was scheduled via nextFrameTime or forced via NPN_InvalidateRect. This allows plugins to change their next frame time and to re-start scheduled painting after returning 'inf' from nextFrameTime.
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits