Changeset 57747 in webkit
- Timestamp:
- Apr 16, 2010, 2:39:36 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r57745 r57747 1 2010-04-16 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] WebGL is not visible when QGLWidget viewport is used 6 https://bugs.webkit.org/show_bug.cgi?id=37070 7 8 Added HostWindow parameter to the constructor of GraphicsContext3D. 9 Shared OpenGL context is initialized with parent QGLWidget. 10 11 * html/canvas/WebGLRenderingContext.cpp: 12 (WebCore::WebGLRenderingContext::create): 13 * platform/graphics/GraphicsContext3D.h: 14 * platform/graphics/mac/GraphicsContext3DMac.cpp: 15 (WebCore::GraphicsContext3D::create): 16 (WebCore::GraphicsContext3D::GraphicsContext3D): 17 * platform/graphics/qt/GraphicsContext3DQt.cpp: 18 (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): 19 (WebCore::GraphicsContext3DInternal::~GraphicsContext3DInternal): 20 (WebCore::GraphicsContext3DInternal::getOwnerGLWidget): 21 (WebCore::GraphicsContext3D::create): 22 (WebCore::GraphicsContext3D::GraphicsContext3D): 23 1 24 2010-04-16 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> 2 25 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r57709 r57747 31 31 32 32 #include "CanvasPixelArray.h" 33 #include "FrameView.h" 33 34 #include "HTMLCanvasElement.h" 34 35 #include "HTMLImageElement.h" … … 74 75 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) 75 76 { 76 OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs->attributes())); 77 HostWindow* hostWindow = canvas->document()->view()->root()->hostWindow(); 78 OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs->attributes(), hostWindow)); 79 77 80 if (!context) 78 81 return 0; -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r57574 r57747 74 74 class Image; 75 75 class ImageData; 76 class HostWindow; 76 77 77 78 struct ActiveInfo { … … 411 412 }; 412 413 413 static PassOwnPtr<GraphicsContext3D> create(Attributes attrs );414 static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow); 414 415 virtual ~GraphicsContext3D(); 415 416 … … 686 687 687 688 private: 688 GraphicsContext3D(Attributes attrs );689 GraphicsContext3D(Attributes attrs, HostWindow* hostWindow); 689 690 690 691 // Helpers for texture uploading. -
trunk/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
r57694 r57747 76 76 } 77 77 78 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs )79 { 80 OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs ));78 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 79 { 80 OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs, hostWindow)); 81 81 return context->m_contextObj ? context.release() : 0; 82 82 } 83 83 84 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs )84 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 85 85 : m_currentWidth(0) 86 86 , m_currentHeight(0) … … 95 95 , m_multisampleColorBuffer(0) 96 96 { 97 UNUSED_PARAM(hostWindow); 98 97 99 Vector<CGLPixelFormatAttribute> attribs; 98 100 CGLPixelFormatObj pixelFormatObj = 0; -
trunk/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
r57745 r57747 24 24 #include "GraphicsContext.h" 25 25 #include "HTMLCanvasElement.h" 26 #include "HostWindow.h" 26 27 #include "ImageBuffer.h" 27 28 #include "NotImplemented.h" 29 #include "QWebPageClient.h" 28 30 #include "WebGLActiveInfo.h" 29 31 #include "WebGLArray.h" … … 38 40 #include "WebGLTexture.h" 39 41 #include "WebGLUnsignedByteArray.h" 42 #include <QAbstractScrollArea> 40 43 #include <wtf/UnusedParam.h> 41 44 #include <wtf/text/CString.h> … … 148 151 class GraphicsContext3DInternal { 149 152 public: 150 GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs );153 GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow); 151 154 ~GraphicsContext3DInternal(); 152 155 … … 256 259 private: 257 260 261 QGLWidget* getOwnerGLWidget(QWebPageClient* webPageClient); 258 262 void* getProcAddress(const String& proc); 259 263 bool m_contextValid; … … 266 270 #endif 267 271 268 GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs )272 GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 269 273 : m_attrs(attrs) 270 274 , m_glWidget(0) … … 275 279 , m_contextValid(true) 276 280 { 277 m_attrs.alpha = true; 278 m_attrs.depth = true; 279 m_attrs.stencil = false; 280 m_attrs.antialias = false; 281 m_attrs.premultipliedAlpha = true; 282 283 QGLFormat format; 284 285 format.setDepth(true); 286 format.setSampleBuffers(true); 287 format.setStencil(false); 288 289 m_glWidget = new QGLWidget(format); 281 QWebPageClient* webPageClient = hostWindow->platformPageClient(); 282 QGLWidget* ownerGLWidget = getOwnerGLWidget(webPageClient); 283 284 if (ownerGLWidget) 285 m_glWidget = new QGLWidget(0, ownerGLWidget); 286 else { 287 QGLFormat format; 288 format.setDepth(true); 289 format.setSampleBuffers(true); 290 format.setStencil(false); 291 292 m_glWidget = new QGLWidget(format); 293 } 294 290 295 if (!m_glWidget->isValid()) { 291 296 LOG_ERROR("GraphicsContext3D: QGLWidget does not have a valid context"); … … 293 298 return; 294 299 } 300 301 QGLFormat format = m_glWidget->format(); 302 303 m_attrs.alpha = format.alpha(); 304 m_attrs.depth = format.depth(); 305 m_attrs.stencil = format.stencil(); 306 m_attrs.antialias = false; 307 m_attrs.premultipliedAlpha = true; 295 308 296 309 m_glWidget->makeCurrent(); … … 432 445 } 433 446 447 QGLWidget* GraphicsContext3DInternal::getOwnerGLWidget(QWebPageClient* webPageClient) 448 { 449 QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>(webPageClient->ownerWidget()); 450 451 if (scrollArea) 452 return qobject_cast<QGLWidget*>(scrollArea->viewport()); 453 454 return 0; 455 } 456 434 457 void* GraphicsContext3DInternal::getProcAddress(const String& proc) 435 458 { … … 449 472 } 450 473 451 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs )452 { 453 OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs ));474 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 475 { 476 OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs, hostWindow)); 454 477 return context->m_internal ? context.release() : 0; 455 478 } 456 479 457 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs )458 : m_internal(new GraphicsContext3DInternal(attrs ))480 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 481 : m_internal(new GraphicsContext3DInternal(attrs, hostWindow)) 459 482 { 460 483 if (!m_internal->isContextValid()) -
trunk/WebKit/chromium/ChangeLog
r57728 r57747 1 2010-04-16 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] WebGL is not visible when QGLWidget viewport is used 6 https://bugs.webkit.org/show_bug.cgi?id=37070 7 8 Added HostWindow parameter to the constructor of GraphicsContext3D. 9 Shared OpenGL context is initialized with parent QGLWidget. 10 11 * src/GraphicsContext3D.cpp: 12 (WebCore::GraphicsContext3D::GraphicsContext3D): 13 1 14 2010-04-16 Fumitoshi Ukai <ukai@chromium.org> 2 15 -
trunk/WebKit/chromium/src/GraphicsContext3D.cpp
r57574 r57747 1049 1049 } 1050 1050 1051 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs) 1052 { 1051 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 1052 { 1053 UNUSED_PARAM(hostWindow); 1053 1054 } 1054 1055 … … 1057 1058 } 1058 1059 1059 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs )1060 PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) 1060 1061 { 1061 1062 GraphicsContext3DInternal* internal = new GraphicsContext3DInternal(); … … 1064 1065 return 0; 1065 1066 } 1066 PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs );1067 PassOwnPtr<GraphicsContext3D> result = new GraphicsContext3D(attrs, hostWindow); 1067 1068 result->m_internal.set(internal); 1068 1069 return result;
Note:
See TracChangeset
for help on using the changeset viewer.