From 70511b762c2ab4e789a7e8b6c4b30c50108cb1c9 Mon Sep 17 00:00:00 2001 From: skyjake Date: Wed, 24 Apr 2013 10:12:15 +0300 Subject: [PATCH] Refactor: Rectangle<> separate size type, Rectanglei uses unsigned size Coherently using unsigned ints for sizes when dealing with integer vectors and rectangles. Sizes can never be negative. --- doomsday/client/src/ui/clientwindow.cpp | 2 +- .../libdeng2/include/de/data/numbervalue.h | 1 + doomsday/libdeng2/include/de/rectangle.h | 37 ++++++++++--------- .../libdeng2/include/de/widgets/rootwidget.h | 7 +++- doomsday/libdeng2/src/data/numbervalue.cpp | 4 ++ doomsday/libdeng2/src/widgets/rootwidget.cpp | 10 ++--- doomsday/libgui/include/de/gui/canvas.h | 13 ++++++- doomsday/libgui/include/de/gui/canvaswindow.h | 4 +- doomsday/libgui/src/canvas.cpp | 7 ++-- .../libgui/src/persistentcanvaswindow.cpp | 6 +-- .../libshell/include/de/shell/textcanvas.h | 10 ++--- .../include/de/shell/textrootwidget.h | 2 +- doomsday/libshell/src/lineeditwidget.cpp | 2 +- doomsday/libshell/src/logwidget.cpp | 4 +- doomsday/libshell/src/textcanvas.cpp | 31 +++++++++------- doomsday/libshell/src/textrootwidget.cpp | 4 +- .../shell/shell-gui/src/qtrootwidget.cpp | 6 +-- .../tools/shell/shell-text/src/cursesapp.cpp | 8 ++-- .../shell/shell-text/src/cursestextcanvas.cpp | 4 +- 19 files changed, 94 insertions(+), 68 deletions(-) diff --git a/doomsday/client/src/ui/clientwindow.cpp b/doomsday/client/src/ui/clientwindow.cpp index 71afa297b6..a94362f67c 100644 --- a/doomsday/client/src/ui/clientwindow.cpp +++ b/doomsday/client/src/ui/clientwindow.cpp @@ -306,7 +306,7 @@ void ClientWindow::canvasGLResized(Canvas &canvas) { LOG_AS("ClientWindow"); - Vector2i size = canvas.size(); + Canvas::Size size = canvas.size(); LOG_DEBUG("Canvas resized to ") << size.asText(); // Tell the widgets. diff --git a/doomsday/libdeng2/include/de/data/numbervalue.h b/doomsday/libdeng2/include/de/data/numbervalue.h index c42c94f9c9..8c3de9a8ec 100644 --- a/doomsday/libdeng2/include/de/data/numbervalue.h +++ b/doomsday/libdeng2/include/de/data/numbervalue.h @@ -56,6 +56,7 @@ class DENG2_PUBLIC NumberValue : public Value NumberValue(Number initialValue = 0, SemanticHints semantic = Generic); NumberValue(dsize initialSize); NumberValue(dint initialInteger); + NumberValue(duint initialUnsignedInteger); NumberValue(bool initialBoolean); /** diff --git a/doomsday/libdeng2/include/de/rectangle.h b/doomsday/libdeng2/include/de/rectangle.h index e39acf96cb..52e50f465d 100644 --- a/doomsday/libdeng2/include/de/rectangle.h +++ b/doomsday/libdeng2/include/de/rectangle.h @@ -34,41 +34,44 @@ namespace de { * * @ingroup math */ -template +template class Rectangle { public: - typedef VectorType Corner; + typedef Rectangle RectangleType; + typedef CornerVectorType Corner; + typedef SizeVectorType Size; typedef typename Corner::ValueType Type; - typedef VectorType Size; + typedef typename Size::ValueType SizeType; public: Rectangle() {} - Rectangle(Type left, Type top, Type width, Type height) + Rectangle(Type left, Type top, SizeType width, SizeType height) : topLeft(left, top), bottomRight(left + width, top + height) {} Rectangle(Corner const &tl, Corner const &br) : topLeft(tl), bottomRight(br) {} - Type width() const { return abs(bottomRight.x - topLeft.x); } - Type height() const { return abs(bottomRight.y - topLeft.y); } + SizeType width() const { return abs(bottomRight.x - topLeft.x); } + SizeType height() const { return abs(bottomRight.y - topLeft.y); } Size size() const { return Size(width(), height()); } - void moveTopLeft(VectorType const &point) { + void moveTopLeft(CornerVectorType const &point) { Size s = size(); topLeft = point; - bottomRight = point + s; + bottomRight.x = point.x + s.x; + bottomRight.y = point.y + s.y; } - void setWidth(Type w) { bottomRight.x = topLeft.x + w; } - void setHeight(Type h) { bottomRight.y = topLeft.y + h; } - void setSize(Vector2 const &s) { setWidth(s.x); setHeight(s.y); } + void setWidth(SizeType w) { bottomRight.x = topLeft.x + w; } + void setHeight(SizeType h) { bottomRight.y = topLeft.y + h; } + void setSize(SizeVectorType const &s) { setWidth(s.x); setHeight(s.y); } void include(Corner const &point) { topLeft = topLeft.min(point); bottomRight = bottomRight.max(point); } - Rectangle adjusted(VectorType const &tl, VectorType const &br) const { - return Rectangle(topLeft + tl, bottomRight + br); + RectangleType adjusted(CornerVectorType const &tl, CornerVectorType const &br) const { + return RectangleType(topLeft + tl, bottomRight + br); } bool contains(Corner const &point) const { return point >= topLeft && point <= bottomRight; } - bool operator == (Rectangle const &other) const { + bool operator == (RectangleType const &other) const { return topLeft == other.topLeft && bottomRight == other.bottomRight; } String asText() const { @@ -107,9 +110,9 @@ class Rectangle }; // Common types. -typedef Rectangle Rectanglei; -typedef Rectangle Rectangleui; -typedef Rectangle Rectanglef; +typedef Rectangle Rectanglei; +typedef Rectangle Rectangleui; +typedef Rectangle Rectanglef; } // namespace de diff --git a/doomsday/libdeng2/include/de/widgets/rootwidget.h b/doomsday/libdeng2/include/de/widgets/rootwidget.h index e790e145c4..2725f658da 100644 --- a/doomsday/libdeng2/include/de/widgets/rootwidget.h +++ b/doomsday/libdeng2/include/de/widgets/rootwidget.h @@ -40,10 +40,13 @@ class Rule; */ class DENG2_PUBLIC RootWidget : public Widget { +public: + typedef Vector2ui Size; + public: RootWidget(); - Vector2i viewSize() const; + Size viewSize() const; Rule const &viewLeft() const; Rule const &viewRight() const; @@ -57,7 +60,7 @@ class DENG2_PUBLIC RootWidget : public Widget * * @param viewSize View size. */ - virtual void setViewSize(Vector2i const &viewSize); + virtual void setViewSize(Size const &viewSize); /** * Sets the focus widget. It is the first widget to be offered input diff --git a/doomsday/libdeng2/src/data/numbervalue.cpp b/doomsday/libdeng2/src/data/numbervalue.cpp index 6dee527fb6..ba4a6c9904 100644 --- a/doomsday/libdeng2/src/data/numbervalue.cpp +++ b/doomsday/libdeng2/src/data/numbervalue.cpp @@ -38,6 +38,10 @@ NumberValue::NumberValue(dint initialInteger) : _value(initialInteger), _semantic(Generic) {} +NumberValue::NumberValue(duint initialUnsignedInteger) + : _value(initialUnsignedInteger), _semantic(Generic) +{} + NumberValue::NumberValue(bool initialBoolean) : _value(initialBoolean? True : False), _semantic(Boolean) {} diff --git a/doomsday/libdeng2/src/widgets/rootwidget.cpp b/doomsday/libdeng2/src/widgets/rootwidget.cpp index c6c9873e72..6af8dc8f33 100644 --- a/doomsday/libdeng2/src/widgets/rootwidget.cpp +++ b/doomsday/libdeng2/src/widgets/rootwidget.cpp @@ -41,17 +41,17 @@ DENG2_PIMPL_NOREF(RootWidget) delete viewRect; } - Vector2i viewSize() const + Size viewSize() const { - return Vector2i(de::floor(viewRect->right().value()), - de::floor(viewRect->bottom().value())); + return Size(de::max(0, de::floor(viewRect->right().value())), + de::max(0, de::floor(viewRect->bottom().value()))); } }; RootWidget::RootWidget() : Widget(), d(new Instance) {} -Vector2i RootWidget::viewSize() const +RootWidget::Size RootWidget::viewSize() const { return d->viewSize(); } @@ -86,7 +86,7 @@ Rule const &RootWidget::viewHeight() const return d->viewRect->bottom(); } -void RootWidget::setViewSize(Vector2i const &size) +void RootWidget::setViewSize(Size const &size) { d->viewRect->setInput(Rule::Right, Const(size.x)); d->viewRect->setInput(Rule::Bottom, Const(size.y)); diff --git a/doomsday/libgui/include/de/gui/canvas.h b/doomsday/libgui/include/de/gui/canvas.h index e0995076b4..e04d560b46 100644 --- a/doomsday/libgui/include/de/gui/canvas.h +++ b/doomsday/libgui/include/de/gui/canvas.h @@ -22,10 +22,12 @@ #include #include +#include #include #include "../KeyEventSource" #include "../MouseEventSource" +#include "../GLTarget" namespace de { @@ -46,6 +48,8 @@ class LIBGUI_PUBLIC Canvas : public QGLWidget, public KeyEventSource, public Mou Q_OBJECT public: + typedef Vector2ui Size; + /** * Notified when the canvas is ready for GL operations. The OpenGL context * and drawing surface are not ready to be used before that. The @@ -111,7 +115,7 @@ class LIBGUI_PUBLIC Canvas : public QGLWidget, public KeyEventSource, public Mou /** * Returns the size of the canvas in pixels. */ - Vector2i size() const; + Size size() const; /** * When the mouse is trapped, all mouse input is grabbed, the mouse cursor @@ -134,6 +138,13 @@ class LIBGUI_PUBLIC Canvas : public QGLWidget, public KeyEventSource, public Mou */ void copyAudiencesFrom(Canvas const &other); + /** + * Returns a render target that renders to this canvas. + * + * @return GL render target. + */ + GLTarget &renderTarget() const; + protected: void initializeGL(); void resizeGL(int w, int h); diff --git a/doomsday/libgui/include/de/gui/canvaswindow.h b/doomsday/libgui/include/de/gui/canvaswindow.h index 05b99edda6..097c08d7bf 100644 --- a/doomsday/libgui/include/de/gui/canvaswindow.h +++ b/doomsday/libgui/include/de/gui/canvaswindow.h @@ -47,7 +47,7 @@ class LIBGUI_PUBLIC CanvasWindow : public QMainWindow, Q_OBJECT public: - typedef Vector2i Size; + typedef Vector2ui Size; public: CanvasWindow(); @@ -64,7 +64,7 @@ class LIBGUI_PUBLIC CanvasWindow : public QMainWindow, */ inline Vector2i pos() const { return Vector2i(x(), y()); } - inline Vector2i size() const { return Vector2i(width(), height()); } + inline Size size() const { return Size(de::max(0, width()), de::max(0, height())); } /** * Determines the current width of window's Canvas in pixels. diff --git a/doomsday/libgui/src/canvas.cpp b/doomsday/libgui/src/canvas.cpp index 7e679c4189..3b4c9e8b17 100644 --- a/doomsday/libgui/src/canvas.cpp +++ b/doomsday/libgui/src/canvas.cpp @@ -43,9 +43,10 @@ static const int MOUSE_WHEEL_CONTINUOUS_THRESHOLD_MS = 100; DENG2_PIMPL(Canvas) { + GLTarget target; CanvasWindow *parent; bool readyNotified; - Vector2i currentSize; + Size currentSize; bool mouseDisabled; bool mouseGrabbed; #ifdef WIN32 @@ -199,7 +200,7 @@ GLuint Canvas::grabAsTexture(QSize const &outputSize) QGLContext::LinearFilteringBindOption); } -Vector2i Canvas::size() const +Canvas::Size Canvas::size() const { return d->currentSize; } @@ -248,7 +249,7 @@ void Canvas::initializeGL() void Canvas::resizeGL(int w, int h) { - Vector2i newSize(w, h); + Size newSize(max(0, w), max(0, h)); // Only react if this is actually a resize. if(d->currentSize != newSize) diff --git a/doomsday/libgui/src/persistentcanvaswindow.cpp b/doomsday/libgui/src/persistentcanvaswindow.cpp index 81d4fa5411..7b058a4f16 100644 --- a/doomsday/libgui/src/persistentcanvaswindow.cpp +++ b/doomsday/libgui/src/persistentcanvaswindow.cpp @@ -50,7 +50,7 @@ static QRect desktopRect() return QApplication::desktop()->screenGeometry(); } -static QRect centeredQRect(Vector2i size) +static QRect centeredQRect(Vector2ui const &size) { QSize screenSize = desktopRect().size(); @@ -63,7 +63,7 @@ static QRect centeredQRect(Vector2i size) QSize(size.x, size.y)); } -static Rectanglei centeredRect(Vector2i size) +static Rectanglei centeredRect(Vector2ui const &size) { QRect rect = centeredQRect(size); return Rectanglei(rect.left(), rect.top(), rect.width(), rect.height()); @@ -217,7 +217,7 @@ DENG2_PIMPL(PersistentCanvasWindow) ArrayValue &fs = config.geta(configName("fullSize")); if(fs.size() >= 2) { - fullSize = Vector2i(fs.at(0).asNumber(), fs.at(1).asNumber()); + fullSize = Size(fs.at(0).asNumber(), fs.at(1).asNumber()); } colorDepthBits = config.geti(configName("colorDepth")); diff --git a/doomsday/libshell/include/de/shell/textcanvas.h b/doomsday/libshell/include/de/shell/textcanvas.h index be2e0eac3d..e26dbe1e8f 100644 --- a/doomsday/libshell/include/de/shell/textcanvas.h +++ b/doomsday/libshell/include/de/shell/textcanvas.h @@ -52,7 +52,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Alignment) class LIBSHELL_PUBLIC TextCanvas { public: - typedef Vector2i Size; + typedef Vector2ui Size; typedef Vector2i Coord; struct Char @@ -164,9 +164,9 @@ class LIBSHELL_PUBLIC TextCanvas void fill(Rectanglei const &rect, Char const &ch); - void put(Vector2i const &pos, Char const &ch); + void put(Coord const &pos, Char const &ch); - void drawText(Vector2i const &pos, String const &text, + void drawText(Coord const &pos, String const &text, Char::Attribs const &attribs = Char::DefaultAttributes, int richOffset = 0); @@ -180,7 +180,7 @@ class LIBSHELL_PUBLIC TextCanvas * @param attribs Character attributes. * @param lineAlignment Alignment for lines. */ - void drawWrappedText(Vector2i const &pos, String const &text, LineWrapping const &wraps, + void drawWrappedText(Coord const &pos, String const &text, LineWrapping const &wraps, Char::Attribs const &attribs = Char::DefaultAttributes, Alignment lineAlignment = AlignLeft); @@ -212,7 +212,7 @@ class LIBSHELL_PUBLIC TextCanvas * * @param pos Position. */ - virtual void setCursorPosition(Vector2i const &pos); + virtual void setCursorPosition(Coord const &pos); private: DENG2_PRIVATE(d) diff --git a/doomsday/libshell/include/de/shell/textrootwidget.h b/doomsday/libshell/include/de/shell/textrootwidget.h index 589b953012..4b9bc447f1 100644 --- a/doomsday/libshell/include/de/shell/textrootwidget.h +++ b/doomsday/libshell/include/de/shell/textrootwidget.h @@ -58,7 +58,7 @@ class LIBSHELL_PUBLIC TextRootWidget : public RootWidget * * @param viewSize New size. */ - void setViewSize(Vector2i const &viewSize); + void setViewSize(Size const &viewSize); TextWidget *focus() const; diff --git a/doomsday/libshell/src/lineeditwidget.cpp b/doomsday/libshell/src/lineeditwidget.cpp index bab5221d6a..2c6e44a56a 100644 --- a/doomsday/libshell/src/lineeditwidget.cpp +++ b/doomsday/libshell/src/lineeditwidget.cpp @@ -81,7 +81,7 @@ DENG2_PIMPL(LineEditWidget) */ void updateWrapsAndHeight() { - wraps.wrapTextToWidth(text, de::max(1, self.rule().recti().width() - prompt.size() - 1)); + wraps.wrapTextToWidth(text, de::max(1, int(self.rule().recti().width()) - int(prompt.size()) - 1)); height->set(wraps.height()); } diff --git a/doomsday/libshell/src/logwidget.cpp b/doomsday/libshell/src/logwidget.cpp index 521cbbb726..7f48e46d1b 100644 --- a/doomsday/libshell/src/logwidget.cpp +++ b/doomsday/libshell/src/logwidget.cpp @@ -94,7 +94,7 @@ DENG2_PIMPL(LogWidget) { Sink sink; MonospaceLogSinkFormatter formatter; - int cacheWidth; + unsigned int cacheWidth; QList cache; ///< Indices match entry indices in sink. int maxEntries; int visibleOffset; @@ -240,7 +240,7 @@ void LogWidget::draw() LogEntry const &entry = d->sink.entry(idx); QList lines = d->formatter.logEntryToTextLines(entry); - TextCanvas *buf = new TextCanvas(Vector2i(pos.width(), lines.size())); + TextCanvas *buf = new TextCanvas(Vector2ui(pos.width(), lines.size())); d->cache.append(buf); TextCanvas::Char::Attribs attribs = (entry.flags() & LogEntry::Remote? diff --git a/doomsday/libshell/src/textcanvas.cpp b/doomsday/libshell/src/textcanvas.cpp index 4e2d669983..66dc23bc32 100644 --- a/doomsday/libshell/src/textcanvas.cpp +++ b/doomsday/libshell/src/textcanvas.cpp @@ -38,7 +38,7 @@ DENG2_PIMPL_NOREF(TextCanvas) Instance(Size const &initialSize) : size(initialSize) { // Allocate lines based on supplied initial size. - for(int row = 0; row < size.y; ++row) + for(duint row = 0; row < size.y; ++row) { lines.append(makeLine()); } @@ -52,6 +52,11 @@ DENG2_PIMPL_NOREF(TextCanvas) } } + dsize lineCount() const + { + return lines.size(); + } + Char *makeLine() { return new Char[size.x]; @@ -62,16 +67,16 @@ DENG2_PIMPL_NOREF(TextCanvas) if(newSize == size) return; // Allocate or free lines. - while(newSize.y < lines.size()) + while(newSize.y < lineCount()) { lines.removeLast(); } - while(newSize.y > lines.size()) + while(newSize.y > lineCount()) { lines.append(makeLine()); } - Q_ASSERT(lines.size() == newSize.y); + Q_ASSERT(lineCount() == newSize.y); size.y = newSize.y; // Make sure all lines are the correct width. @@ -91,7 +96,7 @@ DENG2_PIMPL_NOREF(TextCanvas) for(int row = 0; row < lines.size(); ++row) { Char *line = lines[row]; - for(int col = 0; col < size.x; ++col) + for(duint col = 0; col < size.x; ++col) { Char &c = line[col]; if(markDirty) @@ -141,7 +146,7 @@ int TextCanvas::height() const Rectanglei TextCanvas::rect() const { - return Rectanglei(Vector2i(0, 0), size()); + return Rectanglei(0, 0, size().x, size().y); } void TextCanvas::resize(Size const &newSize) @@ -161,9 +166,9 @@ TextCanvas::Char const &TextCanvas::at(Coord const &pos) const return d->lines[pos.y][pos.x]; } -bool TextCanvas::isValid(const Coord &pos) const +bool TextCanvas::isValid(Coord const &pos) const { - return (pos.x >= 0 && pos.y >= 0 && pos.x < d->size.x && pos.y < d->size.y); + return (pos.x >= 0 && pos.y >= 0 && pos.x < int(d->size.x) && pos.y < int(d->size.y)); } void TextCanvas::markDirty() @@ -173,7 +178,7 @@ void TextCanvas::markDirty() void TextCanvas::clear(Char const &ch) { - fill(Rectanglei(Vector2i(0, 0), d->size), ch); + fill(Rectanglei(0, 0, d->size.x, d->size.y), ch); } void TextCanvas::fill(Rectanglei const &rect, Char const &ch) @@ -253,14 +258,14 @@ void TextCanvas::drawLineRect(Rectanglei const &rect, Char::Attribs const &attri Char const vEdge ('|', attribs); // Horizontal edges. - for(int x = 1; x < rect.width() - 1; ++x) + for(duint x = 1; x < rect.width() - 1; ++x) { put(rect.topLeft + Vector2i(x, 0), hEdge); put(rect.bottomLeft() + Vector2i(x, -1), hEdge); } // Vertical edges. - for(int y = 1; y < rect.height() - 1; ++y) + for(duint y = 1; y < rect.height() - 1; ++y) { put(rect.topLeft + Vector2i(0, y), vEdge); put(rect.topRight() + Vector2i(-1, y), vEdge); @@ -274,9 +279,9 @@ void TextCanvas::drawLineRect(Rectanglei const &rect, Char::Attribs const &attri void TextCanvas::draw(TextCanvas const &canvas, Coord const &topLeft) { - for(int y = 0; y < canvas.d->size.y; ++y) + for(duint y = 0; y < canvas.d->size.y; ++y) { - for(int x = 0; x < canvas.d->size.x; ++x) + for(duint x = 0; x < canvas.d->size.x; ++x) { Coord const xy(x, y); Coord const p = topLeft + xy; diff --git a/doomsday/libshell/src/textrootwidget.cpp b/doomsday/libshell/src/textrootwidget.cpp index 7629eb120a..147d093291 100644 --- a/doomsday/libshell/src/textrootwidget.cpp +++ b/doomsday/libshell/src/textrootwidget.cpp @@ -38,10 +38,10 @@ TextCanvas &TextRootWidget::rootCanvas() return *_canvas; } -void TextRootWidget::setViewSize(Vector2i const &viewSize) +void TextRootWidget::setViewSize(Size const &viewSize) { // Shouldn't go below 1 x 1. - Vector2i vs = viewSize.max(Vector2i(1, 1)); + Size vs = viewSize.max(Size(1, 1)); _canvas->resize(vs); RootWidget::setViewSize(vs); } diff --git a/doomsday/tools/shell/shell-gui/src/qtrootwidget.cpp b/doomsday/tools/shell/shell-gui/src/qtrootwidget.cpp index 635ca3818f..ae4b07f79c 100644 --- a/doomsday/tools/shell/shell-gui/src/qtrootwidget.cpp +++ b/doomsday/tools/shell/shell-gui/src/qtrootwidget.cpp @@ -54,7 +54,7 @@ DENG2_PIMPL(QtRootWidget) Instance(Public &inst) : Base(inst), margin(4), - canvas(new QtTextCanvas(Vector2i(1, 1))), + canvas(new QtTextCanvas(Vector2ui(1, 1))), root(canvas), blinkTimer(0), cursorTimer(0), @@ -82,11 +82,9 @@ DENG2_PIMPL(QtRootWidget) if(!charSize.x || !charSize.y) return; // Determine number of characters that fits in the new size. - Vector2i size((widthPx - 2*margin) / charSize.x, (heightPx - 2*margin) / charSize.y); + Vector2ui size((widthPx - 2*margin) / charSize.x, (heightPx - 2*margin) / charSize.y); root.setViewSize(size); - //origin = QPoint((widthPx - canvas->image().width()) / 2, - // (heightPx - canvas->image().height()) / 2); origin = QPoint(margin, heightPx - canvas->image().height() - margin); } }; diff --git a/doomsday/tools/shell/shell-text/src/cursesapp.cpp b/doomsday/tools/shell/shell-text/src/cursesapp.cpp index 68f803d113..39599a4e8b 100644 --- a/doomsday/tools/shell/shell-text/src/cursesapp.cpp +++ b/doomsday/tools/shell/shell-text/src/cursesapp.cpp @@ -64,9 +64,9 @@ static QByteArray runSystemCommand(char const *cmd) * * @return Terminal columns and rows. */ -static de::Vector2i actualTerminalSize(de::Vector2i const &oldSize) +static de::Vector2ui actualTerminalSize(de::Vector2ui const &oldSize) { - de::Vector2i size = oldSize; + de::Vector2ui size = oldSize; QByteArray result = runSystemCommand("stty size"); QTextStream is(result); is >> size.y >> size.x; @@ -80,7 +80,7 @@ DENG2_PIMPL(CursesApp) // Curses state: WINDOW *rootWin; - de::Vector2i rootSize; + de::Vector2ui rootSize; int unicodeContinuation; TextRootWidget *rootWidget; @@ -160,7 +160,7 @@ DENG2_PIMPL(CursesApp) void handleResize() { // Terminal has been resized. - de::Vector2i size = actualTerminalSize(rootSize); + de::Vector2ui size = actualTerminalSize(rootSize); // Curses needs to resize its buffers. werase(rootWin); diff --git a/doomsday/tools/shell/shell-text/src/cursestextcanvas.cpp b/doomsday/tools/shell/shell-text/src/cursestextcanvas.cpp index e584957b03..3b25aa5ad5 100644 --- a/doomsday/tools/shell/shell-text/src/cursestextcanvas.cpp +++ b/doomsday/tools/shell/shell-text/src/cursestextcanvas.cpp @@ -43,11 +43,11 @@ void CursesTextCanvas::show() Size const dims = size(); // All dirty characters are drawn. - for(int row = 0; row < dims.y; ++row) + for(de::duint row = 0; row < dims.y; ++row) { bool needMove = true; - for(int col = 0; col < dims.x; ++col) + for(de::duint col = 0; col < dims.x; ++col) { Coord const pos(col, row); Char const &ch = at(pos);