libkdegames
kgamerenderer.cpp
Go to the documentation of this file.
47 KGameRendererPrivate::KGameRendererPrivate(KgThemeProvider* provider, unsigned cacheSize, KGameRenderer* parent)
73 connect(provider, SIGNAL(currentThemeChanged(const KgTheme*)), SLOT(_k_setTheme(const KgTheme*)));
210 //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 get evicted.
232 //theme is cached - just delete the old renderer after making sure that no worker threads are using it anymore
277 QString KGameRendererPrivate::spriteFrameKey(const QString& key, int frame, bool normalizeFrameNo) const
318 if (d->m_rendererPool.hasAvailableRenderers() && (d->m_strategies & KGameRenderer::UseDiskCache))
375 if (!d->m_rendererPool.hasAvailableRenderers() && (d->m_strategies & KGameRenderer::UseDiskCache))
411 QPixmap KGameRenderer::spritePixmap(const QString& key, const QSize& size, int frame, const QHash<QColor, QColor>& customColors) const
419 void KGameRendererPrivate::requestPixmap__propagateResult(const QPixmap& pixmap, KGameRendererClient* client, QPixmap* synchronousResult)
431 void KGameRendererPrivate::requestPixmap(const KGRInternal::ClientSpec& spec, KGameRendererClient* client, QPixmap* synchronousResult)
433 //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 KGameRendererClient::receivePixmap, the QPixmap* argument is then used to return the result.
442 QHash<QColor, QColor>::const_iterator it1 = spec.customColors.constBegin(), it2 = spec.customColors.constEnd();
521 //This optimization saves the image-pixmap conversion for intermediate sizes which occur during smooth resize events or window initializations.
537 KGRInternal::Worker::Worker(KGRInternal::Job* job, bool isSynchronous, KGameRendererPrivate* parent)
576 //NOTE: KGR::spritePixmap relies on Qt::DirectConnection when this method is run in the main thread.
600 QHash<QSvgRenderer*, QThread*>::const_iterator it1 = m_hash.constBegin(), it2 = m_hash.constEnd();
This QPaintDevice forwards all painting operations performed on it to the contained QPaintDevice...
Definition: colorproxy_p.h:46
KGameRenderer::Strategies m_strategies
Definition: kgamerenderer_p.h:127
QString spriteFrameKey(const QString &key, int frame, bool normalizeFrameNo=false) const
Definition: kgamerenderer.cpp:277
iterator insert(const Key &key, const T &value)
int width() const
const Key key(const T &value) const
int toInt(bool *ok, int base) const
Definition: kgamerenderer_p.h:107
void render(QPainter *painter)
bool isEmpty() const
Definition: kgamerenderer_p.h:83
A theme provider manages KgTheme instances, and maintains a selection of the currentTheme().
Definition: kgthemeprovider.h:39
bool isValid() const
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QRectF boundsOnSprite(const QString &key, int frame=-1) const
Definition: kgamerenderer.cpp:357
KGameRendererPrivate(KgThemeProvider *provider, unsigned cacheSize, KGameRenderer *parent)
Definition: kgamerenderer.cpp:47
KGRInternal::RendererPool m_rendererPool
Definition: kgamerenderer_p.h:132
T value() const
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
const_iterator constFind(const Key &key) const
void jobFinished(KGRInternal::Job *job, bool isSynchronous)
Definition: kgamerenderer.cpp:507
int length() const
void setStrategyEnabled(Strategy strategy, bool enabled=true)
Enables/disables an optimization strategy for this renderer.
Definition: kgamerenderer.cpp:136
virtual ~KGameRenderer()
Deletes this KGameRenderer instance, as well as all clients using it.
Definition: kgamerenderer.cpp:88
KgThemeProvider * themeProvider() const
QString fromUtf8(const char *str, int size)
QString & insert(int position, QChar ch)
void freeRenderer(QSvgRenderer *renderer)
Definition: kgamerenderer.cpp:649
QVariant property(const char *name) const
const_iterator constEnd() const
virtual void receivePixmap(const QPixmap &pixmap)=0
This method is called when the KGameRenderer has provided a new pixmap for this client (esp...
void fill(uint pixelValue)
void setDefaultPrimaryView(QGraphicsView *view)
Set the primary view which will be used by newly created KGameRenderedItem instances associated with ...
Definition: kgamerenderer.cpp:106
QGraphicsView * defaultPrimaryView() const
Definition: kgamerenderer.cpp:101
bool isEmpty() const
Worker(Job *job, bool isSynchronous, KGameRendererPrivate *parent)
Definition: kgamerenderer.cpp:537
int removeAll(const T &value)
QByteArray number(int n, int base)
iterator begin()
const KgTheme * theme() const
void truncate(int pos)
RendererPool(QThreadPool *threadPool)
Definition: kgamerenderer.cpp:583
QCoreApplication * instance()
QHash< KGameRendererClient *, QString > m_clients
Definition: kgamerenderer_p.h:134
void requestPixmap(const KGRInternal::ClientSpec &spec, KGameRendererClient *client, QPixmap *synchronousResult=0)
Definition: kgamerenderer.cpp:431
void setPath(const QString &graphicsPath, QSvgRenderer *renderer=0)
Definition: kgamerenderer.cpp:595
QList< Key > keys() const
static KgThemeProvider * providerForSingleTheme(KgTheme *theme, QObject *parent)
Definition: kgamerenderer.cpp:76
void clear()
const T value(const Key &key) const
QHash< QString, QRectF > m_boundsCache
Definition: kgamerenderer_p.h:160
void setParent(QObject *parent)
bool contains(QChar ch, Qt::CaseSensitivity cs) const
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
const KgTheme * defaultTheme() const
Definition: kgthemeprovider.cpp:113
An object that receives pixmaps from a KGameRenderer.
Definition: kgamerendererclient.h:50
void waitForDone()
QRectF boundsOnElement(const QString &id) const
const_iterator constBegin() const
Strategy
Describes the various strategies which KGameRenderer can use to speed up rendering.
Definition: kgamerenderer.h:103
KGRInternal::RendererPool * rendererPool
Definition: kgamerenderer_p.h:85
void themeChanged(const KgTheme *theme)
bool isEmpty() const
void setFrameBaseIndex(int frameBaseIndex)
Sets the frame base index, i.e.
Definition: kgamerenderer.cpp:116
QThread * currentThread()
bool hasAvailableRenderers() const
Definition: kgamerenderer.cpp:621
bool elementExists(const QString &id) const
If set, pixmaps will be cached in a shared disk cache (using KSharedDataCache).
Definition: kgamerenderer.h:109
QHash< QString, int > m_frameCountCache
Definition: kgamerenderer_p.h:159
int height() const
QHash< QString, QPixmap > m_pixmapCache
Definition: kgamerenderer_p.h:158
void _k_setTheme(const KgTheme *theme)
Definition: kgamerenderer.cpp:159
QGraphicsView * m_defaultPrimaryView
Definition: kgamerenderer_p.h:129
QString fromLatin1(const char *str, int size)
QSvgRenderer * allocRenderer()
Definition: kgamerenderer.cpp:628
bool spriteExists(const QString &key) const
Definition: kgamerenderer.cpp:406
If set, pixmap requests from KGameRendererClients will be handled asynchronously if possible...
Definition: kgamerenderer.h:113
KGameRenderer(KgThemeProvider *prov, unsigned cacheSize=0)
Constructs a new KGameRenderer that renders prov->currentTheme().
Definition: kgamerenderer.cpp:66
iterator end()
QPixmap spritePixmap(const QString &key, const QSize &size, int frame=-1, const QHash< QColor, QColor > &customColors=(QHash< QColor, QColor >())) const
Definition: kgamerenderer.cpp:411
Definition: kgamerenderer_p.h:33
void start(QRunnable *runnable, int priority)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
T * take()
QHash< QColor, QColor > customColors
Definition: kgamerenderer_p.h:41
Definition: kgamerenderer_p.h:92
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QStringList m_pendingRequests
Definition: kgamerenderer_p.h:135
bool endsWith(const QByteArray &ba) const
applicationName
QRgb rgba() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.