Plugins:NokiaMaemoImageSurface

From MozillaWiki
Jump to: navigation, search

Status

Accepted, ready for implementation. No NPAPI version number.

Problem Summary

We are proposing a NPAPI extension which would allow a plugin to render directly into 32-bit buffer in shared memory for performance reasons.

Specification

This extension is for the maemo platform only.

The plugin explicitly makes requests of the user agent whether the extension is supported (with NPN_GetValue and NPNVSupportsWindowlessLocal) and then enables the new rendering mode at runtime (with NPN_SetValue and NPPVpluginWindowlessLocalBool). In this way other plugins unaware of new extension will not be disrupted.

When new rendering mode is enabled the Xdrawable field of a standard XGraphicsExpose event holds a pointer to the new NPImageExpose structure which among other things contains pointer to the shared memory buffer, its dimensions, translation and scale factors.


typedef struct _NPImageExpose
{
  char*    data;     /* image pointer */
  int32    stride;   /* Stride of data image buffer */
  int32    depth;    /* Depth of image pointer */
  int32    x;        /* Expose x */
  int32    y;        /* Expose y */
  uint32   width;    /* Expose width */
  uint32   height;   /* Expose height */
  NPSize   dataSize; /* Data buffer size */
  float    translateX; /* translate X matrix value */
  float    translateY; /* translate Y matrix value */
  float    scaleX;     /* scale X matrix value */
  float    scaleY;     /* scale Y matrix value */

} NPImageExpose; 

The value of NPPVpluginWindowlessLocalBool is 2002, the value of NPNVSupportsWindowlessLocal is 2002. There is no NPAPI version assigned to this feature since it is queried for by variable and does not involve additional functions.

Also see discussion:

http://groups.google.com/group/mozilla.dev.tech.plugins/browse_thread/thread/14a7aa48294faa68/fccbdd2fa6377b98#fccbdd2fa6377b98