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