X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b33fe0222417a1599876ef82c969c322a8a0556..809934d22ad2e97d67655ecb4b06b29b5d2a361d:/src/generic/plot.cpp diff --git a/src/generic/plot.cpp b/src/generic/plot.cpp index 825f5fbbb6..9d363e9880 100644 --- a/src/generic/plot.cpp +++ b/src/generic/plot.cpp @@ -126,8 +126,8 @@ void wxPlotArea::OnMouse( wxMouseEvent &event ) view_x *= wxPLOT_SCROLL_STEP; view_y *= wxPLOT_SCROLL_STEP; - int x = event.GetX(); - int y = event.GetY(); + wxCoord x = event.GetX(); + wxCoord y = event.GetY(); x += view_x; y += view_y; @@ -141,7 +141,7 @@ void wxPlotArea::OnMouse( wxMouseEvent &event ) double end = curve->GetEndY(); wxCoord offset_y = curve->GetOffsetY(); - double dy = (end - curve->GetY( x/m_owner->GetZoom() )) / range; + double dy = (end - curve->GetY( (wxInt32)(x/m_owner->GetZoom()) )) / range; wxCoord curve_y = (wxCoord)(dy * double_client_height) - offset_y - 1; if ((y-curve_y < 4) && (y-curve_y > -4)) @@ -196,8 +196,6 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to ) if (to == -1) to = view_x + client_width; - to += 2; // no idea why this is needed - double zoom = m_owner->GetZoom(); int start_x = wxMax( from, (int)floor(curve->GetStartX()*zoom) ); @@ -206,6 +204,8 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to ) start_x = wxMax( view_x, start_x ); end_x = wxMin( view_x + client_width, end_x ); + end_x++; + double double_client_height = (double)client_height; double range = curve->GetEndY() - curve->GetStartY(); double end = curve->GetEndY(); @@ -214,7 +214,7 @@ void wxPlotArea::DrawCurve( wxDC *dc, wxPlotCurve *curve, int from, int to ) wxCoord y=0,last_y=0; for (int x = start_x; x < end_x; x++) { - double dy = (end - curve->GetY( x/zoom )) / range; + double dy = (end - curve->GetY( (wxInt32)(x/zoom) )) / range; y = (wxCoord)(dy * double_client_height) - offset_y - 1; if (x != start_x) @@ -310,8 +310,8 @@ void wxPlotXAxisArea::OnMouse( wxMouseEvent &event ) view_x *= wxPLOT_SCROLL_STEP; view_y *= wxPLOT_SCROLL_STEP; - int x = event.GetX(); - int y = event.GetY(); + wxCoord x = event.GetX(); + wxCoord y = event.GetY(); x += view_x; y += view_y; @@ -760,7 +760,7 @@ void wxPlotWindow::SetZoom( double zoom ) } SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP, (int)((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0, - (int)view_x*zoom/old_zoom, 0, + (int)(view_x*zoom/old_zoom), 0, TRUE ); RedrawXAxis(); @@ -780,7 +780,7 @@ void wxPlotWindow::ResetScrollbar() } SetScrollbars( wxPLOT_SCROLL_STEP, wxPLOT_SCROLL_STEP, - ((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1, 0 ); + (int)(((max*m_xZoom)/wxPLOT_SCROLL_STEP)+1), 0 ); } void wxPlotWindow::RedrawXAxis()