diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index ac0732911..6e139b125 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -1990,19 +1990,18 @@ void Graphics::origin() pixelScaleStack.back() = 1; } -void Graphics::applyTransform(love::math::Transform *transform) +void Graphics::applyTransform(const Matrix4 &m) { - Matrix4 &m = transformStack.back(); - m *= transform->getMatrix(); + Matrix4 ¤t = transformStack.back(); + current *= m; float sx, sy; - m.getApproximateScale(sx, sy); + current.getApproximateScale(sx, sy); pixelScaleStack.back() = (sx + sy) / 2.0; } -void Graphics::replaceTransform(love::math::Transform *transform) +void Graphics::replaceTransform(const Matrix4 &m) { - const Matrix4 &m = transform->getMatrix(); transformStack.back() = m; float sx, sy; diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 82f568e69..a614ea247 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -826,8 +826,8 @@ public: void shear(float kx, float ky); void origin(); - void applyTransform(love::math::Transform *transform); - void replaceTransform(love::math::Transform *transform); + void applyTransform(const Matrix4 &m); + void replaceTransform(const Matrix4 &m); Vector2 transformPoint(Vector2 point); Vector2 inverseTransformPoint(Vector2 point); diff --git a/src/modules/graphics/wrap_Graphics.cpp b/src/modules/graphics/wrap_Graphics.cpp index 1c0ebc6d7..56b83a4c8 100644 --- a/src/modules/graphics/wrap_Graphics.cpp +++ b/src/modules/graphics/wrap_Graphics.cpp @@ -3441,7 +3441,7 @@ int w_push(lua_State *L) if (luax_istype(L, 2, math::Transform::type)) { math::Transform *t = luax_totype(L, 2); - luax_catchexcept(L, [&]() { instance()->applyTransform(t); }); + luax_catchexcept(L, [&]() { instance()->applyTransform(t->getMatrix()); }); } return 0; @@ -3492,15 +3492,19 @@ int w_origin(lua_State * /*L*/) int w_applyTransform(lua_State *L) { - math::Transform *t = math::luax_checktransform(L, 1); - luax_catchexcept(L, [&]() { instance()->applyTransform(t); }); + luax_checkstandardtransform(L, 1, [&](const Matrix4 &m) + { + luax_catchexcept(L, [&]() { instance()->applyTransform(m); }); + }); return 0; } int w_replaceTransform(lua_State *L) { - math::Transform *t = math::luax_checktransform(L, 1); - luax_catchexcept(L, [&]() { instance()->replaceTransform(t); }); + luax_checkstandardtransform(L, 1, [&](const Matrix4 &m) + { + luax_catchexcept(L, [&]() { instance()->replaceTransform(m); }); + }); return 0; }