Skip to content

Commit ff78bd4

Browse files
committed
Add fastBoundingRect() method to ISpriteHandler
1 parent 4f51860 commit ff78bd4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/scratchcpp/ispritehandler.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ class LIBSCRATCHCPP_EXPORT ISpriteHandler
7070
* \note The rectangle must be relative to the stage, so make sure to use the sprite's coordinates.
7171
*/
7272
virtual Rect boundingRect() const = 0;
73+
74+
/*!
75+
* Used to get a less accurate bounding rectangle of the sprite
76+
* which is calculated by transforming the costume rectangle.
77+
* \note The rectangle must be relative to the stage, so make sure to use the sprite's coordinates.
78+
*/
79+
virtual Rect fastBoundingRect() const = 0;
7380
};
7481

7582
} // namespace libscratchcpp

test/mocks/spritehandlermock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <scratchcpp/ispritehandler.h>
4+
#include <scratchcpp/rect.h>
45
#include <gmock/gmock.h>
56

67
using namespace libscratchcpp;
@@ -29,4 +30,5 @@ class SpriteHandlerMock : public ISpriteHandler
2930
MOCK_METHOD(void, onBubbleTextChanged, (const std::string &), (override));
3031

3132
MOCK_METHOD(Rect, boundingRect, (), (const, override));
33+
MOCK_METHOD(Rect, fastBoundingRect, (), (const, override));
3234
};

0 commit comments

Comments
 (0)