1 // Scintilla source code edit control 2 /** @file IntegerRectangle.h 3 ** A rectangle with integer coordinates. 4 **/ 5 // Copyright 2018 by Neil Hodgson <[email protected]> 6 // The License.txt file describes the conditions under which this software may be distributed. 7 8 #ifndef INTEGERRECTANGLE_H 9 #define INTEGERRECTANGLE_H 10 11 namespace Scintilla { 12 13 struct IntegerRectangle { 14 int left; 15 int top; 16 int right; 17 int bottom; 18 IntegerRectangleIntegerRectangle19 explicit IntegerRectangle(PRectangle rc) noexcept : 20 left(static_cast<int>(rc.left)), top(static_cast<int>(rc.top)), 21 right(static_cast<int>(rc.right)), bottom(static_cast<int>(rc.bottom)) { 22 } WidthIntegerRectangle23 int Width() const noexcept { return right - left; } HeightIntegerRectangle24 int Height() const noexcept { return bottom - top; } 25 }; 26 27 } 28 29 #endif 30