[python/turtle] Fix small typos

This commit is contained in:
Romain Goyet
2018-11-16 18:34:23 +01:00
parent 5748521876
commit 467ae9c6f3
2 changed files with 10 additions and 8 deletions

View File

@@ -6,6 +6,8 @@ extern "C" {
#include "../../port.h"
#include "turtle_icon.h"
static constexpr KDSize k_iconSize = KDSize(9, 9);
template <typename T> static inline T * allocate(size_t count) {
/* We forward dynamic allocations to the Python GC so we don't have to bother
* with deallocation. For this to work well, the Turtle object who owns the
@@ -151,6 +153,11 @@ bool Turtle::hasDotBuffers() {
return m_dotWorkingPixelBuffer && hasDotMask();
}
KDRect Turtle::iconRect() const {
KDPoint iconOffset = KDPoint(-k_iconSize.width()/2 + 1, -k_iconSize.height()/2 + 1);
return KDRect(position().translatedBy(iconOffset), k_iconSize);
}
const KDColor * Turtle::icon() {
if (m_iconsPixels == nullptr) {
m_iconsPixels = allocate<KDColor>(k_iconSize.width() * k_iconSize.height() * k_numberOfIcons);