summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-13 18:59:32 +0000
committerrubidium <rubidium@openttd.org>2008-04-13 18:59:32 +0000
commitc36d613b9b3ee12ef1a72d490721d15c19ea8ed5 (patch)
tree824e4d13e659dbfa24588266e3c12764d3ac6181 /src/window.cpp
parent5a6014d7e364016a9a09d19f3f33912d47e80ae8 (diff)
downloadopenttd-c36d613b9b3ee12ef1a72d490721d15c19ea8ed5.tar.xz
(svn r12692) -Codechange: swap to functions to remove a function declaration.
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp72
1 files changed, 33 insertions, 39 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 28c2c1a36..7fe896993 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -250,33 +250,6 @@ static void DispatchMouseWheelEvent(Window *w, int widget, int wheel)
}
}
-static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right, int bottom);
-
-/**
- * From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
- * These windows should be re-painted.
- * @param left Left edge of the rectangle that should be repainted
- * @param top Top edge of the rectangle that should be repainted
- * @param right Right edge of the rectangle that should be repainted
- * @param bottom Bottom edge of the rectangle that should be repainted
- */
-void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
-{
- Window* const *wz;
- DrawPixelInfo bk;
- _cur_dpi = &bk;
-
- FOR_ALL_WINDOWS(wz) {
- const Window *w = *wz;
- if (right > w->left &&
- bottom > w->top &&
- left < w->left + w->width &&
- top < w->top + w->height) {
- DrawOverlappedWindow(wz, left, top, right, bottom);
- }
- }
-}
-
/**
* Generate repaint events for the visible part of window *wz within the rectangle.
*
@@ -288,8 +261,6 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
* @param top Top edge of the rectangle that should be repainted
* @param right Right edge of the rectangle that should be repainted
* @param bottom Bottom edge of the rectangle that should be repainted
- *
- * @todo Swap this function to above DrawOverlappedWindowForAll() to eliminate the forward declaration
*/
static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right, int bottom)
{
@@ -333,16 +304,39 @@ static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right
}
}
- {
- DrawPixelInfo *dp = _cur_dpi;
- dp->width = right - left;
- dp->height = bottom - top;
- dp->left = left - (*wz)->left;
- dp->top = top - (*wz)->top;
- dp->pitch = _screen.pitch;
- dp->dst_ptr = BlitterFactoryBase::GetCurrentBlitter()->MoveTo(_screen.dst_ptr, left, top);
- dp->zoom = ZOOM_LVL_NORMAL;
- CallWindowEventNP(*wz, WE_PAINT);
+ DrawPixelInfo *dp = _cur_dpi;
+ dp->width = right - left;
+ dp->height = bottom - top;
+ dp->left = left - (*wz)->left;
+ dp->top = top - (*wz)->top;
+ dp->pitch = _screen.pitch;
+ dp->dst_ptr = BlitterFactoryBase::GetCurrentBlitter()->MoveTo(_screen.dst_ptr, left, top);
+ dp->zoom = ZOOM_LVL_NORMAL;
+ CallWindowEventNP(*wz, WE_PAINT);
+}
+
+/**
+ * From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
+ * These windows should be re-painted.
+ * @param left Left edge of the rectangle that should be repainted
+ * @param top Top edge of the rectangle that should be repainted
+ * @param right Right edge of the rectangle that should be repainted
+ * @param bottom Bottom edge of the rectangle that should be repainted
+ */
+void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
+{
+ Window* const *wz;
+ DrawPixelInfo bk;
+ _cur_dpi = &bk;
+
+ FOR_ALL_WINDOWS(wz) {
+ const Window *w = *wz;
+ if (right > w->left &&
+ bottom > w->top &&
+ left < w->left + w->width &&
+ top < w->top + w->height) {
+ DrawOverlappedWindow(wz, left, top, right, bottom);
+ }
}
}