From b83153f1f790614b4807a607990f87557a332bfc Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Wed, 13 Nov 2013 14:17:00 +0100 Subject: Delegated renderer: implement cc::DrawQuad::SOLID_COLOR. I could currently only test this with --enable-overlay-scrollbars. Background color quads still need some work in Chromium to be able to to use this kind of quads, see . Change-Id: I9c9bdb5c72b91827cfdb7e38e44755c6361a05cf Reviewed-by: Zeno Albisser --- lib/delegated_frame_node.cpp | 17 +++++++++++++++++ lib/type_conversion.h | 7 +++++++ 2 files changed, 24 insertions(+) (limited to 'lib') 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 #include #include +#include #include #include #include @@ -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 &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 #include #include #include #include #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( -- cgit v1.2.1