extern void ANPSurfaceInterfaceV0_Init(ANPInterface* value);
extern void ANPTypefaceInterfaceV0_Init(ANPInterface* value);
extern void ANPWindowInterfaceV0_Init(ANPInterface* value);
+extern void ANPWindowInterfaceV1_Init(ANPInterface* value);
extern void ANPSystemInterfaceV0_Init(ANPInterface* value);
extern void ANPOpenGLInterfaceV0_Init(ANPInterface* value);
{ VARPROCLINE(SurfaceInterfaceV0) },
{ VARPROCLINE(TypefaceInterfaceV0) },
{ VARPROCLINE(WindowInterfaceV0) },
+ { VARPROCLINE(WindowInterfaceV1) },
{ VARPROCLINE(SystemInterfaceV0) },
{ VARPROCLINE(OpenGLInterfaceV0) },
};
pluginWidget->requestCenterFitZoom();
}
+static ANPRectI anp_visibleRect(NPP instance) {
+ PluginView* pluginView = pluginViewForInstance(instance);
+ PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
+ return pluginWidget->visibleRect();
+}
+
///////////////////////////////////////////////////////////////////////////////
#define ASSIGN(obj, name) (obj)->name = anp_##name
ASSIGN(i, exitFullScreen);
ASSIGN(i, requestCenterFitZoom);
}
+
+void ANPWindowInterfaceV1_Init(ANPInterface* value) {
+ // initialize the functions from the previous interface
+ ANPWindowInterfaceV0_Init(value);
+ // add any new functions or override existing functions
+ ANPWindowInterfaceV1* i = reinterpret_cast<ANPWindowInterfaceV1*>(value);
+ ASSIGN(i, visibleRect);
+}
}
}
+ANPRectI PluginWidgetAndroid::visibleRect() {
+
+ SkIRect visibleRect;
+ visibleRect.setEmpty();
+
+ // compute the interesection of the visible screen and the plugin
+ bool visible = visibleRect.intersect(m_visibleDocRect, m_pluginBounds);
+ if (visible) {
+ // convert from absolute coordinates to the plugin's relative coordinates
+ visibleRect.offset(-m_pluginBounds.fLeft, -m_pluginBounds.fTop);
+ }
+
+ // convert from SkRect to ANPRect
+ ANPRectI result;
+ memcpy(&result, &visibleRect, sizeof(ANPRectI));
+ return result;
+}
+
void PluginWidgetAndroid::setVisibleRects(const ANPRectI rects[], int32_t count) {
#if DEBUG_VISIBLE_RECTS
PLUGIN_LOG("%s count=%d", __FUNCTION__, count);
*/
void setVisibleScreen(const ANPRectI& visibleScreenRect, float zoom);
+ /** Returns a rectangle representing the visible area of the plugin on
+ screen. The coordinates are relative to the size of the plugin in the
+ document and will not be negative or exceed the plugin's size.
+ */
+ ANPRectI visibleRect();
+
/** Registers a set of rectangles that the plugin would like to keep on
screen. The rectangles are listed in order of priority with the highest
priority rectangle in location rects[0]. The browser will attempt to keep
#define kAudioTrackInterfaceV1_ANPGetValue ((NPNVariable)1012)
#define kOpenGLInterfaceV0_ANPGetValue ((NPNVariable)1013)
+#define kWindowInterfaceV1_ANPGetValue ((NPNVariable)1014)
/** queries for the drawing models supported on this device.
void (*requestCenterFitZoom)(NPP instance);
};
+struct ANPWindowInterfaceV1 : ANPWindowInterfaceV0 {
+ /** Returns a rectangle representing the visible area of the plugin on
+ screen. The coordinates are relative to the size of the plugin in the
+ document and therefore will never be negative or exceed the plugin's size.
+ */
+ ANPRectI (*visibleRect)(NPP instance);
+};
+
///////////////////////////////////////////////////////////////////////////////
enum ANPSampleFormats {