// Aseprite // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of // the End-User License Agreement for Aseprite. #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "app/transformation.h" #include "fixmath/fixmath.h" #include "gfx/point.h" #include "gfx/size.h" #include namespace app { using namespace gfx; Transformation::Transformation() { m_bounds.x = 0; m_bounds.y = 0; m_bounds.w = 0; m_bounds.h = 0; m_angle = 0.0; m_pivot.x = 0; m_pivot.y = 0; } Transformation::Transformation(const RectF& bounds) : m_bounds(bounds) { m_angle = 0.0; m_pivot.x = bounds.x + bounds.w/2; m_pivot.y = bounds.y + bounds.h/2; } void Transformation::transformBox(Corners& corners) const { // TODO We could create a composed 4x4 matrix with all // transformation and apply the same matrix to avoid calling // rotatePoint/cos/sin functions 4 times, anyway, it's not // critical at this point. corners = m_bounds; for (std::size_t c=0; c