Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * * License, v. 2.0. If a copy of the MPL was not distributed with this
3 : * * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef RegionBuilder_h__
6 : #define RegionBuilder_h__
7 :
8 : #include <nsTArray.h>
9 :
10 : template <typename RegionType>
11 1055 : class RegionBuilder
12 : {
13 : public:
14 : typedef typename RegionType::RectType RectType;
15 :
16 1055 : RegionBuilder()
17 1055 : {}
18 :
19 407 : void OrWith(const RectType& aRect) {
20 407 : pixman_box32_t box = { aRect.x, aRect.y, aRect.XMost(), aRect.YMost() };
21 407 : mRects.AppendElement(box);
22 407 : }
23 :
24 1055 : RegionType ToRegion() const {
25 1055 : return RegionType(mRects);
26 : }
27 :
28 : private:
29 : nsTArray<pixman_box32_t> mRects;
30 : };
31 :
32 : #endif // RegionBuilder_h__
|