~kdub/mir/fix-1301040

« back to all changes in this revision

Viewing changes to src/server/scene/basic_surface.cpp

  • Committer: Tarmac
  • Author(s): Daniel van Vugt
  • Date: 2014-03-24 14:38:13 UTC
  • mfrom: (1493.1.3 set-transformation)
  • Revision ID: tarmac-20140324143813-5qesax5lvhgqlmj9
Generalize shell::Surface::set_rotation() into set_transformation().
  
A generic transformation matrix is more useful as it can represent any
sequence of transformations, as is required for animation support.
.

Approved by PS Jenkins bot, Alexandros Frantzis, Kevin DuBois, Alberto Aguirre.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "mir/scene/scene_report.h"
29
29
#include "mir/shell/surface_configurator.h"
30
30
 
31
 
#define GLM_FORCE_RADIANS
32
 
#include <glm/gtc/matrix_transform.hpp>
33
 
 
34
31
#include <boost/throw_exception.hpp>
35
32
 
36
33
#include <stdexcept>
253
250
}
254
251
 
255
252
 
256
 
void ms::BasicSurface::set_rotation(float degrees, glm::vec3 const& axis)
 
253
void ms::BasicSurface::set_transformation(glm::mat4 const& t)
257
254
{
258
255
    {
259
256
        std::unique_lock<std::mutex> lk(guard);
260
 
        rotation_matrix = glm::rotate(glm::mat4(1.0f), glm::radians(degrees), axis);
 
257
        transformation_matrix = t;
261
258
    }
262
259
    notify_change();
263
260
}
265
262
glm::mat4 ms::BasicSurface::transformation() const
266
263
{
267
264
    std::unique_lock<std::mutex> lk(guard);
268
 
 
269
 
    // By default the only transformation implemented is rotation...
270
 
    return rotation_matrix;
 
265
    return transformation_matrix;
271
266
}
272
267
 
273
268
bool ms::BasicSurface::should_be_rendered_in(geom::Rectangle const& rect) const