Skip to content

Commit cc46f82

Browse files
committed
Revert "fix #141: Ignore invisible sprites in contains point methods"
This reverts commit 9fb5683.
1 parent 9fb5683 commit cc46f82

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
@@ -599,7 +599,7 @@ const std::vector<QPoint> &RenderedTarget::hullPoints() const
599599

600600
bool RenderedTarget::contains(const QPointF &point) const
601601
{
602-
if (!isVisible() || !m_costume || !m_texture.isValid() || !m_cpuTexture.isValid() || !parentItem())
602+
if (!m_costume || !m_texture.isValid() || !m_cpuTexture.isValid() || !parentItem())
603603
return false;
604604

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

613613
bool RenderedTarget::containsScratchPoint(double x, double y) const
614614
{
615-
if (!isVisible() || !m_engine || !m_skin || !m_costume)
615+
if (!m_engine || !m_skin || !m_costume)
616616
return false;
617617

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

test/renderedtarget/renderedtarget_test.cpp

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

404-
// Regtest for #141
405-
target.setVisible(false);
406-
ASSERT_FALSE(target.contains({ 1, 3 }));
407-
ASSERT_FALSE(target.contains({ 2, 3 }));
408-
target.setVisible(true);
409-
410404
// Test contains() with horizontal mirroring
411405
target.updateRotationStyle(Sprite::RotationStyle::LeftRight);
412406
target.updateDirection(-45);
@@ -441,12 +435,6 @@ TEST_F(RenderedTargetTest, CpuRendering)
441435
ASSERT_TRUE(target.containsScratchPoint(-225, 162)); // [3, 3]
442436
ASSERT_TRUE(target.containsScratchPoint(-224.7, 161.5)); // [3.3, 3.5]
443437

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

0 commit comments

Comments
 (0)