|
Last change
on this file since 2089 was 405, checked in by hugh, 26 years ago |
|
Fixed bug in locked region handling
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #include "rectangle.h"
|
|---|
| 2 |
|
|---|
| 3 | DDRectangle::DDRectangle ( Coord y1,
|
|---|
| 4 | Coord x1,
|
|---|
| 5 | Coord y2,
|
|---|
| 6 | Coord x2 )
|
|---|
| 7 | {
|
|---|
| 8 | lTop = y1;
|
|---|
| 9 | lLeft = x1;
|
|---|
| 10 | lBottom = y2;
|
|---|
| 11 | lRight = x2;
|
|---|
| 12 | pMemPtr = 0;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | IBase::Boolean DDRectangle::operator == ( const DDRectangle &aRect ) const
|
|---|
| 16 | {
|
|---|
| 17 | return ( lTop == aRect.lTop && lLeft == aRect.lLeft
|
|---|
| 18 | &&
|
|---|
| 19 | lBottom == aRect.lBottom && lRight == aRect.lRight);
|
|---|
| 20 | }
|
|---|
| 21 | IBase::Boolean DDRectangle::operator != ( const DDRectangle& aRect ) const
|
|---|
| 22 | {
|
|---|
| 23 | return !( *this == aRect );
|
|---|
| 24 | }
|
|---|
| 25 | IBase::Boolean DDRectangle::intersects ( const DDRectangle &aRect ) const
|
|---|
| 26 | {
|
|---|
| 27 | return ( lTop < aRect.lBottom && lLeft<aRect.lRight
|
|---|
| 28 | &&
|
|---|
| 29 | aRect.lTop < lBottom && aRect.lLeft < lRight );
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | DDRectangle::Coord DDRectangle::width ( ) const
|
|---|
| 33 | {
|
|---|
| 34 | return ( lRight - lLeft);
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | DDRectangle::Coord DDRectangle::height ( ) const
|
|---|
| 38 | {
|
|---|
| 39 | return ( lBottom - lTop);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | DDRectangle::Coord DDRectangle::Top() const
|
|---|
| 43 | {
|
|---|
| 44 | return lTop;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | DDRectangle::Coord DDRectangle::Left() const
|
|---|
| 48 | {
|
|---|
| 49 | return lLeft;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | DDRectangle::Coord DDRectangle::Bottom() const
|
|---|
| 53 | {
|
|---|
| 54 | return lBottom;
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | DDRectangle::Coord DDRectangle::Right() const
|
|---|
| 58 | {
|
|---|
| 59 | return lRight;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | void DDRectangle::SetMemPtr(void* NewMemPtr)
|
|---|
| 63 | {
|
|---|
| 64 | pMemPtr = NewMemPtr;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | void* DDRectangle::GetMemPtr()
|
|---|
| 68 | {
|
|---|
| 69 | return pMemPtr;
|
|---|
| 70 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.