| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 2 Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 3 | 3 |
| 4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
| 5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
| 6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
| 7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
| 8 | 8 |
| 9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
| 10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "TextureMapperGL.h" | 24 #include "TextureMapperGL.h" |
| 25 #include <CFNumber.h> | 25 #include <CFNumber.h> |
| 26 #include <CGLContext.h> | 26 #include <CGLContext.h> |
| 27 #include <CGLCurrent.h> | 27 #include <CGLCurrent.h> |
| 28 #include <CGLIOSurface.h> | 28 #include <CGLIOSurface.h> |
| 29 #include <IOSurface/IOSurface.h> | 29 #include <IOSurface/IOSurface.h> |
| 30 #include <OpenGL/OpenGL.h> | 30 #include <OpenGL/OpenGL.h> |
| 31 #include <OpenGL/gl.h> | 31 #include <OpenGL/gl.h> |
| 32 #include <mach/mach.h> | 32 #include <mach/mach.h> |
| 33 | 33 |
| 34 #if PLATFORM(QT) | |
| 35 #include <QGuiApplication> | |
| 36 #include <QOpenGLContext> | |
| 37 #include <qpa/qplatformnativeinterface.h> | |
| 38 #endif | |
| 39 | |
| 40 namespace WebCore { | 34 namespace WebCore { |
| 41 | 35 |
| 42 static uint32_t createTexture(IOSurfaceRef handle) | 36 static uint32_t createTexture(IOSurfaceRef handle) |
| 43 { | 37 { |
| 44 GLuint texture = 0; | 38 GLuint texture = 0; |
| 45 GLuint format = GL_BGRA; | 39 GLuint format = GL_BGRA; |
| 46 GLuint type = GL_UNSIGNED_INT_8_8_8_8_REV; | 40 GLuint type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 47 GLuint internalFormat = GL_RGBA; | 41 GLuint internalFormat = GL_RGBA; |
| 48 CGLContextObj context = CGLGetCurrentContext(); | 42 CGLContextObj context = CGLGetCurrentContext(); |
| 49 if (!context) | 43 if (!context) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 GraphicsSurfacePrivate(const PlatformGraphicsContext3D shareContext, const I
ntSize& size, GraphicsSurface::Flags flags) | 79 GraphicsSurfacePrivate(const PlatformGraphicsContext3D shareContext, const I
ntSize& size, GraphicsSurface::Flags flags) |
| 86 : m_context(0) | 80 : m_context(0) |
| 87 , m_size(size) | 81 , m_size(size) |
| 88 , m_frontBufferTexture(0) | 82 , m_frontBufferTexture(0) |
| 89 , m_frontBufferReadTexture(0) | 83 , m_frontBufferReadTexture(0) |
| 90 , m_backBufferTexture(0) | 84 , m_backBufferTexture(0) |
| 91 , m_backBufferReadTexture(0) | 85 , m_backBufferReadTexture(0) |
| 92 , m_readFbo(0) | 86 , m_readFbo(0) |
| 93 , m_drawFbo(0) | 87 , m_drawFbo(0) |
| 94 { | 88 { |
| 95 #if PLATFORM(QT) | |
| 96 QPlatformNativeInterface* nativeInterface = QGuiApplication::platformNat
iveInterface(); | |
| 97 CGLContextObj shareContextObject = static_cast<CGLContextObj>(nativeInte
rface->nativeResourceForContext(QByteArrayLiteral("cglContextObj"), shareContext
)); | |
| 98 if (!shareContextObject) | |
| 99 return; | |
| 100 | |
| 101 CGLPixelFormatObj pixelFormatObject = CGLGetPixelFormat(shareContextObje
ct); | |
| 102 if (kCGLNoError != CGLCreateContext(pixelFormatObject, shareContextObjec
t, &m_context)) | |
| 103 return; | |
| 104 | |
| 105 CGLRetainContext(m_context); | |
| 106 #endif | |
| 107 | |
| 108 unsigned pixelFormat = 'BGRA'; | 89 unsigned pixelFormat = 'BGRA'; |
| 109 unsigned bytesPerElement = 4; | 90 unsigned bytesPerElement = 4; |
| 110 int width = m_size.width(); | 91 int width = m_size.width(); |
| 111 int height = m_size.height(); | 92 int height = m_size.height(); |
| 112 | 93 |
| 113 unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow
, width * bytesPerElement); | 94 unsigned long bytesPerRow = IOSurfaceAlignProperty(kIOSurfaceBytesPerRow
, width * bytesPerElement); |
| 114 if (!bytesPerRow) | 95 if (!bytesPerRow) |
| 115 return; | 96 return; |
| 116 | 97 |
| 117 unsigned long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, he
ight * bytesPerRow); | 98 unsigned long allocSize = IOSurfaceAlignProperty(kIOSurfaceAllocSize, he
ight * bytesPerRow); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 { | 412 { |
| 432 if (m_fbo) | 413 if (m_fbo) |
| 433 glDeleteFramebuffers(1, &m_fbo); | 414 glDeleteFramebuffers(1, &m_fbo); |
| 434 if (m_private) | 415 if (m_private) |
| 435 delete m_private; | 416 delete m_private; |
| 436 m_private = 0; | 417 m_private = 0; |
| 437 } | 418 } |
| 438 | 419 |
| 439 } | 420 } |
| 440 #endif | 421 #endif |
| OLD | NEW |