Skip to content

Commit

Permalink
Change wart on static from m_ to s_ to avoid confusion.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kristjansson committed Jun 18, 2012
1 parent 6f218b1 commit b5e1718
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 15 additions & 15 deletions mythtv/libs/libmythui/mythimage.cpp
Expand Up @@ -23,7 +23,7 @@
#include "mythuihelper.h"
#include "mythmainwindow.h"

MythUIHelper *MythImage::m_ui = NULL;
MythUIHelper *MythImage::s_ui = NULL;

MythImage::MythImage(MythPainter *parent)
{
Expand All @@ -49,8 +49,8 @@ MythImage::MythImage(MythPainter *parent)
m_FileName = "";

m_cached = false;
if (!m_ui)
m_ui = GetMythUI();
if (!s_ui)
s_ui = GetMythUI();
}

MythImage::~MythImage()
Expand All @@ -62,21 +62,21 @@ MythImage::~MythImage()
void MythImage::UpRef(void)
{
QMutexLocker locker(&m_RefCountLock);
if (m_ui && m_cached && m_RefCount == 1)
m_ui->ExcludeFromCacheSize(this);
if (s_ui && m_cached && m_RefCount == 1)
s_ui->ExcludeFromCacheSize(this);
m_RefCount++;
}

bool MythImage::DownRef(void)
{
m_RefCountLock.lock();
m_RefCount--;
if (m_ui && m_cached)
if (s_ui && m_cached)
{
if (m_RefCount == 1)
m_ui->IncludeInCacheSize(this);
s_ui->IncludeInCacheSize(this);
else if (m_RefCount == 0)
m_ui->ExcludeFromCacheSize(this);
s_ui->ExcludeFromCacheSize(this);
}

if (m_RefCount <= 0)
Expand All @@ -98,24 +98,24 @@ int MythImage::RefCount(void)
void MythImage::SetIsInCache(bool bCached)
{
QMutexLocker locker(&m_RefCountLock);
if (m_ui && m_RefCount == 1)
if (s_ui && m_RefCount == 1)
{
if (!m_cached && bCached)
m_ui->IncludeInCacheSize(this);
s_ui->IncludeInCacheSize(this);
else if (m_cached && !bCached)
m_ui->ExcludeFromCacheSize(this);
s_ui->ExcludeFromCacheSize(this);
}
m_cached = bCached;
}

void MythImage::Assign(const QImage &img)
{
QMutexLocker locker(&m_RefCountLock);
if (m_ui && m_RefCount == 1 && m_cached)
m_ui->ExcludeFromCacheSize(this);
if (s_ui && m_RefCount == 1 && m_cached)
s_ui->ExcludeFromCacheSize(this);
*(static_cast<QImage *> (this)) = img;
if (m_ui && m_RefCount == 1 && m_cached)
m_ui->IncludeInCacheSize(this);
if (s_ui && m_RefCount == 1 && m_cached)
s_ui->IncludeInCacheSize(this);
SetChanged();
}

Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythui/mythimage.h
Expand Up @@ -107,8 +107,9 @@ class MUI_PUBLIC MythImage : public QImage

QString m_FileName;

static MythUIHelper *m_ui;
bool m_cached;

static MythUIHelper *s_ui;
};

#endif
Expand Down

0 comments on commit b5e1718

Please sign in to comment.