summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/delegated_frame_node.cpp17
-rw-r--r--lib/type_conversion.h7
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/delegated_frame_node.cpp b/lib/delegated_frame_node.cpp
index 0c50776e0..c770f388d 100644
--- a/lib/delegated_frame_node.cpp
+++ b/lib/delegated_frame_node.cpp
@@ -60,6 +60,7 @@
#include "cc/output/delegated_frame_data.h"
#include "cc/quads/draw_quad.h"
#include "cc/quads/render_pass_draw_quad.h"
+#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
#include "cc/quads/yuv_video_draw_quad.h"
@@ -68,6 +69,7 @@
#include <QSGTexture>
#include <QtQuick/private/qquickclipnode_p.h>
#include <QtQuick/private/qquickwindow_p.h>
+#include <QtQuick/private/qsgadaptationlayer_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgtexture_p.h>
@@ -412,6 +414,21 @@ void DelegatedFrameNode::commit(cc::DelegatedFrameData *frameData, cc::Transfera
textureNode->setTexture(texture.data());
currentLayerChain->appendChildNode(textureNode);
break;
+ } case cc::DrawQuad::SOLID_COLOR: {
+ const cc::SolidColorDrawQuad *scquad = cc::SolidColorDrawQuad::MaterialCast(quad);
+ QSGRenderContext *sgrc = QQuickWindowPrivate::get(m_window)->context;
+ QSGRectangleNode *rectangleNode = sgrc->sceneGraphContext()->createRectangleNode();
+
+ // Qt only supports MSAA and this flag shouldn't be needed.
+ // If we ever want to use QSGRectangleNode::setAntialiasing for this we should
+ // try to see if we can do something similar for tile quads first.
+ Q_UNUSED(scquad->force_anti_aliasing_off);
+
+ rectangleNode->setRect(toQt(quad->rect));
+ rectangleNode->setColor(toQt(scquad->color));
+ rectangleNode->update();
+ currentLayerChain->appendChildNode(rectangleNode);
+ break;
} case cc::DrawQuad::TILED_CONTENT: {
const cc::TileDrawQuad *tquad = cc::TileDrawQuad::MaterialCast(quad);
QSharedPointer<MailboxTexture> &texture = m_mailboxTextures[tquad->resource_id] = mailboxTextureCandidates.take(tquad->resource_id);
diff --git a/lib/type_conversion.h b/lib/type_conversion.h
index ce3423e63..0f0a8ab60 100644
--- a/lib/type_conversion.h
+++ b/lib/type_conversion.h
@@ -42,12 +42,14 @@
#ifndef TYPE_CONVERSION_H
#define TYPE_CONVERSION_H
+#include <QColor>
#include <QMatrix4x4>
#include <QRect>
#include <QString>
#include <QUrl>
#include "base/files/file_path.h"
#include "third_party/skia/include/utils/SkMatrix44.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/rect.h"
#include "url/gurl.h"
@@ -96,6 +98,11 @@ inline QSizeF toQt(const gfx::SizeF &size)
return QSizeF(size.width(), size.height());
}
+inline QColor toQt(const SkColor &c)
+{
+ return QColor(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), SkColorGetA(c));
+}
+
inline QMatrix4x4 toQt(const SkMatrix44 &m)
{
return QMatrix4x4(