NPAPI:ContentsScaleFactor: Difference between revisions

Jump to navigation Jump to search
Line 22: Line 22:
We propose adding a new NPNV variable:
We propose adding a new NPNV variable:


  NPNVcontentsScaleFactor = 2005
  NPNVcontentsScaleFactor = 1001


The plug-in can retrieve the current contents scale factor by calling NPN_GetValue, passing the NPNVcontentsScaleFactor variable and a pointer to a double. The double holds the contents scale factor. The contents scale factor will currently be 2.0 for plug-ins in windows with high resolution scaled display modes, and 1.0 for all other cases. When a plug-in's contents scale factor changes, the browser will call NPP_SetValue passing the NPNVcontentsScaleFactor and a pointer to a double. The double holds the new contents scale factor.
The plug-in can retrieve the current contents scale factor by calling NPN_GetValue, passing the NPNVcontentsScaleFactor variable and a pointer to a double. The double holds the contents scale factor. The contents scale factor will currently be 2.0 for plug-ins in windows with high resolution scaled display modes, and 1.0 for all other cases. When a plug-in's contents scale factor changes, the browser will call NPP_SetValue passing the NPNVcontentsScaleFactor and a pointer to a double. The double holds the new contents scale factor.


Core Animation plug-ins would typically set the 'contentsScale' CALayer property on relevant layers; this will set the layer's backing store scale. (See [http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html%23//apple_ref/occ/instp/CALayer/contentsScale -[CALayer contentsScale]] for more information).
Core Animation plug-ins would typically set the 'contentsScale' CALayer property on relevant layers; this will set the layer's backing store scale. (See the -[CALayer contentsScale] documentation on [http://developer.apple.com http://developer.apple.com] for more information).


For Core Graphics plug-ins, the CGContext sent along with the NPCocoaEventDrawRect will already be scaled, so plug-ins using simple drawing will work without modifications. If a plug-in draws images or uses a backing buffer, the buffer size in pixels should be scaled appropriately using the contents scale factor.
For Core Graphics plug-ins, the CGContext sent along with the NPCocoaEventDrawRect will already be scaled, so plug-ins using simple drawing will work without modifications. If a plug-in draws images or uses a backing buffer, the buffer size in pixels should be scaled appropriately using the contents scale factor.
24

edits

Navigation menu