Re: Converting a webkit plugin to NPAPI?

snappa <[email protected]>
Newsgroups gmane.comp.mozilla.devel.plugins
Organization http://groups.google.com
Message-ID <8e8c349c-c33f-4af4-ad99-9dd4e0301005@o11g2000yql.googlegroups.com>
On Aug 18, 7:20 am, Stuart Morgan <[email protected]> wrote:
> You have two options, each of which is pretty easy if that's actually
> the only thing you are doing:
> - Use the CoreGraphics drawing model: call NPN_InvalidateRect each
> time you have a new frame, then in the paint callback draw your
> NSImage to the CGContextRef you are given as an argument.
> - Use the Core Animation drawing model: Convert your bitmap to a
> CGImageRef instead of an NSImage, and set it as the content property
> of the CALayer you vend.
>
> If you handle events, have other controls in your view, etc. then
> you'll have more work to do.
>
> -Stuart

Thank you.  I made some progress going down the CoreGraphics path.
When I
try to add a second instance on the same page things seem to fall
apart.  The
NPAPI documentation as I read it states that the "window" attribute of
the NPWindow
structure will point to an NP_Port structure for OS X.  I am seeing
the window attribute
as NULL.

I'm trying to understand where the correct x/y attributes are found
for passing into an
NSRect create method.  The documents are slightly confusing here.

If I use the X/Y coordinates that are in the NPWindow structure this
works fine for the
div at 0,0 but a div that would be placed directly below the top most
div doesn't draw
where I expect it to.  The coordinates given to me are, for example,
0, 400.  Now this
to me implies that drawing is relative to the entire page and not a
400x400 div area.
Creating a NSRect with a Y of 400 causes the image to be drawn
offscreen.  If I
change the value to always be 0 based then the image is drawn in the
correct location
within the div (rectangle).  The same goes for the X coordinates if I
place a div
adjacent using a "display: inline-block" attribute on the div.

Am I supposed to be able to get / use the NP_Port structure for laying
things out on
OS X?  I need to be able to have this plugin draw videos into a grid
of rectangles.

Can someone shed some light on this?  Also, the NP_Port structure is
"ifdef'd" out
by default. I have to build my plug-in as 32 bit due to restrictions
imposed on me
by the vendor supplying the NVR library. I noticed that XP_MACOSX
needs to
be defined in order for the NP_Port structure to be visible.  This did
nothing for
me other than to get rid of compile errors.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.