NPAPI:AsyncDrawing: Difference between revisions

Jump to navigation Jump to search
Line 51: Line 51:
     NPSize size;
     NPSize size;
     NPImageFormat format;
     NPImageFormat format;
     uint32_t     stride;
     union {
     void *data;
      struct { unsigned char *data; uint32_t stride; };
      #ifdef XP_WIN
      HANDLE sharedHandle
      #endif
     };
   } NPAsyncSurface;
   } NPAsyncSurface;
</pre>
</pre>
Line 59: Line 63:


<pre>
<pre>
   NPError NPN_InitAsyncSurface(NPP instance, NPAsyncSurface* surface);
   NPError NPN_InitAsyncSurface(NPP instance, NPSize* size,
                              int32_t format, void* initData,
                              NPSurface* surface);
</pre>
</pre>
Plugins are always responsible for initializing the <code>version</code>, <code>size</code>, and <code>format</code> members in an <code>NPAsyncSurface</code> before calling <code>NPN_InitAsyncSurface</code> with it. If there is only one version of the surface then plugins should set the <code>version</code> member to <code>0</code>. The <code>stride</code> member may be initialized by the plugin or the browser depending on the selected drawing model. Whether or not <code>data</code> is initialized by the plugin or the browser depends on the selected drawing model but upon return from <code>NPN_InitAsyncSurface</code> the <code>data</code> pointer should point to valid surface data. The value of <code>data</code> will be <code>NULL</code> if an error occurred.


When a plugin is done with a surface the surface should be finalized with <code>NPN_FinalizeAsyncSurface</code>:
When a plugin is done with a surface the surface should be finalized with <code>NPN_FinalizeAsyncSurface</code>:
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits

Navigation menu