5#include <QtQuick/private/qsgcontext_p.h>
7#include <private/qquickprofiler_p.h>
8#include <private/qqmlglobal_p.h>
9#include <QtGui/qguiapplication.h>
10#include <QtGui/qpa/qplatformnativeinterface.h>
12#include <QtQuick/private/qsgrhisupport_p.h>
14#include <qtquick_tracepoints_p.h>
22 , m_dirty_texture(
false)
23 , m_owns_texture(true)
24 , m_mipmaps_generated(
false)
25 , m_retain_image(
false)
26 , m_mipmap_warned(
false)
34 , m_dirty_texture(
false)
35 , m_owns_texture(true)
36 , m_mipmaps_generated(
false)
37 , m_retain_image(
false)
38 , m_mipmap_warned(
false)
70 int nativeLayoutOrState,
73 QQuickWindow::CreateTextureOptions options,
74 QQuickWindowPrivate::TextureFromNativeTextureFlags
flags)
76 QRhiTexture::Flags texFlags;
77 if (options.testFlag(QQuickWindow::TextureHasMipmaps))
84 QRhiTexture::Flags formatFlags;
88 texFlags |= formatFlags;
94 t->
createFrom({nativeObjectHandle, nativeLayoutOrState});
137 qWarning(
"QSGPlainTexture: Mipmap settings changed without having image data available. "
138 "Call setImage() again or enable m_retain_image. "
139 "Falling back to previous mipmap filtering mode.");
162 bool needsConvert =
false;
164#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
209 bool needsRebuild =
false;
216 if (mipmappingChanged) {
225 QRhiTexture::Flags
f;
235 qWarning(
"Failed to build texture for QSGPlainTexture (size %dx%d)",
260#include "moc_qsgplaintexture_p.cpp"
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype bytesPerLine() const
Returns the number of bytes per image scanline.
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
QSize size() const
Returns the size of the image, i.e.
int width() const
Returns the width of the image.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
int height() const
Returns the height of the image.
@ Format_RGBA8888_Premultiplied
@ Format_ARGB32_Premultiplied
Format format() const
Returns the format of the image.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
@ NativeTextureIsExternalOES
\inmodule QtCore\reentrant
void generateMips(QRhiTexture *tex)
Enqueues a mipmap generation operation for the specified texture tex.
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Enqueues uploading the image data for one or more mip levels in one or more layers of the texture tex...
void setFlags(Flags f)
Sets the texture flags to f.
virtual bool create()=0
Creates the corresponding native graphics resources.
Format
Specifies the texture format.
virtual bool createFrom(NativeTexture src)
Similar to create(), except that no new native textures are created.
void setPixelSize(const QSize &sz)
Sets the texture size, specified in pixels, to sz.
bool isTextureFormatSupported(QRhiTexture::Format format, QRhiTexture::Flags flags={}) const
int resourceLimit(ResourceLimit limit) const
bool isFeatureSupported(QRhi::Feature feature) const
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
void setTextureFromNativeTexture(QRhi *rhi, quint64 nativeObjectHandle, int nativeLayoutOrState, uint nativeFormat, const QSize &size, QQuickWindow::CreateTextureOptions options, QQuickWindowPrivate::TextureFromNativeTextureFlags flags)
void setImage(const QImage &image)
void setTexture(QRhiTexture *texture)
~QSGPlainTexture() override
QRhiTexture * rhiTexture() const override
void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
qint64 comparisonKey() const override
Returns a key suitable for comparing textures.
QRhiTexture::Format toRhiTextureFormat(uint nativeFormat, QRhiTexture::Flags *flags) const
static QSGRhiSupport * instance()
QSGTexture::Filtering mipmapFiltering() const
Returns whether mipmapping should be used when sampling from this texture.
QSGTexture::WrapMode verticalWrapMode() const
Returns the vertical wrap mode to be used for this texture.
void setMipmapFiltering(Filtering filter)
Sets the mipmap sampling mode to filter.
QSGTexture::WrapMode horizontalWrapMode() const
Returns the horizontal wrap mode to be used for this texture.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
Combined button and popup list for selecting options.
constexpr quint32 qNextPowerOfTwo(quint32 v)
constexpr const T & qMin(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
unsigned long long quint64