diff --git a/aegisub/src/spline.cpp b/aegisub/src/spline.cpp index ccc754ce3..594cd801d 100644 --- a/aegisub/src/spline.cpp +++ b/aegisub/src/spline.cpp @@ -98,7 +98,7 @@ void Spline::DecodeFromASS(wxString str) { // Prepare char command = 'm'; - Vector2D pt; + Vector2D pt(0, 0); // Tokenize the string wxStringTokenizer tkn(str, " "); diff --git a/aegisub/src/spline_curve.h b/aegisub/src/spline_curve.h index 0bd38c435..99f60acf0 100644 --- a/aegisub/src/spline_curve.h +++ b/aegisub/src/spline_curve.h @@ -62,7 +62,7 @@ public: /// DOCME CurveType type; - SplineCurve(Vector2D p1 = Vector2D()); + SplineCurve(Vector2D p1 = Vector2D(0, 0)); SplineCurve(Vector2D p1, Vector2D p2); SplineCurve(Vector2D p1, Vector2D p2, Vector2D p3, Vector2D p4); diff --git a/aegisub/src/vector2d.cpp b/aegisub/src/vector2d.cpp index 66ff49c08..8fb9477b7 100644 --- a/aegisub/src/vector2d.cpp +++ b/aegisub/src/vector2d.cpp @@ -31,6 +31,12 @@ #include #endif +Vector2D::Vector2D() +: x(std::numeric_limits::min()) +, y(std::numeric_limits::min()) +{ +} + Vector2D operator *(float f, Vector2D v) { return Vector2D(v.X() * f, v.Y() * f); } @@ -74,11 +80,7 @@ Vector2D Vector2D::Round(float step) const { } Vector2D::operator unspecified_bool_type() const { - return *this == Bad() ? 0 : &Vector2D::x; -} - -Vector2D Vector2D::Bad() { - return Vector2D(std::numeric_limits::min(), std::numeric_limits::min()); + return *this == Vector2D() ? 0 : &Vector2D::x; } wxString Vector2D::PStr(char sep) const { diff --git a/aegisub/src/vector2d.h b/aegisub/src/vector2d.h index 7301477e8..7f3d6e283 100644 --- a/aegisub/src/vector2d.h +++ b/aegisub/src/vector2d.h @@ -42,7 +42,7 @@ public: float X() const { return x; } float Y() const { return y; } - Vector2D() : x(0), y(0) { } + Vector2D(); Vector2D(float x, float y) : x(x), y(y) { } Vector2D(wxPoint pt) : x(pt.x), y(pt.y) { } Vector2D(Vector2D x, Vector2D y) : x(x.x), y(y.y) { } @@ -87,7 +87,6 @@ public: wxString DStr(char sep = ',') const; static Vector2D FromAngle(float angle) { return Vector2D(cos(-angle), sin(-angle)); } - static Vector2D Bad(); }; Vector2D operator * (float f, Vector2D v); diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 4cc9b2a05..99c015637 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -98,7 +98,6 @@ VideoDisplay::VideoDisplay( , con(c) , w(8) , h(8) -, mouse_pos(Vector2D::Bad()) , viewport_left(0) , viewport_width(0) , viewport_bottom(0) @@ -353,7 +352,7 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) { } void VideoDisplay::OnMouseLeave(wxMouseEvent& event) { - mouse_pos = Vector2D::Bad(); + mouse_pos = Vector2D(); tool->OnMouseEvent(event); } diff --git a/aegisub/src/visual_feature.cpp b/aegisub/src/visual_feature.cpp index 4e5a7032d..9ef017a23 100644 --- a/aegisub/src/visual_feature.cpp +++ b/aegisub/src/visual_feature.cpp @@ -40,9 +40,7 @@ #include "visual_feature.h" VisualDraggableFeature::VisualDraggableFeature() -: start(Vector2D::Bad()) -, type(DRAG_NONE) -, pos(Vector2D::Bad()) +: type(DRAG_NONE) , layer(0) , line(0) { diff --git a/aegisub/src/visual_tool.cpp b/aegisub/src/visual_tool.cpp index 918ef9b0c..e41ab2299 100644 --- a/aegisub/src/visual_tool.cpp +++ b/aegisub/src/visual_tool.cpp @@ -192,7 +192,7 @@ void VisualTool::OnMouseEvent(wxMouseEvent &event) { bool need_render = false; if (event.Leaving()) { - mouse_pos = Vector2D::Bad(); + mouse_pos = Vector2D(); parent->Render(); return; } @@ -392,7 +392,7 @@ static Vector2D vec_or_bad(param_vec tag, size_t x_idx, size_t y_idx) { (*tag)[x_idx]->omitted || (*tag)[y_idx]->omitted || (*tag)[x_idx]->GetType() == VARDATA_NONE || (*tag)[y_idx]->GetType() == VARDATA_NONE) { - return Vector2D::Bad(); + return Vector2D(); } return Vector2D((*tag)[x_idx]->Get(), (*tag)[y_idx]->Get()); } @@ -525,7 +525,7 @@ void VisualToolBase::GetLineClip(AssDialogue *diag, Vector2D &p1, Vector2D &p2, p2 = vec_or_bad(tag, 2, 3); } else { - p1 = Vector2D(); + p1 = Vector2D(0, 0); p2 = script_res - 1; } } diff --git a/aegisub/src/visual_tool_rotatez.cpp b/aegisub/src/visual_tool_rotatez.cpp index f280e0a00..a716273d8 100644 --- a/aegisub/src/visual_tool_rotatez.cpp +++ b/aegisub/src/visual_tool_rotatez.cpp @@ -59,7 +59,7 @@ void VisualToolRotateZ::Draw() { // Draw the circle gl.SetLineColour(colour[0]); gl.SetFillColour(colour[1], 0.3f); - gl.DrawRing(Vector2D(), radius + 4, radius - 4); + gl.DrawRing(Vector2D(0, 0), radius + 4, radius - 4); // Draw markers around circle int markers = 6; @@ -67,7 +67,7 @@ void VisualToolRotateZ::Draw() { float markEnd = markStart + (180.f / markers); for (int i = 0; i < markers; ++i) { float angle = i * (360.f / markers); - gl.DrawRing(Vector2D(), radius+30, radius+12, 1.0, angle+markStart, angle+markEnd); + gl.DrawRing(Vector2D(0, 0), radius+30, radius+12, 1.0, angle+markStart, angle+markEnd); } // Draw the baseline through the origin showing current rotation diff --git a/aegisub/src/visual_tool_scale.cpp b/aegisub/src/visual_tool_scale.cpp index 111c3a09c..2995bec50 100644 --- a/aegisub/src/visual_tool_scale.cpp +++ b/aegisub/src/visual_tool_scale.cpp @@ -100,7 +100,7 @@ void VisualToolScale::UpdateHold() { if (shift_down) delta = delta.SingleAxis(); - scale = Vector2D().Max(delta * 1.25f + initial_scale); + scale = Vector2D(0, 0).Max(delta * 1.25f + initial_scale); if (ctrl_down) scale = scale.Round(25.f);