[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/fb.cpp gui/fltk.cpp gui/gtk...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/fb.cpp gui/fltk.cpp gui/gtk... |
Date: |
Wed, 23 Apr 2008 11:43:48 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/04/23 11:43:48
Modified files:
. : ChangeLog
gui : fb.cpp fltk.cpp gtk.cpp gui.cpp gui.h kde.cpp
sdl.cpp
Log message:
Make pixel scale a Gui private, and drop accessors;
handle it in Gui::notify_mouse_moved, now taking coordinates in
user coordinate space.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6354&r2=1.6355
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fb.cpp?cvsroot=gnash&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fltk.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gtk.cpp?cvsroot=gnash&r1=1.172&r2=1.173
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.152&r2=1.153
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.87&r2=1.88
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/kde.cpp?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/sdl.cpp?cvsroot=gnash&r1=1.66&r2=1.67
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6354
retrieving revision 1.6355
diff -u -b -r1.6354 -r1.6355
--- ChangeLog 23 Apr 2008 10:37:54 -0000 1.6354
+++ ChangeLog 23 Apr 2008 11:43:46 -0000 1.6355
@@ -1,5 +1,12 @@
2008-04-23 Sandro Santilli <address@hidden>
+ * gui/: fb.cpp, fltk.cpp, gtk.cpp, gui.{cpp,h}, kde.cpp, sdl.cpp:
+ Make pixel scale a Gui private, and drop accessors, Handle
+ it in Gui::notify_mouse_moved, now taking coordinates in
+ user coordinate space.
+
+2008-04-23 Sandro Santilli <address@hidden>
+
* server/movie_root.{cpp,h}: drop unused pixel scale
and interfaces to it, update documentation for notify_mouse_moved.
Index: gui/fb.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/fb.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- gui/fb.cpp 7 Apr 2008 21:44:55 -0000 1.54
+++ gui/fb.cpp 23 Apr 2008 11:43:47 -0000 1.55
@@ -890,9 +890,7 @@
//log_debug("mouse @ %d / %d, btn %d", mouse_x, mouse_y, mouse_btn);
- float xscale = getXScale();
- float yscale = getYScale();
- notify_mouse_moved(int(mouse_x / xscale), int(mouse_y / yscale));
+ notify_mouse_moved(mouse_x, mouse_y);
// button
if (btn != mouse_btn) {
@@ -994,11 +992,9 @@
new_y = (2048-new_y) * m_stage_height / 2048;
if ((new_x!=mouse_x) || (new_y!=mouse_y)) {
- float xscale = getXScale();
- float yscale = getYScale();
mouse_x = new_x;
mouse_y = new_y;
- notify_mouse_moved(int(mouse_x / xscale), int(mouse_y / yscale));
+ notify_mouse_moved(mouse_x, mouse_y);
}
if (new_btn != mouse_btn) {
@@ -1144,8 +1140,8 @@
static int new_mouse_y = 0;
static int new_mouse_btn = 0;
- int notify_x; // coordinate to be sent via notify_mouse_moved()
- int notify_y;
+ int notify_x=0; // coordinate to be sent via notify_mouse_moved()
+ int notify_y=0;
bool move_pending = false; // true: notify_mouse_moved() should be called
// this is necessary for our quick'n'dirty touchscreen calibration:
@@ -1168,9 +1164,6 @@
mouse_x = new_mouse_x;
mouse_y = new_mouse_y;
- float xscale = getXScale();
- float yscale = getYScale();
-
float cx, cy;
if (getenv("TSCALIB")) // ONLY convert when requested
@@ -1181,8 +1174,8 @@
// Don't call notify_mouse_moved() here because this would lead to
// lots of calls, especially for touchscreens. Instead we save the
// coordinate and call notify_mouse_moved() only once.
- notify_x = cx / xscale;
- notify_y = cy / yscale;
+ notify_x = cx;
+ notify_y = cy;
move_pending = true;
}
Index: gui/fltk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/fltk.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- gui/fltk.cpp 22 Mar 2008 02:27:23 -0000 1.18
+++ gui/fltk.cpp 23 Apr 2008 11:43:47 -0000 1.19
@@ -115,9 +115,7 @@
if (!_xid && event_y() < static_cast<int>(_menu_height)) {
return Window::handle(event);
}
- int x = static_cast<int>(event_x() / _xscale);
- int y = static_cast<int>((event_y() - _menu_height) / _yscale);
- notify_mouse_moved(x, y);
+ notify_mouse_moved(event_x(), event_y()-_menu_height);
return Window::handle(event);;
}
case SHORTCUT:
Index: gui/gtk.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gtk.cpp,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -b -r1.172 -r1.173
--- gui/gtk.cpp 15 Apr 2008 09:58:45 -0000 1.172
+++ gui/gtk.cpp 23 Apr 2008 11:43:47 -0000 1.173
@@ -1828,9 +1828,7 @@
// GNASH_REPORT_FUNCTION;
Gui *obj = static_cast<Gui *>(data);
- float xscale = obj->getXScale();
- float yscale = obj->getYScale();
- obj->notify_mouse_moved(int(event->x / xscale), int(event->y / yscale));
+ obj->notify_mouse_moved(event->x, event->y);
return true;
}
Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -b -r1.152 -r1.153
--- gui/gui.cpp 22 Apr 2008 20:45:13 -0000 1.152
+++ gui/gui.cpp 23 Apr 2008 11:43:48 -0000 1.153
@@ -76,15 +76,15 @@
_xid(0),
_width(1),
_height(1),
- _xscale(1.0f),
- _yscale(1.0f),
_depth(16),
_interval(0),
_renderer(NULL),
_redraw_flag(true),
_fullscreen(false),
_mouseShown(true),
- _maxAdvances(0)
+ _maxAdvances(0),
+ _xscale(1.0f),
+ _yscale(1.0f)
#ifdef GNASH_FPS_DEBUG
,fps_counter(0)
,fps_counter_total(0)
@@ -115,15 +115,15 @@
_xid(xid),
_width(1),
_height(1),
- _xscale(scale),
- _yscale(scale),
_depth(depth),
_interval(0),
_renderer(NULL),
_redraw_flag(true),
_fullscreen(false),
_mouseShown(true),
- _maxAdvances(0)
+ _maxAdvances(0),
+ _xscale(scale),
+ _yscale(scale)
#ifdef GNASH_FPS_DEBUG
,fps_counter(0)
,fps_counter_total(0)
@@ -237,13 +237,13 @@
float swfwidth = _movieDef->get_width_pixels();
float swfheight = _movieDef->get_height_pixels();
- // set new scale value
+ // set new scale value ( user-pixel / pseudo-pixel )
_xscale = width / swfwidth;
_yscale = height / swfheight;
// always scale proportionally
if (_xscale < _yscale) _yscale = _xscale;
- if (_yscale < _xscale) _xscale = _yscale;
+ else if (_yscale < _xscale) _xscale = _yscale;
_renderer->set_scale(_xscale, _yscale);
}
@@ -359,7 +359,7 @@
void
-Gui::notify_mouse_moved(int x, int y)
+Gui::notify_mouse_moved(int ux, int uy)
{
movie_root* m = _stage;
@@ -367,9 +367,16 @@
if ( _stopped ) return;
+ // A stage pseudopixel is user pixel / _xscale wide
+ float x = ux / _xscale;
+
+ // A stage pseudopixel is user pixel / _xscale high
+ float y = uy / _yscale;
+
#ifdef DEBUG_MOUSE_COORDINATES
log_debug(_("mouse @ %d,%d"), x, y);
#endif
+
if ( m->notify_mouse_moved(x, y) )
{
// any action triggered by the
@@ -395,8 +402,8 @@
}
#ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
- _xpointer = x;
- _ypointer = y;
+ _xpointer = ux;
+ _ypointer = uy;
#endif
@@ -849,18 +856,6 @@
return false;
}
-float
-Gui::getXScale()
-{
- return _xscale;
-}
-
-float
-Gui::getYScale()
-{
- return _yscale;
-}
-
bool
Gui::loops()
{
Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -b -r1.87 -r1.88
--- gui/gui.h 14 Apr 2008 08:55:29 -0000 1.87
+++ gui/gui.h 23 Apr 2008 11:43:48 -0000 1.88
@@ -183,12 +183,6 @@
virtual double getScreenDPI() { return 0; }
virtual std::string getScreenColor() { return ""; }
- /// @return The value to which the movie width should be scaled.
- float getXScale();
-
- /// @return The value to which the movie height should be scaled.
- float getYScale();
-
/// @return Whether or not the movie should be looped indefinitely.
bool loops();
@@ -197,8 +191,8 @@
/// Mouse notification callback to be called when the mouse is moved.
//
- /// @param x The mouse coordinate X component in pixels.
- /// @param y The mouse coordinate Y component in pixels.
+ /// @param x The mouse coordinate X component in user/window coordinate
space (pixels).
+ /// @param y The mouse coordinate Y component in user/window coordinate
space (pixels).
///
void notify_mouse_moved(int x, int y);
@@ -394,10 +388,6 @@
/// Desired window height.
int _height;
- /// The window width scale.
- float _xscale;
- /// The window height scale.
- float _yscale;
/// Desired colour depth in bits.
int _depth;
/// Main loop interval: the time between successive advance_movie calls.
@@ -416,6 +406,12 @@
private:
+ /// Width of a window pixel, in stage pseudopixel units.
+ float _xscale;
+
+ /// Height of a window pixel, in stage pseudopixel units.
+ float _yscale;
+
bool display(movie_root* m);
#ifdef GNASH_FPS_DEBUG
Index: gui/kde.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/kde.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- gui/kde.cpp 22 Mar 2008 04:57:22 -0000 1.30
+++ gui/kde.cpp 23 Apr 2008 11:43:48 -0000 1.31
@@ -423,10 +423,7 @@
assert(_godfather);
QPoint position = event->pos();
- int newX = static_cast<int> (position.x() / _godfather->getXScale());
- int newY = static_cast<int> (position.y() / _godfather->getYScale());
-
- _godfather->notify_mouse_moved(newX, newY);
+ _godfather->notify_mouse_moved(position.x(), position.y());
}
qwidget::qwidget(KdeGui* godfather)
Index: gui/sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/sdl.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- gui/sdl.cpp 26 Mar 2008 10:37:22 -0000 1.66
+++ gui/sdl.cpp 23 Apr 2008 11:43:48 -0000 1.67
@@ -84,7 +84,7 @@
if (event.motion.x == x_old && event.motion.y == y_old) {
break; }
x_old = event.motion.x;
y_old = event.motion.y;
- notify_mouse_moved((int) (x_old / _xscale), (int) (y_old /
_yscale));
+ notify_mouse_moved(x_old, y_old);
break;
case SDL_MOUSEBUTTONDOWN:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/fb.cpp gui/fltk.cpp gui/gtk...,
Sandro Santilli <=