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

Subscribers

People subscribed via source and target branches