summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-06-28 16:54:25 +0000
committerfrosch <frosch@openttd.org>2015-06-28 16:54:25 +0000
commit240bf9f551bb26d547c581795c3b754c2072b5ed (patch)
treeebfd850e223e82a5ed722b84c6046afbc2001769
parent2e2b35c73362a036731f1a862bee00f571331635 (diff)
downloadopenttd-240bf9f551bb26d547c581795c3b754c2072b5ed.tar.xz
(svn r27324) -Fix: Remove corner-case optimisation for line drawing, which failed for dashed lines. (noticed by adf88)
-rw-r--r--src/gfx.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 79d46e23e..26d8b6670 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -175,20 +175,9 @@ static inline void GfxDoDrawLine(void *video, int x, int y, int x2, int y2, int
assert(width > 0);
- if (y2 == y) {
- /* Special case: horizontal line. */
- blitter->DrawLine(video,
- Clamp(x, 0, screen_width), y,
- Clamp(x2, 0, screen_width), y2,
- screen_width, screen_height, colour, width, dash);
- return;
- }
- if (x2 == x) {
- /* Special case: vertical line. */
- blitter->DrawLine(video,
- x, Clamp(y, 0, screen_height),
- x2, Clamp(y2, 0, screen_height),
- screen_width, screen_height, colour, width, dash);
+ if (y2 == y || x2 == x) {
+ /* Special case: horizontal/vertical line. All checks already done in GfxPreprocessLine. */
+ blitter->DrawLine(video, x, y, x2, y2, screen_width, screen_height, colour, width, dash);
return;
}