/usr/include/OpenLayer/OlRectangle.hpp is in libopenlayer-dev 2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #ifndef OL_INTERNAL_RECT
#define OL_INTERNAL_RECT
#include <cmath>
#include "Declspec.hpp"
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
namespace ol {
// Internal rectangle class //
template< typename Type >
class OL_LIB_DECLSPEC OlRectangle {
public:
OlRectangle( Type x = 0.0, Type y = 0.0, Type w = 0.0, Type h = 0.0 ) : x( x ), y( y ), w( w ), h( h ) {}
OlRectangle ClippedTo( const OlRectangle &rect ) const {
OlRectangle returnVal;
if( rect.x < 0 ) {
returnVal.x = 0;
returnVal.w = std::max( std::min( w, rect.x + rect.w ), Type( 0 ));
}
else {
returnVal.x = x + rect.x;
returnVal.w = std::max( std::min( w - rect.x, rect.w ), Type( 0 ));
}
if( rect.y < 0 ) {
returnVal.y = 0;
returnVal.h = std::max( std::min( h, rect.y + rect.h ), Type( 0 ));
}
else {
returnVal.y = y + rect.y;
returnVal.h = std::max( std::min( h - rect.y, rect.h ), Type( 0 ));
}
return returnVal;
}
Type x, y, w, h;
};
}
#endif // OL_INTERNAL_RECT
|