4#ifndef QSGGRADIENTCACHE_P_H
5#define QSGGRADIENTCACHE_P_H
18#include <QtCore/qhash.h>
19#include <QtCore/qcache.h>
20#include <QtGui/qbrush.h>
22#include <QtQuick/qtquickexports.h>
32 QSGGradientCacheKey(
const QGradientStops &stops, QGradient::Spread spread)
33 : stops(stops), spread(spread)
37 bool operator==(
const QSGGradientCacheKey &other)
const
39 return spread == other.spread && stops == other.stops;
43inline size_t qHash(
const QSGGradientCacheKey &v, size_t seed = 0)
45 size_t h = qHash(size_t(v.spread), seed);
46 for (
int i = 0; i < 2 && i < v.stops.size(); ++i)
47 h = qHash(v.stops[i].first, qHash(v.stops[i].second.rgba64(), h));
56 QGradient::Spread spread = QGradient::PadSpread;
65 static QSGGradientCache *cacheForRhi(QRhi *rhi);
66 QSGTexture *get(
const QSGGradientCacheKey &grad);
69 void setTextureData(QSGPlainTexture *tx,
const QSGGradientCacheKey &grad);
72 ~IndexHolder() {
if (freeIndex && idx >= 0) *freeIndex = idx; }
74 qsizetype *freeIndex =
nullptr;
76 QList<QSGPlainTexture *> m_textures;
77 QCache<QSGGradientCacheKey, IndexHolder> m_cache;
78 qsizetype m_freeIndex = -1;
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QSGCurveFillMaterialShader(QGradient::Type gradientType, bool useTextureFill, bool useDerivatives, int viewCount)
bool updateUniformData(RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
Combined button and popup list for selecting options.
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
bool operator==(const QSGGradientCacheKey &other) const