summaryrefslogtreecommitdiffstats
path: root/WebKit/android/plugins/PluginWidgetAndroid.cpp
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2009-07-17 16:40:38 -0400
committerPatrick Scott <phanna@android.com>2009-07-20 11:01:37 -0400
commite661c6da169832b46b6db967a09adb4459db003a (patch)
treed0bc69d4e5c6379a665e22db2a71c7046c49e42e /WebKit/android/plugins/PluginWidgetAndroid.cpp
parent54c7b5fa917905784d2d3d5c1ca6a914a6e86334 (diff)
downloadexternal_webkit-e661c6da169832b46b6db967a09adb4459db003a.zip
external_webkit-e661c6da169832b46b6db967a09adb4459db003a.tar.gz
external_webkit-e661c6da169832b46b6db967a09adb4459db003a.tar.bz2
Add Plugin APIs for creating and manipulating a Surface.
SurfaceCallback: An interface used to receive the surface change events. The PluginSurface then sends those events to the actual plugin. PluginSurface: A wrapper around the native Surface object obtained from the Java SurfaceView. This object can lock and unlock the surface and takes care of creating, positioning and destroying the Java SurfaceView. Changed PluginWidgetAndroid to not use SkFlipPixelRef when the drawing model is Surface.
Diffstat (limited to 'WebKit/android/plugins/PluginWidgetAndroid.cpp')
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index 7566d63..bf9b1bf 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -29,6 +29,7 @@
#include "Element.h"
#include "Frame.h"
#include "PluginPackage.h"
+#include "PluginSurface.h"
#include "PluginView.h"
#include "PluginWidgetAndroid.h"
#include "SkANP.h"
@@ -65,9 +66,16 @@ void PluginWidgetAndroid::setWindow(int x, int y, int width, int height,
bool isTransparent) {
m_x = x;
m_y = y;
- m_flipPixelRef->safeUnref();
- m_flipPixelRef = new SkFlipPixelRef(computeConfig(isTransparent),
- width, height);
+
+ if (m_drawingModel == kSurface_ANPDrawingModel) {
+ if (m_surface) {
+ m_surface->attach(x, y, width, height);
+ }
+ } else {
+ m_flipPixelRef->safeUnref();
+ m_flipPixelRef = new SkFlipPixelRef(computeConfig(isTransparent),
+ width, height);
+ }
}
bool PluginWidgetAndroid::setDrawingModel(ANPDrawingModel model) {
@@ -98,7 +106,8 @@ bool PluginWidgetAndroid::isDirty(SkIRect* rect) const {
void PluginWidgetAndroid::inval(const WebCore::IntRect& rect,
bool signalRedraw) {
- // nothing to do if we haven't had setWindow() called yet
+ // nothing to do if we haven't had setWindow() called yet. m_flipPixelRef
+ // will also be null if this is a Surface model.
if (NULL == m_flipPixelRef) {
return;
}
@@ -182,3 +191,14 @@ void PluginWidgetAndroid::updateEventFlags(ANPEventFlags flags) {
bool PluginWidgetAndroid::isAcceptingEvent(ANPEventFlag flag) {
return m_eventFlags & flag;
}
+
+ANPSurface* PluginWidgetAndroid::createSurface(ANPSurfaceType ignored) {
+ if (m_drawingModel != kSurface_ANPDrawingModel) {
+ return NULL;
+ }
+ m_surface.set(new android::PluginSurface(this));
+ ANPSurface* surface = new ANPSurface;
+ surface->data = m_surface.get();
+ surface->type = ignored;
+ return surface;
+}