NPAPI:AsyncDrawing: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 165: Line 165:


Plugins should finalize surfaces by calling <code>NPN_FinalizeAsyncSurface</code>.
Plugins should finalize surfaces by calling <code>NPN_FinalizeAsyncSurface</code>.


  IDirect3DDevice9Ex *pDevice9;
  IDirect3DDevice9Ex *pDevice9;
Line 178: Line 177:
  size.width = pluginwidth;
  size.width = pluginwidth;
  size.height = pluginheight;
  size.height = pluginheight;
 
  HANDLE frontBufferHandle = NULL;
  HANDLE frontBufferHandle = NULL;
  HANDLE backBufferHandle = NULL;
  HANDLE backBufferHandle = NULL;
 
  pDevice9->CreateTexture(pluginWidth, pluginHeight, 0,
  pDevice9->CreateTexture(pluginWidth, pluginHeight, 0,
                         D3DUSAGE_RENDERTARGET,
                         D3DUSAGE_RENDERTARGET,
Line 190: Line 189:
                         D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT,
                         D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT,
                         &backBuffer, &backBufferHandle);
                         &backBuffer, &backBufferHandle);
 
  NPN_InitAsyncSurface(instance, size, NPImageFormatBGRX32, frontBufferHandle, npFrontBuffer);
  NPN_InitAsyncSurface(instance, size, NPImageFormatBGRX32, frontBufferHandle, npFrontBuffer);
  NPN_InitAsyncSurface(instance, size, NPImageFormatBGRX32, backBufferHandle, npBackBuffer);
  NPN_InitAsyncSurface(instance, size, NPImageFormatBGRX32, backBufferHandle, npBackBuffer);
Line 196: Line 195:
  while (painting) {
  while (painting) {
   // Draw to backBuffer texture
   // Draw to backBuffer texture
 
   // Synchronize by one of the methods described above
   // Synchronize by one of the methods described above
   NPN_SetCurrentAsyncSurface(instance, npBackBuffer);
   NPN_SetCurrentAsyncSurface(instance, npBackBuffer);
Confirmed users
138

edits

Navigation menu