KDEGames
kgamerenderer.cpp
35KGameRendererPrivate::KGameRendererPrivate(KGameThemeProvider *provider, unsigned cacheSize, KGameRenderer *parent)
55 connect(provider, &KGameThemeProvider::currentThemeChanged, this, [this](const KGameTheme *theme) {
178 qMax(QFileInfo(theme->graphicsPath()).lastModified().toSecsSinceEpoch(), theme->property("_k_themeDescTimestamp").value<qint64>());
184 // FIXME: This logic breaks if the cache evicts the "kgr_timestamp" key. We need additional API in KSharedDataCache to make sure that this key does not
203 // theme is cached - just delete the old renderer after making sure that no worker threads are using it anymore
247QString KGameRendererPrivate::spriteFrameKey(const QString &key, int frame, bool normalizeFrameNo) const
283 if (d->m_rendererPool.hasAvailableRenderers() && (d->m_strategies & KGameRenderer::UseDiskCache)) {
333 if (!d->m_rendererPool.hasAvailableRenderers() && (d->m_strategies & KGameRenderer::UseDiskCache)) {
367QPixmap KGameRenderer::spritePixmap(const QString &key, QSize size, int frame, const QHash<QColor, QColor> &customColors) const
377void KGameRendererPrivate::requestPixmap__propagateResult(const QPixmap &pixmap, KGameRendererClient *client, QPixmap *synchronousResult)
387void KGameRendererPrivate::requestPixmap(const KGRInternal::ClientSpec &spec, KGameRendererClient *client, QPixmap *synchronousResult)
389 // NOTE: If client == 0, the request is synchronous and must be finished when this method returns. This behavior is used by KGR::spritePixmap(). Instead of
390 // KGameRendererClient::receivePixmap, the QPixmap* argument is then used to return the result. parse request
399 QHash<QColor, QColor>::const_iterator it1 = spec.customColors.constBegin(), it2 = spec.customColors.constEnd();
472 // This optimization saves the image-pixmap conversion for intermediate sizes which occur during smooth resize events or window initializations.
486KGRInternal::Worker::Worker(KGRInternal::Job *job, bool isSynchronous, KGameRendererPrivate *parent)
500 qCWarning(KDEGAMES_LOG) << "Could not create QImage. Key:" << m_job->spec.spriteKey << "Frame:" << m_job->spec.frame << "Size:" << m_job->spec.size;
522 QMetaObject::invokeMethod(m_parent, "jobFinished", Qt::AutoConnection, Q_ARG(KGRInternal::Job *, m_job), Q_ARG(bool, m_synchronous));
523 // NOTE: KGR::spritePixmap relies on Qt::DirectConnection when this method is run in the main thread.
547 QHash<QSvgRenderer *, QThread *>::const_iterator it1 = m_hash.constBegin(), it2 = m_hash.constEnd();
An object that receives pixmaps from a KGameRenderer.
Definition kgamerendererclient.h:42
virtual void receivePixmap(const QPixmap &pixmap)=0
This method is called when the KGameRenderer has provided a new pixmap for this client (esp.
void setStrategyEnabled(Strategy strategy, bool enabled=true)
Enables/disables an optimization strategy for this renderer.
Definition kgamerenderer.cpp:121
QRectF boundsOnSprite(const QString &key, int frame=-1) const
Definition kgamerenderer.cpp:315
KGameRenderer(KGameThemeProvider *prov, unsigned cacheSize=0)
Constructs a new KGameRenderer that renders prov->currentTheme().
Definition kgamerenderer.cpp:49
void setFrameBaseIndex(int frameBaseIndex)
Sets the frame base index, i.e.
Definition kgamerenderer.cpp:93
Strategy
Describes the various strategies which KGameRenderer can use to speed up rendering.
Definition kgamerenderer.h:93
@ UseDiskCache
If set, pixmaps will be cached in a shared disk cache (using KSharedDataCache).
Definition kgamerenderer.h:98
@ UseRenderingThreads
If set, pixmap requests from KGameRendererClients will be handled asynchronously if possible.
Definition kgamerenderer.h:102
~KGameRenderer() override
Deletes this KGameRenderer instance, as well as all clients using it.
Definition kgamerenderer.cpp:73
bool spriteExists(const QString &key) const
Definition kgamerenderer.cpp:360
QPixmap spritePixmap(const QString &key, QSize size, int frame=-1, const QHash< QColor, QColor > &customColors=(QHash< QColor, QColor >())) const
Definition kgamerenderer.cpp:367
A theme provider manages KGameTheme instances, and maintains a selection of the currentTheme().
Definition kgamethemeprovider.h:31
void currentThemeChanged(const KGameTheme *theme)
Emitted when the current theme changes.
QCA_EXPORT QString appName()
void chop(qsizetype n)
bool endsWith(QByteArrayView bv) const const
QByteArray & insert(qsizetype i, QByteArrayView data)
QByteArray number(double n, char format, int precision)
int toInt(bool *ok, int base) const const
QRgb rgba() const const
applicationName
QCoreApplication * instance()
qint64 toSecsSinceEpoch() const const
QDateTime lastModified() const const
Format_ARGB32_Premultiplied
void setDevicePixelRatio(qreal scaleFactor)
WriteOnly
bool isEmpty() const const
bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
QVariant property(const char *name) const const
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
void setDevicePixelRatio(qreal scaleFactor)
int height() const const
int width() const const
QString arg(Args &&... args) const const
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
QString fromUtf8(QByteArrayView str)
QString & insert(qsizetype position, QChar ch)
qsizetype size() const const
QRectF boundsOnElement(const QString &id) const const
bool elementExists(const QString &id) const const
bool isValid() const const
void render(QPainter *painter)
Unchecked
AutoConnection
transparent
QThread * currentThread()
T value() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.