summaryrefslogtreecommitdiffstats
path: root/src/core/delegated_frame_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/delegated_frame_node.cpp')
-rw-r--r--src/core/delegated_frame_node.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index 7f791df29..a3afc2002 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -49,7 +49,7 @@
#include "delegated_frame_node.h"
#include "chromium_gpu_helper.h"
-#include "gl_surface_qt.h"
+#include "ozone/gl_surface_qt.h"
#include "stream_video_node.h"
#include "type_conversion.h"
#include "yuv_video_node.h"
@@ -140,7 +140,7 @@ private:
QSize m_textureSize;
bool m_hasAlpha;
GLenum m_target;
-#if defined(USE_X11)
+#if defined(USE_OZONE)
bool m_ownsTexture;
#endif
#ifdef Q_OS_QNX
@@ -154,7 +154,6 @@ public:
ResourceHolder(const viz::TransferableResource &resource);
QSharedPointer<QSGTexture> initTexture(bool quadIsAllOpaque, RenderWidgetHostViewQtDelegate *apiDelegate = 0);
QSGTexture *texture() const { return m_texture.data(); }
- viz::TransferableResource &transferableResource() { return m_resource; }
viz::ReturnedResource returnResource();
void incImportCount() { ++m_importCount; }
bool needsToFetch() const { return !m_resource.is_software && m_texture && !m_texture.data()->textureId(); }
@@ -185,11 +184,10 @@ public:
virtual void setupRenderPassNode(QSGTexture *, const QRect &, QSGNode *) = 0;
virtual void setupTextureContentNode(QSGTexture *, const QRect &, const QRectF &,
- QSGTexture::Filtering,
QSGTextureNode::TextureCoordinatesTransformMode,
QSGNode *) = 0;
virtual void setupTiledContentNode(QSGTexture *, const QRect &, const QRectF &,
- QSGTexture::Filtering, QSGNode *) = 0;
+ QSGNode *) = 0;
virtual void setupSolidColorNode(const QRect &, const QColor &, QSGNode *) = 0;
#ifndef QT_NO_OPENGL
@@ -228,7 +226,6 @@ public:
}
void setupTextureContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect,
- QSGTexture::Filtering filtering,
QSGTextureNode::TextureCoordinatesTransformMode texCoordTransForm,
QSGNode *) override
{
@@ -245,11 +242,11 @@ public:
textureNode->setRect(rect);
if (textureNode->sourceRect() != sourceRect)
textureNode->setSourceRect(sourceRect);
- if (textureNode->filtering() != filtering)
- textureNode->setFiltering(filtering);
+ if (textureNode->filtering() != texture->filtering())
+ textureNode->setFiltering(texture->filtering());
}
void setupTiledContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect,
- QSGTexture::Filtering filtering, QSGNode *) override
+ QSGNode *) override
{
Q_ASSERT(m_nodeIterator != m_sceneGraphNodes->end());
QSGTextureNode *textureNode = static_cast<QSGTextureNode*>(*m_nodeIterator++);
@@ -262,8 +259,8 @@ public:
textureNode->setRect(rect);
if (textureNode->sourceRect() != sourceRect)
textureNode->setSourceRect(sourceRect);
- if (textureNode->filtering() != filtering)
- textureNode->setFiltering(filtering);
+ if (textureNode->filtering() != texture->filtering())
+ textureNode->setFiltering(texture->filtering());
}
void setupSolidColorNode(const QRect &rect, const QColor &color, QSGNode *) override
{
@@ -332,7 +329,6 @@ public:
}
void setupTextureContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect,
- QSGTexture::Filtering filtering,
QSGTextureNode::TextureCoordinatesTransformMode texCoordTransForm,
QSGNode *layerChain) override
{
@@ -341,20 +337,19 @@ public:
textureNode->setRect(rect);
textureNode->setSourceRect(sourceRect);
textureNode->setTexture(texture);
- textureNode->setFiltering(filtering);
+ textureNode->setFiltering(texture->filtering());
layerChain->appendChildNode(textureNode);
m_sceneGraphNodes->append(textureNode);
}
void setupTiledContentNode(QSGTexture *texture, const QRect &rect, const QRectF &sourceRect,
- QSGTexture::Filtering filtering,
QSGNode *layerChain) override
{
QSGTextureNode *textureNode = m_apiDelegate->createTextureNode();
textureNode->setRect(rect);
textureNode->setSourceRect(sourceRect);
- textureNode->setFiltering(filtering);
+ textureNode->setFiltering(texture->filtering());
textureNode->setTexture(texture);
layerChain->appendChildNode(textureNode);
@@ -431,7 +426,7 @@ private:
static inline QSharedPointer<QSGLayer> findRenderPassLayer(const int &id, const QVector<QPair<int, QSharedPointer<QSGLayer> > > &list)
{
typedef QPair<int, QSharedPointer<QSGLayer> > Pair;
- Q_FOREACH (const Pair &pair, list)
+ for (const Pair &pair : list)
if (pair.first == id)
return pair.second;
return QSharedPointer<QSGLayer>();
@@ -571,7 +566,7 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS
, m_textureSize(textureSize)
, m_hasAlpha(false)
, m_target(GL_TEXTURE_2D)
-#if defined(USE_X11)
+#if defined(USE_OZONE)
, m_ownsTexture(false)
#endif
{
@@ -586,7 +581,7 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS
MailboxTexture::~MailboxTexture()
{
-#if defined(USE_X11)
+#if defined(USE_OZONE)
// This is rare case, where context is not shared
// we created extra texture in current context, so
// delete it now
@@ -651,7 +646,10 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R
if (!texture) {
if (m_resource.is_software) {
Q_ASSERT(apiDelegate);
- std::unique_ptr<viz::SharedBitmap> sharedBitmap = viz::ServerSharedBitmapManager::current()->GetSharedBitmapFromId(m_resource.size, m_resource.mailbox_holder.mailbox);
+ std::unique_ptr<viz::SharedBitmap> sharedBitmap =
+ viz::ServerSharedBitmapManager::current()->GetSharedBitmapFromId(m_resource.size,
+ viz::BGRA_8888,
+ m_resource.mailbox_holder.mailbox);
// QSG interprets QImage::hasAlphaChannel meaning that a node should enable blending
// to draw it but Chromium keeps this information in the quads.
// The input format is currently always Format_ARGB32_Premultiplied, so assume that all
@@ -659,7 +657,9 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R
// from Format_ARGB32_Premultiplied to Format_RGB32 just to get hasAlphaChannel to
// return false.
QImage::Format format = quadNeedsBlending ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
- QImage image(sharedBitmap->pixels(), m_resource.size.width(), m_resource.size.height(), format);
+ QImage image = sharedBitmap
+ ? QImage(sharedBitmap->pixels(), m_resource.size.width(), m_resource.size.height(), format)
+ : QImage(m_resource.size.width(), m_resource.size.height(), format);
texture.reset(apiDelegate->createTextureFromImage(image.copy()));
} else {
#ifndef QT_NO_OPENGL
@@ -669,6 +669,7 @@ QSharedPointer<QSGTexture> ResourceHolder::initTexture(bool quadNeedsBlending, R
Q_UNREACHABLE();
#endif
}
+ texture->setFiltering(m_resource.filter == GL_LINEAR ? QSGTexture::Linear : QSGTexture::Nearest);
m_texture = texture;
}
// All quads using a resource should request the same blending state.
@@ -703,12 +704,12 @@ RectClipNode::RectClipNode(const QRectF &rect)
DelegatedFrameNode::DelegatedFrameNode()
: m_numPendingSyncPoints(0)
-#if defined(USE_X11) && !defined(QT_NO_OPENGL)
+#if defined(USE_OZONE) && !defined(QT_NO_OPENGL)
, m_contextShared(true)
#endif
{
setFlag(UsePreprocess);
-#if defined(USE_X11) && !defined(QT_NO_OPENGL)
+#if defined(USE_OZONE) && !defined(QT_NO_OPENGL)
QOpenGLContext *currentContext = QOpenGLContext::currentContext() ;
QOpenGLContext *sharedContext = qt_gl_global_share_context();
if (currentContext && sharedContext && !QOpenGLContext::areSharing(currentContext, sharedContext)) {
@@ -748,7 +749,7 @@ void DelegatedFrameNode::preprocess()
// Then render any intermediate RenderPass in order.
typedef QPair<int, QSharedPointer<QSGLayer> > Pair;
- Q_FOREACH (const Pair &pair, m_sgObjects.renderPassLayers) {
+ for (const Pair &pair : qAsConst(m_sgObjects.renderPassLayers)) {
// The layer is non-live, request a one-time update here.
pair.second->scheduleUpdate();
// Proceed with the actual update.
@@ -1123,8 +1124,6 @@ void DelegatedFrameNode::handleQuad(
nodeHandler->setupTextureContentNode(
texture, toQt(quad->rect), toQt(uv_rect),
- resource->transferableResource().filter == GL_LINEAR ? QSGTexture::Linear
- : QSGTexture::Nearest,
tquad->y_flipped ? QSGTextureNode::MirrorVertically : QSGTextureNode::NoTransform,
currentLayerChain);
break;
@@ -1168,8 +1167,6 @@ void DelegatedFrameNode::handleQuad(
nodeHandler->setupTiledContentNode(
initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate),
toQt(quad->rect), toQt(tquad->tex_coord_rect),
- resource->transferableResource().filter == GL_LINEAR ? QSGTexture::Linear
- : QSGTexture::Nearest,
currentLayerChain);
break;
#ifndef QT_NO_OPENGL
@@ -1281,7 +1278,7 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
m_textureFences.swap(transferredFences);
}
- Q_FOREACH (gl::TransferableFence sync, transferredFences) {
+ for (gl::TransferableFence sync : qAsConst(transferredFences)) {
// We need to wait on the fences on the Qt current context, and
// can therefore not use GLFence routines that uses a different
// concept of current context.
@@ -1289,7 +1286,7 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
deleteChromiumSync(&sync);
}
-#if defined(USE_X11)
+#if defined(USE_OZONE)
// Workaround when context is not shared QTBUG-48969
// Make slow copy between two contexts.
if (!m_contextShared) {
@@ -1304,7 +1301,7 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
GLuint fbo = 0;
funcs->glGenFramebuffers(1, &fbo);
- Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) {
+ for (MailboxTexture *mailboxTexture : qAsConst(mailboxesToFetch)) {
// Read texture into QImage from shared context.
// Switch to shared context.
sharedContext->makeCurrent(m_offsurface.data());