diff options
author | Morten Johan Sorvig <morten.sorvig@nokia.com> | 2010-03-30 23:41:23 +0200 |
---|---|---|
committer | Morten Johan Sorvig <morten.sorvig@nokia.com> | 2010-03-30 23:41:23 +0200 |
commit | 8994ca90100d3bbe4c118d0deb2f00542054ccc4 (patch) | |
tree | 7da522253b5189fbc448afc330e26e19e5e85ef1 | |
parent | 9b6d100f41bf71c3457afc93da06e17575e2d0e1 (diff) |
Update and flush the screen on NPP_SetWindow.
-rw-r--r-- | src/gui/painting/qgraphicssystem_pepper.cpp | 45 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_pepper.h | 5 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_pepper.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_pepper.h | 1 | ||||
-rw-r--r-- | src/gui/pepper/plugin_object.cc | 14 |
5 files changed, 39 insertions, 27 deletions
diff --git a/src/gui/painting/qgraphicssystem_pepper.cpp b/src/gui/painting/qgraphicssystem_pepper.cpp index 2d6b666ebc..9215614e2b 100644 --- a/src/gui/painting/qgraphicssystem_pepper.cpp +++ b/src/gui/painting/qgraphicssystem_pepper.cpp @@ -43,7 +43,6 @@ #include "qwindowsurface_pepper.h" #include <QtGui/private/qpixmap_raster_p.h> #include <peppermain.h> -#include <plugin_object.h> #include <stdio.h> @@ -55,25 +54,11 @@ QPepperGraphicsSystem::QPepperGraphicsSystem() { qDebug() << "QPepperGraphicsSystem::QPepperGraphicsSystem()"; mPrimaryScreen = new QPepperGraphicsSystemScreen(); - - - QSize screenSize(plugin_object->width_, plugin_object->height_); - qDebug() << "QPepperGraphicsSystem screen size" << screenSize; - - mPrimaryScreen->mGeometry = QRect(QPoint(0, 0), screenSize); - mPrimaryScreen->mPhysicalSize = screenSize / 3; - mPrimaryScreen->device = plugin_object->device2d_; - mPrimaryScreen->context = plugin_object->context; - mPrimaryScreen->npp = plugin_object->npp_; - + extern QPepperGraphicsSystemScreen *qt_pepper_screen; + qt_pepper_screen = mPrimaryScreen; mScreens.append(mPrimaryScreen); } -QPepperGraphicsSystemScreen::~QPepperGraphicsSystemScreen() -{ - -} - QPixmapData *QPepperGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); @@ -84,4 +69,30 @@ QWindowSurface *QPepperGraphicsSystem::createWindowSurface(QWidget *widget) cons return new QPepperWindowSurface(mPrimaryScreen, widget); } +QPepperGraphicsSystemScreen::QPepperGraphicsSystemScreen() + : mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) +{ + setupScreen(); +} + +void QPepperGraphicsSystemScreen::setupScreen() +{ + QSize screenSize(plugin_object->width_, plugin_object->height_); + // qDebug() << "QPepperGraphicsSystem screen size" << screenSize; + + mGeometry = QRect(QPoint(0, 0), screenSize); + mPhysicalSize = screenSize / 3; + device = plugin_object->device2d_; + npp = plugin_object->npp_; + + NPDeviceContext2DConfig config; + device->initializeContext(npp, &config, &context); + device->flushContext(npp, &context, NULL, NULL); // ### should sync here, like QPepperWindowSurface::flush +} + +QPepperGraphicsSystemScreen::~QPepperGraphicsSystemScreen() +{ + +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_pepper.h b/src/gui/painting/qgraphicssystem_pepper.h index bb1e7ad5f1..27fe84fed2 100644 --- a/src/gui/painting/qgraphicssystem_pepper.h +++ b/src/gui/painting/qgraphicssystem_pepper.h @@ -50,10 +50,11 @@ QT_BEGIN_NAMESPACE class QPepperGraphicsSystemScreen : public QGraphicsSystemScreen { public: - QPepperGraphicsSystemScreen() - : mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {} + QPepperGraphicsSystemScreen(); ~QPepperGraphicsSystemScreen(); + void setupScreen(); + QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } diff --git a/src/gui/painting/qwindowsurface_pepper.cpp b/src/gui/painting/qwindowsurface_pepper.cpp index 337d325125..acaf7aadb1 100644 --- a/src/gui/painting/qwindowsurface_pepper.cpp +++ b/src/gui/painting/qwindowsurface_pepper.cpp @@ -47,7 +47,6 @@ #include <nacl/npapi_extensions.h> - QT_BEGIN_NAMESPACE QPepperWindowSurface::QPepperWindowSurface diff --git a/src/gui/painting/qwindowsurface_pepper.h b/src/gui/painting/qwindowsurface_pepper.h index 1b4350f64d..0a287acc4a 100644 --- a/src/gui/painting/qwindowsurface_pepper.h +++ b/src/gui/painting/qwindowsurface_pepper.h @@ -44,6 +44,7 @@ #include <QtGui/private/qwindowsurface_p.h> #include <nacl/npapi_extensions.h> +#include <plugin_object.h> #include <QtCore/QWaitCondition> #include <QtCore/QMutex> diff --git a/src/gui/pepper/plugin_object.cc b/src/gui/pepper/plugin_object.cc index 1922368e3e..d0d002c966 100644 --- a/src/gui/pepper/plugin_object.cc +++ b/src/gui/pepper/plugin_object.cc @@ -39,6 +39,7 @@ #include "test_object.h" #include <qdebug.h> +#include <qgraphicssystem_pepper.h> NPNetscapeFuncs* browser; PluginObject *plugin_object = 0; @@ -263,25 +264,24 @@ void PluginObject::New(NPMIMEType pluginType, device2d_ = extensions->acquireDevice(npp_, NPPepper2DDevice); } +QPepperGraphicsSystemScreen *qt_pepper_screen = 0; // set as a result of calling qt_nacl_setup. + void PluginObject::SetWindow(const NPWindow& window) { qDebug() << "PluginObject::SetWindow" << window.x << window.y << window.width << window.height; width_ = window.width; height_ = window.height; - NPDeviceContext2DConfig config; - device2d_->initializeContext(npp_, &config, &context); - // Run the Qt setup now that we have window coordinates // and a device. This makes for the most straghtforward - // initialization of the graphics system, but we must add - // a guard since SetWindow can be called multiple times. + // initialization of the graphics system. On subsequent + // calls to SetWindow (re) setup the screen. static bool qtSetupDone = false; if (!qtSetupDone) { extern void qt_nacl_setup(); qt_nacl_setup(); qtSetupDone = true; + } else { + qt_pepper_screen->setupScreen(); } } - - |