Changeset 65612 in webkit
- Timestamp:
- Aug 18, 2010 9:52:32 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65611 r65612 1 2010-08-18 Girish Ramakrishnan <girish@forwardbias.in> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Implement Maemo5 local rendering NPAPI extension. See 6 https://wiki.mozilla.org/Plugins:NokiaMaemoImageSurface for details. 7 8 With the local rendering extension, Flash will paint into a 16-bit surface. 9 For wmode=transparent, Flash expects the surface to contain the contents 10 beneath it. As it is tricky to implement the content propagation across all 11 graphics systems, transparent Flash is not supported. We just fill the surface 12 with white and wmode=transparent behaves the same as wmode=opaque with a white 13 background. 14 15 https://bugs.webkit.org/show_bug.cgi?id=44043 16 17 * WebCore.pro: 18 * plugins/PluginView.cpp: 19 (WebCore::PluginView::setValue): 20 (WebCore::PluginView::PluginView): 21 * plugins/PluginView.h: 22 * plugins/qt/PluginViewQt.cpp: 23 (WebCore::PluginView::updatePluginWidget): 24 (WebCore::PluginView::paintUsingImageSurfaceExtension): 25 (WebCore::PluginView::paint): 26 (WebCore::PluginView::platformGetValueStatic): 27 1 28 2010-08-18 Sheriff Bot <webkit.review.bot@gmail.com> 2 29 -
trunk/WebCore/WebCore.pro
r65611 r65612 2363 2363 LIBS += -lXrender 2364 2364 } 2365 maemo5 { 2366 DEFINES += MOZ_PLATFORM_MAEMO=5 2367 } 2365 2368 SOURCES += \ 2366 2369 plugins/qt/PluginContainerQt.cpp \ -
trunk/WebCore/plugins/PluginView.cpp
r62846 r65612 2 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Collabora Ltd. All rights reserved. 4 * Copyright (C) 2010 Girish Ramakrishnan <girish@forwardbias.in> 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 674 675 #endif // defined(XP_MACOSX) 675 676 677 #if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 678 case NPPVpluginWindowlessLocalBool: 679 m_renderToImage = true; 680 return NPERR_NO_ERROR; 681 #endif 682 676 683 default: 677 684 notImplemented(); … … 850 857 , m_pluginDisplay(0) 851 858 #endif 859 #if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 860 , m_renderToImage(false) 861 #endif 852 862 , m_loadManually(loadManually) 853 863 , m_manualStream(0) -
trunk/WebCore/plugins/PluginView.h
r59904 r65612 55 55 #endif 56 56 #endif 57 #if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 58 #include <QImage> 59 class QPainter; 60 #endif 57 61 58 62 #if USE(JSC) … … 375 379 #endif 376 380 381 #if PLATFORM(QT) && defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 382 QImage m_image; 383 bool m_renderToImage; 384 void paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect); 385 #endif 386 377 387 IntRect m_clipRect; // The clip rect to apply to a windowed plug-in 378 388 IntRect m_windowRect; // Our window rect. -
trunk/WebCore/plugins/qt/PluginViewQt.cpp
r65586 r65612 112 112 113 113 if (!m_isWindowed && m_windowRect.size() != oldWindowRect.size()) { 114 if (m_drawable) 115 XFreePixmap(QX11Info::display(), m_drawable); 116 117 m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), 118 ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); 119 QApplication::syncX(); // make sure that the server knows about the Drawable 114 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 115 // On Maemo5, Flash always renders to 16-bit buffer 116 if (m_renderToImage) 117 m_image = QImage(m_windowRect.width(), m_windowRect.height(), QImage::Format_RGB16); 118 else 119 #endif 120 { 121 if (m_drawable) 122 XFreePixmap(QX11Info::display(), m_drawable); 123 124 m_drawable = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), m_windowRect.width(), m_windowRect.height(), 125 ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth); 126 QApplication::syncX(); // make sure that the server knows about the Drawable 127 } 120 128 } 121 129 … … 161 169 } 162 170 171 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 172 void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect) 173 { 174 if (m_isTransparent) { 175 // On Maemo5, Flash expects the buffer to contain the contents that are below it. 176 // We don't support transparency, so clean the image before giving to Flash. 177 QPainter imagePainter(&m_image); 178 imagePainter.fillRect(exposedRect, Qt::white); 179 } 180 181 NPImageExpose imageExpose; 182 imageExpose.data = reinterpret_cast<char*>(m_image.bits()); 183 imageExpose.stride = m_image.bytesPerLine(); 184 imageExpose.depth = m_image.depth(); 185 imageExpose.x = exposedRect.x(); 186 imageExpose.y = exposedRect.y(); 187 imageExpose.width = exposedRect.width(); 188 imageExpose.height = exposedRect.height(); 189 imageExpose.dataSize.width = m_image.width(); 190 imageExpose.dataSize.height = m_image.height(); 191 imageExpose.translateX = 0; 192 imageExpose.translateY = 0; 193 imageExpose.scaleX = 1; 194 imageExpose.scaleY = 1; 195 196 XEvent xevent; 197 memset(&xevent, 0, sizeof(XEvent)); 198 XGraphicsExposeEvent& exposeEvent = xevent.xgraphicsexpose; 199 exposeEvent.type = GraphicsExpose; 200 exposeEvent.display = 0; 201 exposeEvent.drawable = reinterpret_cast<XID>(&imageExpose); 202 exposeEvent.x = exposedRect.x(); 203 exposeEvent.y = exposedRect.y(); 204 exposeEvent.width = exposedRect.width(); 205 exposeEvent.height = exposedRect.height(); 206 207 dispatchNPEvent(xevent); 208 209 painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect); 210 } 211 #endif 212 163 213 void PluginView::paint(GraphicsContext* context, const IntRect& rect) 164 214 { … … 173 223 setNPWindowIfNeeded(); 174 224 175 if (m_isWindowed || !m_drawable) 176 return; 177 178 const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); 225 if (m_isWindowed) 226 return; 227 228 if (!m_drawable 229 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 230 && m_image.isNull() 231 #endif 232 ) 233 return; 179 234 180 235 QPainter* painter = context->platformContext(); … … 183 238 exposedRect.move(-frameRect().x(), -frameRect().y()); 184 239 240 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 241 if (!m_image.isNull()) { 242 paintUsingImageSurfaceExtension(painter, exposedRect); 243 return; 244 } 245 #endif 246 185 247 QPixmap qtDrawable = QPixmap::fromX11Pixmap(m_drawable, QPixmap::ExplicitlyShared); 186 248 const int drawableDepth = ((NPSetWindowCallbackStruct*)m_npWindow.ws_info)->depth; 187 249 ASSERT(drawableDepth == qtDrawable.depth()); 250 const bool syncX = m_pluginDisplay && m_pluginDisplay != QX11Info::display(); 188 251 189 252 // When printing, Qt uses a QPicture to capture the output in preview mode. The … … 588 651 return true; 589 652 653 #if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO == 5) 654 case NPNVSupportsWindowlessLocal: 655 *static_cast<NPBool*>(value) = true; 656 *result = NPERR_NO_ERROR; 657 return true; 658 #endif 659 590 660 default: 591 661 return false;
Note: See TracChangeset
for help on using the changeset viewer.