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
Definition: kgamerenderer_p.h:107
Definition: kgamerenderer_p.h:83
A theme provider manages KgTheme instances, and maintains a selection of the currentTheme().
Definition: kgthemeprovider.h:39
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
void jobFinished(KGRInternal::Job *job, bool isSynchronous)
Definition: kgamerenderer.cpp:507
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
void freeRenderer(QSvgRenderer *renderer)
Definition: kgamerenderer.cpp:649
virtual void receivePixmap(const QPixmap &pixmap)=0
This method is called when the KGameRenderer has provided a new pixmap for this client (esp...
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
Worker(Job *job, bool isSynchronous, KGameRendererPrivate *parent)
Definition: kgamerenderer.cpp:537
const KgTheme * theme() const
RendererPool(QThreadPool *threadPool)
Definition: kgamerenderer.cpp:583
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
static KgThemeProvider * providerForSingleTheme(KgTheme *theme, QObject *parent)
Definition: kgamerenderer.cpp:76
QHash< QString, QRectF > m_boundsCache
Definition: kgamerenderer_p.h:160
const KgTheme * defaultTheme() const
Definition: kgthemeprovider.cpp:113
An object that receives pixmaps from a KGameRenderer.
Definition: kgamerendererclient.h:50
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)
void setFrameBaseIndex(int frameBaseIndex)
Sets the frame base index, i.e.
Definition: kgamerenderer.cpp:116
bool hasAvailableRenderers() const
Definition: kgamerenderer.cpp:621
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
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
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
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
QHash< QColor, QColor > customColors
Definition: kgamerenderer_p.h:41
Definition: kgamerenderer_p.h:92
QStringList m_pendingRequests
Definition: kgamerenderer_p.h:135
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:44:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.