Mon 22 Oct 2007 06:05:54 PM UTC, comment #8:
Discussion in IRC was continued:
It's probably better to keep scaling in gui.cpp (like the current design). So gui.cpp would define the stage matrix and pass it over to the renderers.
Neither movie_root nor the GUI implementations (ie. GTK.cpp) would know about this stage matrix. Instead, gui.cpp acts like a coordinate gateway and converts between screen coordinates (GUI side) and ActionScript coordinates (movie_root side).
Concatenation of the stage matrix to the object matrix is done in-place by the renderers.
This is what happens when the user clicks in the middle of a 200% scaled window (native movie size 100x100 pixels):
1) GTK sends mouse move event at 200/200 (window center)
2) GTK GUI receives the event and calls Gui::notify_mouse_moved(200, 200)
3) gui.cpp reverse-applies the stage-matrix to these coordinates getting 100/100 as new coordinates
4) gui.cpp calls movie_root::notify_mouse_moved(100, 100)
5) an ActionScript handler onMouseDown is invoked with _xmouse=100
This works the same way with all scaleModes (only the stage matrix changes). Note neither movie_root nor the GTK GUI knows about the scale mode.
Similarly, when the renderer has to render a shape it goes this way:
1) Before rendering the frame it receives the current stage matrix from gui.cpp
2) The renderer function draw_shape_character() is called (with definition and instance reference, as usual)
3) The renderer calls get_world_matrix() of the instance
4) The stage matrix received in step 1 is concatenated
5) The shape is rendered using this final matrix, not needing any x/y scale or twips->pixel conversion
I hope this description is clear :)
|