Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgimagenode.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qsgimagenode.h"
5
7
177 const QRectF &rect,
178 QRectF sourceRect,
179 TextureCoordinatesTransformMode texCoordMode)
180{
181 if (!texture)
182 return;
183
184 if (!sourceRect.width() || !sourceRect.height()) {
185 QSize ts = texture->textureSize();
186 sourceRect = QRectF(0, 0, ts.width(), ts.height());
187 }
188
189 // Maybe transform the texture coordinates
190 if (texCoordMode.testFlag(QSGImageNode::MirrorHorizontally)) {
191 float tmp = sourceRect.left();
192 sourceRect.setLeft(sourceRect.right());
193 sourceRect.setRight(tmp);
194 }
195 if (texCoordMode.testFlag(QSGImageNode::MirrorVertically)) {
196 float tmp = sourceRect.top();
197 sourceRect.setTop(sourceRect.bottom());
198 sourceRect.setBottom(tmp);
199 }
200
201 QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));
202}
203
\inmodule QtCore\reentrant
Definition qrect.h:484
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect)
Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.
virtual QRectF rect() const =0
Returns the target rect of this image node.
static void rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, TextureCoordinatesTransformMode texCoordMode)
Updates the geometry g with the texture, the coordinates in rect, and the texture coordinates from so...
virtual QRectF sourceRect() const =0
Returns the source rect of this image node.
\inmodule QtQuick
Definition qsgtexture.h:20
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
rect
[4]
Combined button and popup list for selecting options.
GLenum GLuint texture
GLboolean GLboolean g