提交 fb68fe89 编写于 作者: S Smirnov Egor 提交者: rogday

bring back bounds check and switch to floor

上级 b335fe67
......@@ -1787,8 +1787,8 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
GdkEventMotion* event_motion = (GdkEventMotion*)event;
cv_event = CV_EVENT_MOUSEMOVE;
pt32f.x = cvRound(event_motion->x);
pt32f.y = cvRound(event_motion->y);
pt32f.x = cvFloor(event_motion->x);
pt32f.y = cvFloor(event_motion->y);
state = event_motion->state;
}
else if( event->type == GDK_BUTTON_PRESS ||
......@@ -1796,8 +1796,8 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
event->type == GDK_2BUTTON_PRESS )
{
GdkEventButton* event_button = (GdkEventButton*)event;
pt32f.x = cvRound(event_button->x);
pt32f.y = cvRound(event_button->y);
pt32f.x = cvFloor(event_button->x);
pt32f.y = cvFloor(event_button->y);
if( event_button->type == GDK_BUTTON_PRESS )
......@@ -1874,8 +1874,8 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
pt = cvPointFrom32f( pt32f );
}
// if((unsigned)pt.x < (unsigned)(image_widget->original_image->width) &&
// (unsigned)pt.y < (unsigned)(image_widget->original_image->height) )
if((unsigned)pt.x < (unsigned)(image_widget->original_image->width) &&
(unsigned)pt.y < (unsigned)(image_widget->original_image->height) )
{
flags |= BIT_MAP(state, GDK_SHIFT_MASK, CV_EVENT_FLAG_SHIFTKEY) |
BIT_MAP(state, GDK_CONTROL_MASK, CV_EVENT_FLAG_CTRLKEY) |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册