Skip to content

Commit 7b379b4

Browse files
committed
Remove obsolete mutexes
1 parent 3a5c212 commit 7b379b4

File tree

6 files changed

+1
-33
lines changed

6 files changed

+1
-33
lines changed

src/irenderedtarget.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class IRenderedTarget : public QNanoQuickItem
6969

7070
virtual QPointF mapFromScene(const QPointF &point) const = 0;
7171

72-
virtual void lockCostume() = 0;
73-
virtual void unlockCostume() = 0;
74-
7572
virtual bool mirrorHorizontally() const = 0;
7673

7774
virtual Texture texture() const = 0;

src/renderedtarget.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ void RenderedTarget::updateCostume(Costume *costume)
9898
if (!costume || costume == m_costume)
9999
return;
100100

101-
m_costumeMutex.lock();
102101
m_costume = costume;
103102

104103
if (m_costumesLoaded) {
@@ -110,8 +109,6 @@ void RenderedTarget::updateCostume(Costume *costume)
110109
m_skin = it->second;
111110
}
112111

113-
m_costumeMutex.unlock();
114-
115112
calculateSize();
116113
calculatePos();
117114
}
@@ -530,16 +527,6 @@ void RenderedTarget::handleSceneMouseMove(qreal x, qreal y)
530527
}
531528
}
532529

533-
void RenderedTarget::lockCostume()
534-
{
535-
m_costumeMutex.lock();
536-
}
537-
538-
void RenderedTarget::unlockCostume()
539-
{
540-
m_costumeMutex.unlock();
541-
}
542-
543530
bool RenderedTarget::mirrorHorizontally() const
544531
{
545532
return m_mirrorHorizontally;

src/renderedtarget.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ class RenderedTarget : public IRenderedTarget
7676

7777
QPointF mapFromScene(const QPointF &point) const override;
7878

79-
void lockCostume() override;
80-
void unlockCostume() override;
81-
8279
bool mirrorHorizontally() const override;
8380

8481
Texture texture() const override;
@@ -118,8 +115,6 @@ class RenderedTarget : public IRenderedTarget
118115
Skin *m_skin = nullptr;
119116
Texture m_texture;
120117
Texture m_oldTexture;
121-
QMutex m_costumeMutex;
122-
QMutex mutex;
123118
double m_size = 1;
124119
double m_x = 0;
125120
double m_y = 0;

src/targetpainter.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ void TargetPainter::paint(QNanoPainter *painter)
2727
"application object.");
2828
}
2929

30-
m_target->lockCostume();
31-
3230
QOpenGLContext *context = QOpenGLContext::currentContext();
3331
Q_ASSERT(context);
3432

@@ -46,10 +44,8 @@ void TargetPainter::paint(QNanoPainter *painter)
4644

4745
Texture texture = m_target->texture();
4846

49-
if (!texture.isValid()) {
50-
m_target->unlockCostume();
47+
if (!texture.isValid())
5148
return;
52-
}
5349

5450
// Create a FBO for the current texture
5551
unsigned int fbo;
@@ -58,7 +54,6 @@ void TargetPainter::paint(QNanoPainter *painter)
5854
glF.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.handle(), 0);
5955

6056
if (glF.glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
61-
m_target->unlockCostume();
6257
qWarning() << "error: framebuffer incomplete (" + m_target->scratchTarget()->name() + ")";
6358
glF.glDeleteFramebuffers(1, &fbo);
6459
return;
@@ -73,7 +68,6 @@ void TargetPainter::paint(QNanoPainter *painter)
7368
glF.glDeleteFramebuffers(1, &fbo);
7469

7570
m_target->updateHullPoints(targetFbo);
76-
m_target->unlockCostume();
7771
}
7872

7973
void TargetPainter::synchronize(QNanoQuickItem *item)

test/mocks/renderedtargetmock.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ class RenderedTargetMock : public IRenderedTarget
5454

5555
MOCK_METHOD(QPointF, mapFromScene, (const QPointF &), (const, override));
5656

57-
MOCK_METHOD(void, lockCostume, (), (override));
58-
MOCK_METHOD(void, unlockCostume, (), (override));
59-
6057
MOCK_METHOD(bool, mirrorHorizontally, (), (const, override));
6158

6259
MOCK_METHOD(Texture, texture, (), (const, override));

test/targetpainter/targetpainter_test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ TEST_F(TargetPainterTest, Paint)
7676

7777
// Paint
7878
Texture texture(refFbo.texture(), refFbo.size());
79-
EXPECT_CALL(target, lockCostume());
8079
EXPECT_CALL(target, texture()).WillOnce(Return(texture));
8180
EXPECT_CALL(target, updateHullPoints(&fbo));
82-
EXPECT_CALL(target, unlockCostume());
8381
targetPainter.paint(&painter);
8482
painter.endFrame();
8583

0 commit comments

Comments
 (0)