Skip to content

Commit 8872d94

Browse files
committed
Revert "fix #141: Ignore invisible sprites in contains point methods"
This reverts commit b000c61.
1 parent f3f58aa commit 8872d94

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/renderedtarget.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ const std::vector<QPoint> &RenderedTarget::hullPoints() const
584584

585585
bool RenderedTarget::contains(const QPointF &point) const
586586
{
587-
if (!isVisible() || !m_costume || !m_texture.isValid() || !m_cpuTexture.isValid() || !parentItem())
587+
if (!m_costume || !m_texture.isValid() || !m_cpuTexture.isValid() || !parentItem())
588588
return false;
589589

590590
const double scaleRatio = m_skin->getTextureScale(m_texture) / m_skin->getTextureScale(m_cpuTexture);
@@ -597,7 +597,7 @@ bool RenderedTarget::contains(const QPointF &point) const
597597

598598
bool RenderedTarget::containsScratchPoint(double x, double y) const
599599
{
600-
if (!isVisible() || !m_engine || !m_skin || !m_costume)
600+
if (!m_engine || !m_skin || !m_costume)
601601
return false;
602602

603603
return containsLocalPoint(mapFromScratchToLocal(QPointF(x, y)));

test/renderedtarget/renderedtarget_test.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,6 @@ TEST_F(RenderedTargetTest, CpuRendering)
403403
ASSERT_TRUE(target.contains({ 3, 3 }));
404404
ASSERT_TRUE(target.contains({ 3.3, 3.5 }));
405405

406-
// Regtest for #141
407-
target.setVisible(false);
408-
ASSERT_FALSE(target.contains({ 1, 3 }));
409-
ASSERT_FALSE(target.contains({ 2, 3 }));
410-
target.setVisible(true);
411-
412406
// Test contains() with horizontal mirroring
413407
target.updateRotationStyle(Sprite::RotationStyle::LeftRight);
414408
target.updateDirection(-45);
@@ -443,12 +437,6 @@ TEST_F(RenderedTargetTest, CpuRendering)
443437
ASSERT_TRUE(target.containsScratchPoint(-225, 162)); // [3, 3]
444438
ASSERT_TRUE(target.containsScratchPoint(-224.7, 161.5)); // [3.3, 3.5]
445439

446-
// Regtest for #141
447-
target.setVisible(false);
448-
ASSERT_FALSE(target.containsScratchPoint(-227, 162)); // [1, 3]
449-
ASSERT_FALSE(target.containsScratchPoint(-226, 162)); // [2, 3]
450-
target.setVisible(true);
451-
452440
// Test colorAtScratchPoint()
453441
ASSERT_EQ(target.colorAtScratchPoint(-228, 165), 0); // [0, 0]
454442
ASSERT_EQ(target.colorAtScratchPoint(-227, 165), 0); // [1, 0]

0 commit comments

Comments
 (0)