82 template <TInt S> |
82 template <TInt S> |
83 class RWsRegionBuf : public RRegionBuf<S> |
83 class RWsRegionBuf : public RRegionBuf<S> |
84 { |
84 { |
85 public: |
85 public: |
86 inline RWsRegionBuf() {} |
86 inline RWsRegionBuf() {} |
87 inline ~RWsRegionBuf() { WS_ASSERT_DEBUG(TRegion::iCount == 0, EWsPanicInvalidRegion); } |
87 inline ~RWsRegionBuf() { WS_ASSERT_DEBUG(RRegionBuf<S>::iCount == 0, EWsPanicInvalidRegion); } |
88 inline void Close() { ASSERT(0); } //Do not use, use Reset instead. |
88 inline void Close() { ASSERT(0); } //Do not use, use Reset instead. |
89 inline void Clear() { ASSERT(0); } //Do not use, use Reset instead. |
89 inline void Clear() { ASSERT(0); } //Do not use, use Reset instead. |
90 inline void Reset() |
90 inline void Reset() |
91 { |
91 { |
92 //If iAllocedRects >= 0, then this instance is no longer an RRegionBuf, but has been |
92 //If iAllocedRects >= 0, then this instance is no longer an RRegionBuf, but has been |
93 //converted into an RRegion as explained in the class comment for the RRegionBuf class. |
93 //converted into an RRegion as explained in the class comment for the RRegionBuf class. |
94 |
94 |
95 //Clear will set iCount to 0 and, if iAllocedRects>0, free heap memory and set iAllocedRects to 0. |
95 //Clear will set iCount to 0 and, if iAllocedRects>0, free heap memory and set iAllocedRects to 0. |
96 RRegionBuf<S>::Clear(); |
96 RRegionBuf<S>::Clear(); |
97 |
97 |
98 if(TRegion::iAllocedRects >= 0) |
98 if(RRegionBuf<S>::iAllocedRects >= 0) |
99 { |
99 { |
100 //The magic in the next statement reverts this instance back into an RRegionBuf. |
100 //The magic in the next statement reverts this instance back into an RRegionBuf. |
101 //(The code is the same as can be found in the initialiser list of RRegionBuf's default constructor.) |
101 //(The code is the same as can be found in the initialiser list of RRegionBuf's default constructor.) |
102 TRegion::iAllocedRects = -S&(~TRegion::ERRegionBuf); |
102 RRegionBuf<S>::iAllocedRects = -S&(~TRegion::ERRegionBuf); |
103 } |
103 } |
104 } |
104 } |
105 }; |
105 }; |
106 |
106 |
107 // Leave specific log message |
107 // Leave specific log message |