Merge lp:~sergiusens/qtvideo-node/qsgvideonode_p into lp:qtvideo-node

Proposed by Sergio Schvezov
Status: Rejected
Rejected by: Ricardo Salveti
Proposed branch: lp:~sergiusens/qtvideo-node/qsgvideonode_p
Merge into: lp:qtvideo-node
Prerequisite: lp:~phablet-team/qtvideo-node/support_qt52
Diff against target: 143 lines (+130/-1)
2 files modified
src/qsgvideonode_p.cpp (+128/-0)
src/src.pro (+2/-1)
To merge this branch: bzr merge lp:~sergiusens/qtvideo-node/qsgvideonode_p
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ricardo Salveti Pending
Jim Hodapp Pending
Review via email: mp+208471@code.launchpad.net

Commit message

Bringing in the implementation of qsgvideonode_p.cpp here as it's private in QtMultimedia.*

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'src/qsgvideonode_p.cpp'
2--- src/qsgvideonode_p.cpp 1970-01-01 00:00:00 +0000
3+++ src/qsgvideonode_p.cpp 2014-02-26 20:40:13 +0000
4@@ -0,0 +1,128 @@
5+/****************************************************************************
6+**
7+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
8+** Contact: http://www.qt-project.org/legal
9+**
10+** This file is part of the Qt Toolkit.
11+**
12+** $QT_BEGIN_LICENSE:LGPL$
13+** Commercial License Usage
14+** Licensees holding valid commercial Qt licenses may use this file in
15+** accordance with the commercial license agreement provided with the
16+** Software or, alternatively, in accordance with the terms contained in
17+** a written agreement between you and Digia. For licensing terms and
18+** conditions see http://qt.digia.com/licensing. For further information
19+** use the contact form at http://qt.digia.com/contact-us.
20+**
21+** GNU Lesser General Public License Usage
22+** Alternatively, this file may be used under the terms of the GNU Lesser
23+** General Public License version 2.1 as published by the Free Software
24+** Foundation and appearing in the file LICENSE.LGPL included in the
25+** packaging of this file. Please review the following information to
26+** ensure the GNU Lesser General Public License version 2.1 requirements
27+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
28+**
29+** In addition, as a special exception, Digia gives you certain additional
30+** rights. These rights are described in the Digia Qt LGPL Exception
31+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
32+**
33+** GNU General Public License Usage
34+** Alternatively, this file may be used under the terms of the GNU
35+** General Public License version 3.0 as published by the Free Software
36+** Foundation and appearing in the file LICENSE.GPL included in the
37+** packaging of this file. Please review the following information to
38+** ensure the GNU General Public License version 3.0 requirements will be
39+** met: http://www.gnu.org/copyleft/gpl.html.
40+**
41+**
42+** $QT_END_LICENSE$
43+**
44+****************************************************************************/
45+
46+#include "private/qsgvideonode_p.h"
47+
48+QT_BEGIN_NAMESPACE
49+
50+QSGVideoNode::QSGVideoNode()
51+ : m_orientation(-1)
52+{
53+}
54+
55+/* Helpers */
56+static inline void qSetGeom(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
57+{
58+ v->x = p.x();
59+ v->y = p.y();
60+}
61+
62+static inline void qSetTex(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
63+{
64+ v->tx = p.x();
65+ v->ty = p.y();
66+}
67+
68+/* Update the vertices and texture coordinates. Orientation must be in {0,90,180,270} */
69+void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &textureRect, int orientation)
70+{
71+ if (rect == m_rect && textureRect == m_textureRect && orientation == m_orientation)
72+ return;
73+
74+ m_rect = rect;
75+ m_textureRect = textureRect;
76+ m_orientation = orientation;
77+
78+ QSGGeometry *g = geometry();
79+
80+ if (g == 0)
81+ g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
82+
83+ QSGGeometry::TexturedPoint2D *v = g->vertexDataAsTexturedPoint2D();
84+
85+ // Set geometry first
86+ qSetGeom(v + 0, rect.topLeft());
87+ qSetGeom(v + 1, rect.bottomLeft());
88+ qSetGeom(v + 2, rect.topRight());
89+ qSetGeom(v + 3, rect.bottomRight());
90+
91+ // and then texture coordinates
92+ switch (orientation) {
93+ default:
94+ // tl, bl, tr, br
95+ qSetTex(v + 0, textureRect.topLeft());
96+ qSetTex(v + 1, textureRect.bottomLeft());
97+ qSetTex(v + 2, textureRect.topRight());
98+ qSetTex(v + 3, textureRect.bottomRight());
99+ break;
100+
101+ case 90:
102+ // tr, tl, br, bl
103+ qSetTex(v + 0, textureRect.topRight());
104+ qSetTex(v + 1, textureRect.topLeft());
105+ qSetTex(v + 2, textureRect.bottomRight());
106+ qSetTex(v + 3, textureRect.bottomLeft());
107+ break;
108+
109+ case 180:
110+ // br, tr, bl, tl
111+ qSetTex(v + 0, textureRect.bottomRight());
112+ qSetTex(v + 1, textureRect.topRight());
113+ qSetTex(v + 2, textureRect.bottomLeft());
114+ qSetTex(v + 3, textureRect.topLeft());
115+ break;
116+
117+ case 270:
118+ // bl, br, tl, tr
119+ qSetTex(v + 0, textureRect.bottomLeft());
120+ qSetTex(v + 1, textureRect.bottomRight());
121+ qSetTex(v + 2, textureRect.topLeft());
122+ qSetTex(v + 3, textureRect.topRight());
123+ break;
124+ }
125+
126+ if (!geometry())
127+ setGeometry(g);
128+
129+ markDirty(DirtyGeometry);
130+}
131+
132+QT_END_NAMESPACE
133
134=== modified file 'src/src.pro'
135--- src/src.pro 2014-02-26 20:40:13 +0000
136+++ src/src.pro 2014-02-26 20:40:13 +0000
137@@ -27,4 +27,5 @@
138 shadervideomaterial.cpp \
139 shadervideoshader.cpp \
140 shadervideonode.cpp \
141- snapshotgenerator.cpp
142+ snapshotgenerator.cpp \
143+ qsgvideonode_p.cpp

Subscribers

People subscribed via source and target branches