本文整理汇总了C++中qt_gl_share_widget函数的典型用法代码示例。如果您正苦于以下问题:C++ qt_gl_share_widget函数的具体用法?C++ qt_gl_share_widget怎么用?C++ qt_gl_share_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qt_gl_share_widget函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TRACE
QImage QEglGLPixmapData::toImage() const
{
TRACE();
// We should not do so many toImage calls alltogether. This is what is slowing us down right now.
// QWK should keep a cache of transformed images instead of re-doing it every frame.
// FIXME make QWebKit not do so many QPixmap(QImage(pixmap.toImage).transform()) style transformations.
if (!isValid())
return QImage();
if (!m_source.isNull()) {
return m_source;
} else if (m_dirty || m_hasFillColor) {
m_source = fillImage(m_fillColor);
return m_source;
} else {
ensureCreated();
}
// read the image from the FBO to memory
if(m_fbo) {
// we read the data back from the fbo
m_ctx->makeCurrent();
QGLShareContextScope ctx(qt_gl_share_widget()->context());
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_fbo);
// this does glReadPixels - not very fast!
QImage temp=qt_gl_read_framebuffer(QSize(w, h), true, true);
glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
m_source=temp;
m_ctx->doneCurrent();
return temp;
}
else if (m_texture.id) {
// we read back from the texture by binding its id as a framebuffer
// is this in the OpenGL standard? It seems to work
m_ctx->makeCurrent();
QGLShareContextScope ctx(qt_gl_share_widget()->context());
glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_texture.id);
// this does glReadPixels - not very fast
QImage temp=qt_gl_read_framebuffer(QSize(w, h), true, true);
glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
// should we cache the fetched image locally to speed up future access?
// m_source=temp;
m_ctx->doneCurrent();
return temp;
}
else {
QImage temp(w,h, QImage::Format_ARGB32_Premultiplied);
// FIXME indicating something went wrong, neither of above cases worked - look out for yellow images
temp.fill(Qt::yellow);
m_source=temp;
return temp;
}
}
开发者ID:RS102839,项目名称:qt,代码行数:53,代码来源:qpixmapdata_egl_p.cpp
示例2: pixelType
void QGLPixmapData::resize(int width, int height)
{
if (width == w && height == h)
return;
if (width <= 0 || height <= 0) {
width = 0;
height = 0;
}
w = width;
h = height;
is_null = (w <= 0 || h <= 0);
d = pixelType() == QPixmapData::PixmapType ? 32 : 1;
if (m_texture.id) {
QGLShareContextScope ctx(qt_gl_share_widget()->context());
glDeleteTextures(1, &m_texture.id);
m_texture.id = 0;
}
m_source = QImage();
m_dirty = isValid();
setSerialNumber(++qt_gl_pixmap_serial);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:25,代码来源:qpixmapdata_gl.cpp
示例3: file
bool QGLPixmapData::fromFile(const QString &filename, const char *format,
Qt::ImageConversionFlags flags)
{
if (pixelType() == QPixmapData::BitmapType)
return QPixmapData::fromFile(filename, format, flags);
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
return false;
QByteArray data = file.peek(64);
bool alpha;
if (m_texture.canBindCompressedTexture
(data.constData(), data.size(), format, &alpha)) {
resize(0, 0);
data = file.readAll();
file.close();
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture
(data.constData(), data.size(), format);
if (!size.isEmpty()) {
w = size.width();
h = size.height();
is_null = false;
d = 32;
m_hasAlpha = alpha;
m_source = QImage();
m_dirty = isValid();
return true;
}
return false;
}
fromImage(QImageReader(&file, format).read(), flags);
return !isNull();
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:33,代码来源:qpixmapdata_gl.cpp
示例4: ctx
void QMeeGoLivePixmapData::initializeThroughEGLImage()
{
if (texture()->id != 0)
return;
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QMeeGoExtensions::ensureInitialized();
EGLImageKHR eglImage = EGL_NO_IMAGE_KHR;
GLuint newTextureId = 0;
eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer) backingX11Pixmap->handle(), preserved_attribs);
if (eglImage == EGL_NO_IMAGE_KHR) {
qWarning("eglCreateImageKHR failed (live texture)!");
return;
}
glGenTextures(1, &newTextureId);
glBindTexture(GL_TEXTURE_2D, newTextureId);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (EGLImageKHR) eglImage);
if (glGetError() == GL_NO_ERROR) {
resize(backingX11Pixmap->width(), backingX11Pixmap->height());
texture()->id = newTextureId;
texture()->options &= ~QGLContext::InvertedYBindOption;
m_hasAlpha = backingX11Pixmap->hasAlphaChannel();
} else {
qWarning("Failed to create a texture from an egl image (live texture)!");
glDeleteTextures(1, &newTextureId);
}
QEgl::eglDestroyImageKHR(QEgl::display(), eglImage);
}
开发者ID:wpbest,项目名称:copperspice,代码行数:35,代码来源:qmeegolivepixmapdata.cpp
示例5: qt_gl_share_widget
bool QGLPixmapData::isValidContext(const QGLContext *ctx) const
{
if (ctx == m_ctx)
return true;
const QGLContext *share_ctx = qt_gl_share_widget()->context();
return ctx == share_ctx || QGLContext::areSharing(ctx, share_ctx);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:8,代码来源:qpixmapdata_gl.cpp
示例6: ctx
void QGLPixmapData::ensureCreated() const
{
if (!m_dirty)
return;
m_dirty = false;
if (nativeImageHandleProvider && !nativeImageHandle)
const_cast<QGLPixmapData *>(this)->createFromNativeImageHandleProvider();
QGLShareContextScope ctx(qt_gl_share_widget()->context());
m_ctx = ctx;
#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE
if (m_sgImage) {
qt_resolve_eglimage_gl_extensions(ctx); // ensure initialized
bool textureIsBound = false;
GLuint newTextureId;
EGLint imgAttr[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
EGLImageKHR image = QEgl::eglCreateImageKHR(QEgl::display()
, EGL_NO_CONTEXT
, EGL_NATIVE_PIXMAP_KHR
, (EGLClientBuffer)m_sgImage
, imgAttr);
glGenTextures(1, &newTextureId);
glBindTexture( GL_TEXTURE_2D, newTextureId);
if (image != EGL_NO_IMAGE_KHR) {
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
GLint err = glGetError();
if (err == GL_NO_ERROR)
textureIsBound = true;
QEgl::eglDestroyImageKHR(QEgl::display(), image);
}
if (textureIsBound) {
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
m_texture.id = newTextureId;
m_texture.boundPixmap = const_cast<QGLPixmapData*>(this);
QGLSgImageTextureCleanup::cleanupForContext(m_ctx)->insert(m_texture.id, const_cast<QGLPixmapData*>(this));
} else {
qWarning("QGLPixmapData: Failed to create texture from a SgImage image of size %dx%d", w, h);
glDeleteTextures(1, &newTextureId);
}
}
#endif
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:53,代码来源:qpixmapdata_symbiangl.cpp
示例7: ctx
bool QMeeGoPixmapData::destroyEGLSharedImage(Qt::HANDLE h)
{
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QMeeGoExtensions::ensureInitialized();
QMutableHashIterator <void*, QMeeGoImageInfo*> i(sharedImagesMap);
while (i.hasNext()) {
i.next();
if (i.value()->handle == h)
i.remove();
}
return QMeeGoExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h);
}
开发者ID:stephaneAG,项目名称:PengPod700,代码行数:14,代码来源:qmeegopixmapdata.cpp
示例8: qt_gl_share_widget
void QGLPixmapData::destroyTexture()
{
if (m_texture.id) {
QGLWidget *shareWidget = qt_gl_share_widget();
if (shareWidget) {
m_texture.options |= QGLContext::MemoryManagedBindOption;
m_texture.freeTexture();
m_texture.options &= ~QGLContext::MemoryManagedBindOption;
} else if(QGLContext::currentContext()) {
glDeleteTextures(1, &m_texture.id);
m_texture.id = 0;
m_texture.boundPixmap = 0;
m_texture.boundKey = 0;
}
m_ctx = 0;
m_dirty = true;
}
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:18,代码来源:qpixmapdata_symbiangl.cpp
示例9: QImage
QImage QGLPixmapData::toImage() const
{
if (!isValid())
return QImage();
if (m_renderFbo) {
copyBackFromRenderFbo(true);
} else if (!m_source.isNull()) {
return m_source;
} else if (m_dirty || m_hasFillColor) {
return fillImage(m_fillColor);
} else {
ensureCreated();
}
QGLShareContextScope ctx(qt_gl_share_widget()->context());
glBindTexture(GL_TEXTURE_2D, m_texture.id);
return qt_gl_read_texture(QSize(w, h), true, true);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:19,代码来源:qpixmapdata_gl.cpp
示例10: resize
bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format,
Qt::ImageConversionFlags flags)
{
bool alpha;
const char *buf = reinterpret_cast<const char *>(buffer);
if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) {
resize(0, 0);
QGLShareContextScope ctx(qt_gl_share_widget()->context());
QSize size = m_texture.bindCompressedTexture(buf, int(len), format);
if (!size.isEmpty()) {
w = size.width();
h = size.height();
is_null = false;
d = 32;
m_hasAlpha = alpha;
m_source = QImage();
m_dirty = isValid();
return true;
}
}
return QPixmapData::fromData(buffer, len, format, flags);
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:22,代码来源:qpixmapdata_gl.cpp
示例11: Q_D
void QGLWidget::resizeEvent(QResizeEvent *e)
{
Q_D(QGLWidget);
if (!isValid())
return;
// Shared widget can ignore resize events which
// may happen due to orientation change
if (this == qt_gl_share_widget())
return;
if (!d->surfaceSizeInitialized || e->oldSize() != e->size()) {
// On Symbian we need to recreate the surface on resize.
d->recreateEglSurface();
d->surfaceSizeInitialized = true;
}
makeCurrent();
if (!d->glcx->initialized())
glInit();
resizeGL(width(), height());
}
开发者ID:sicily,项目名称:qt4.8.4,代码行数:24,代码来源:qgl_symbian.cpp
注:本文中的qt_gl_share_widget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论