Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/nsRegion.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
8
#ifndef nsRegion_h__
9
#define nsRegion_h__
10
11
#include <stddef.h>                     // for size_t
12
#include <stdint.h>                     // for uint32_t, uint64_t
13
#include <sys/types.h>                  // for int32_t
14
#include <ostream>                      // for std::ostream
15
#include "nsCoord.h"                    // for nscoord
16
#include "nsError.h"                    // for nsresult
17
#include "nsPoint.h"                    // for nsIntPoint, nsPoint
18
#include "nsRect.h"                     // for mozilla::gfx::IntRect, nsRect
19
#include "nsRectAbsolute.h"
20
#include "nsMargin.h"                   // for nsIntMargin
21
#include "nsRegionFwd.h"                // for nsIntRegion
22
#include "nsString.h"                   // for nsCString
23
#include "xpcom-config.h"               // for CPP_THROW_NEW
24
#include "mozilla/ArrayView.h"          // for ArrayView
25
#include "mozilla/Move.h"               // for mozilla::Move
26
#include "mozilla/gfx/MatrixFwd.h"      // for mozilla::gfx::Matrix4x4
27
#include "mozilla/gfx/Logging.h"
28
#include "nsTArray.h"
29
30
#include "pixman.h"
31
32
// Uncomment this line to get additional integrity checking.
33
//#define DEBUG_REGIONS
34
#ifdef DEBUG_REGIONS
35
#include <sstream>
36
#endif
37
38
/* For information on the internal representation look at pixman-region.c
39
 *
40
 * This replaces an older homebrew implementation of nsRegion. The
41
 * representation used here may use more rectangles than nsRegion however, the
42
 * representation is canonical.  This means that there's no need for an
43
 * Optimize() method because for a paticular region there is only one
44
 * representation. This means that nsIntRegion will have more predictable
45
 * performance characteristics than the old nsRegion and should not become
46
 * degenerate.
47
 *
48
 * The pixman region code originates from X11 which has spread to a variety of
49
 * projects including Qt, Gtk, Wine. It should perform reasonably well.
50
 */
51
52
enum class VisitSide {
53
  TOP,
54
  BOTTOM,
55
  LEFT,
56
  RIGHT
57
};
58
59
namespace regiondetails {
60
struct Band;
61
}
62
63
template<>
64
struct nsTArray_CopyChooser<regiondetails::Band>
65
{
66
  typedef nsTArray_CopyWithConstructors<regiondetails::Band> Type;
67
};
68
69
namespace regiondetails {
70
71
template<typename T, typename E>
72
class UncheckedArray : public T
73
{
74
public:
75
  using T::Elements;
76
  using T::Length;
77
78
0
  E & operator[](size_t aIndex) { return Elements()[aIndex]; }
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::operator[](unsigned long)
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::operator[](unsigned long)
79
0
  const E& operator[](size_t aIndex) const { return Elements()[aIndex]; }
80
0
  E& LastElement() { return Elements()[Length() - 1]; }
81
0
  const E& LastElement() const { return Elements()[Length() - 1]; }
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::LastElement() const
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::LastElement() const
82
83
  using iterator = E* ;
84
  using const_iterator = const E*;
85
86
0
  iterator begin() { return iterator(Elements()); }
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::begin()
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::begin()
87
0
  const_iterator begin() const { return const_iterator(Elements()); }
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::begin() const
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::begin() const
88
  const_iterator cbegin() const { return begin(); }
89
0
  iterator end() { return iterator(Elements() + Length()); }
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::end()
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::end()
90
0
  const_iterator end() const { return const_iterator(Elements() + Length()); }
Unexecuted instantiation: regiondetails::UncheckedArray<AutoTArray<regiondetails::Strip, 2ul>, regiondetails::Strip>::end() const
Unexecuted instantiation: regiondetails::UncheckedArray<nsTArray<regiondetails::Band>, regiondetails::Band>::end() const
91
  const_iterator cend() const { return end(); }
92
};
93
94
struct Strip
95
{
96
  // Default constructor should never be called, but is required for
97
  // vector::resize to compile.
98
0
  Strip() { MOZ_CRASH(); }
99
0
  Strip(int32_t aLeft, int32_t aRight) : left(aLeft), right(aRight) {}
100
101
  bool operator != (const Strip& aOther) const
102
0
  {
103
0
    return left != aOther.left || right != aOther.right;
104
0
  }
105
106
  uint32_t Size() const
107
  {
108
    return right - left;
109
  }
110
111
  int32_t left;
112
  int32_t right;
113
};
114
115
struct Band
116
{
117
  using Strip = regiondetails::Strip;
118
#ifndef DEBUG
119
  using StripArray = regiondetails::UncheckedArray<AutoTArray<Strip, 2>, Strip>;
120
#else
121
  using StripArray = AutoTArray<Strip, 2>;
122
#endif
123
124
  MOZ_IMPLICIT Band(const nsRectAbsolute& aRect)
125
    : top(aRect.Y()), bottom(aRect.YMost())
126
0
  {
127
0
    mStrips.AppendElement(Strip{ aRect.X(), aRect.XMost() });
128
0
  }
129
130
  Band(const Band& aOther)
131
    : top(aOther.top), bottom(aOther.bottom)
132
    , mStrips(aOther.mStrips)
133
0
  {}
134
  Band(const Band&& aOther)
135
    : top(aOther.top), bottom(aOther.bottom)
136
    , mStrips(std::move(aOther.mStrips))
137
0
  {}
138
139
  void InsertStrip(const Strip& aStrip)
140
0
  {
141
0
    for (size_t i = 0; i < mStrips.Length(); i++) {
142
0
      Strip& strip = mStrips[i];
143
0
      if (strip.left > aStrip.right) {
144
0
        // Current strip is beyond aStrip, insert aStrip before.
145
0
        mStrips.InsertElementAt(i, aStrip);
146
0
        return;
147
0
      }
148
0
149
0
      if (strip.right < aStrip.left) {
150
0
        // Current strip is before aStrip, try the next.
151
0
        continue;
152
0
      }
153
0
154
0
      // Current strip intersects with aStrip, extend to the lext.
155
0
      strip.left = std::min(strip.left, aStrip.left);
156
0
157
0
      if (strip.right >= aStrip.right) {
158
0
        // Current strip extends beyond aStrip, done.
159
0
        return;
160
0
      }
161
0
162
0
      size_t next = i;
163
0
      next++;
164
0
      // Consume any subsequent strips intersecting with aStrip.
165
0
      while (next < mStrips.Length() && mStrips[next].left <= aStrip.right) {
166
0
        strip.right = mStrips[next].right;
167
0
168
0
        mStrips.RemoveElementAt(next);
169
0
      }
170
0
171
0
      // Extend the strip in case the aStrip goes on beyond it.
172
0
      strip.right = std::max(strip.right, aStrip.right);
173
0
      return;
174
0
    }
175
0
    mStrips.AppendElement(aStrip);
176
0
  }
177
178
  void SubStrip(const Strip& aStrip)
179
0
  {
180
0
    for (size_t i = 0; i < mStrips.Length(); i++) {
181
0
      Strip& strip = mStrips[i];
182
0
      if (strip.left > aStrip.right) {
183
0
        // Strip is entirely to the right of aStrip. Done.
184
0
        return;
185
0
      }
186
0
187
0
      if (strip.right < aStrip.left) {
188
0
        // Strip is entirely to the left of aStrip. Move on.
189
0
        continue;
190
0
      }
191
0
192
0
      if (strip.left < aStrip.left) {
193
0
        if (strip.right <= aStrip.right) {
194
0
          strip.right = aStrip.left;
195
0
          // This strip lies to the left of the start of aStrip.
196
0
          continue;
197
0
        }
198
0
199
0
        // aStrip is completely contained by this strip.
200
0
        Strip newStrip(aStrip.right, strip.right);
201
0
        strip.right = aStrip.left;
202
0
        if (i < mStrips.Length()) {
203
0
          i++;
204
0
          mStrips.InsertElementAt(i, newStrip);
205
0
        } else {
206
0
          mStrips.AppendElement(newStrip);
207
0
        }
208
0
        return;
209
0
      }
210
0
211
0
      // This strip lies to the right of the start of aStrip.
212
0
      if (strip.right <= aStrip.right) {
213
0
        // aStrip completely contains this strip.
214
0
        mStrips.RemoveElementAt(i);
215
0
        // Make sure we evaluate the strip now at i. This loop will increment.
216
0
        i--;
217
0
        continue;
218
0
      }
219
0
      strip.left = aStrip.right;
220
0
      return;
221
0
    }
222
0
  }
223
224
  bool Intersects(const Strip& aStrip) const
225
  {
226
    for (const Strip& strip : mStrips) {
227
      if (strip.left >= aStrip.right) {
228
        return false;
229
      }
230
231
      if (strip.right <= aStrip.left) {
232
        continue;
233
      }
234
235
      return true;
236
    }
237
    return false;
238
  }
239
240
  bool IntersectStripBounds(Strip& aStrip) const
241
0
  {
242
0
    bool intersected = false;
243
0
244
0
    int32_t rightMost;
245
0
    for (const Strip& strip : mStrips) {
246
0
      if (strip.left > aStrip.right) {
247
0
        break;
248
0
      }
249
0
250
0
      if (strip.right <= aStrip.left) {
251
0
        continue;
252
0
      }
253
0
254
0
      if (!intersected) {
255
0
        // First intersection, this is where the left side begins.
256
0
        aStrip.left = std::max(aStrip.left, strip.left);
257
0
      }
258
0
259
0
      intersected = true;
260
0
      // Expand to the right for each intersecting strip found.
261
0
      rightMost = std::min(strip.right, aStrip.right);
262
0
    }
263
0
264
0
    if (intersected) {
265
0
      aStrip.right = rightMost;
266
0
    }
267
0
    else {
268
0
      aStrip.right = aStrip.left = 0;
269
0
    }
270
0
    return intersected;
271
0
  }
272
273
  bool ContainsStrip(const Strip& aStrip) const
274
0
  {
275
0
    for (const Strip& strip : mStrips) {
276
0
      if (strip.left > aStrip.left) {
277
0
        return false;
278
0
      }
279
0
280
0
      if (strip.right >= aStrip.right) {
281
0
        return true;
282
0
      }
283
0
    }
284
0
    return false;
285
0
  }
286
287
  bool EqualStrips(const Band& aBand) const
288
0
  {
289
0
    if (mStrips.Length() != aBand.mStrips.Length()) {
290
0
      return false;
291
0
    }
292
0
293
0
    for (auto iter1 = mStrips.begin(), iter2 = aBand.mStrips.begin();
294
0
      iter1 != mStrips.end(); iter1++, iter2++)
295
0
    {
296
0
      if (*iter1 != *iter2) {
297
0
        return false;
298
0
      }
299
0
    }
300
0
301
0
    return true;
302
0
  }
303
304
  void IntersectStrip(const Strip& aStrip)
305
0
  {
306
0
    size_t i = 0;
307
0
308
0
    while (i < mStrips.Length()) {
309
0
      Strip& strip = mStrips[i];
310
0
      if (strip.right <= aStrip.left) {
311
0
        mStrips.RemoveElementAt(i);
312
0
        continue;
313
0
      }
314
0
315
0
      if (strip.left >= aStrip.right) {
316
0
        mStrips.TruncateLength(i);
317
0
        return;
318
0
      }
319
0
320
0
      strip.left = std::max(aStrip.left, strip.left);
321
0
      strip.right = std::min(aStrip.right, strip.right);
322
0
      i++;
323
0
    }
324
0
  }
325
326
  void IntersectStrips(const Band& aOther)
327
  {
328
    auto iter = mStrips.begin();
329
    auto iterOther = aOther.mStrips.begin();
330
331
    StripArray newStrips;
332
333
    // This function finds the intersection between two sets of strips.
334
    while (true) {
335
      while (true) {
336
        while (iter != mStrips.end() && iter->right <= iterOther->left) {
337
          // Increment our current strip until it ends beyond aOther's current strip.
338
          iter++;
339
        }
340
341
        if (iter == mStrips.end()) {
342
          // End of our strips. Done.
343
          break;
344
        }
345
346
        while (iterOther != aOther.mStrips.end() && iterOther->right <= iter->left) {
347
          // Increment aOther's current strip until it lies beyond our current strip.
348
          iterOther++;
349
        }
350
351
        if (iterOther == aOther.mStrips.end()) {
352
          // End of aOther's strips. Done.
353
          break;
354
        }
355
356
        if (iterOther->left < iter->right) {
357
          // Intersection!
358
          break;
359
        }
360
      }
361
362
      if (iter == mStrips.end() || iterOther == aOther.mStrips.end()) {
363
        break;
364
      }
365
366
      newStrips.AppendElement(Strip(std::max(iter->left, iterOther->left), std::min(iterOther->right, iter->right)));
367
368
      if (iterOther->right < iter->right) {
369
        iterOther++;
370
        if (iterOther == aOther.mStrips.end()) {
371
          break;
372
        }
373
      } else {
374
        iter++;
375
      }
376
    }
377
378
    mStrips = newStrips;
379
  }
380
381
  bool Intersects(const Band& aOther) const
382
0
  {
383
0
    auto iter = mStrips.begin();
384
0
    auto iterOther = aOther.mStrips.begin();
385
0
386
0
    // This function finds the intersection between two sets of strips.
387
0
    while (true) {
388
0
      while (true) {
389
0
        while (iter != mStrips.end() && iter->right <= iterOther->left) {
390
0
          // Increment our current strip until it ends beyond aOther's current strip.
391
0
          iter++;
392
0
        }
393
0
394
0
        if (iter == mStrips.end()) {
395
0
          // End of our strips. Done.
396
0
          break;
397
0
        }
398
0
399
0
        while (iterOther != aOther.mStrips.end() && iterOther->right <= iter->left) {
400
0
          // Increment aOther's current strip until it lies beyond our current strip.
401
0
          iterOther++;
402
0
        }
403
0
404
0
        if (iterOther == aOther.mStrips.end()) {
405
0
          // End of aOther's strips. Done.
406
0
          break;
407
0
        }
408
0
409
0
        if (iterOther->left < iter->right) {
410
0
          // Intersection!
411
0
          break;
412
0
        }
413
0
      }
414
0
415
0
      if (iter == mStrips.end()|| iterOther == aOther.mStrips.end()) {
416
0
        break;
417
0
      }
418
0
419
0
      return true;
420
0
    }
421
0
    return false;
422
0
  }
423
424
  void SubStrips(const Band& aOther)
425
0
  {
426
0
    size_t idx = 0;
427
0
    auto iterOther = aOther.mStrips.begin();
428
0
429
0
    // This function finds the intersection between two sets of strips.
430
0
    while (true) {
431
0
      while (true) {
432
0
        while (idx < mStrips.Length() && mStrips[idx].right <= iterOther->left) {
433
0
          // Increment our current strip until it ends beyond aOther's current strip.
434
0
          idx++;
435
0
        }
436
0
437
0
        if (idx == mStrips.Length()) {
438
0
          // End of our strips. Done.
439
0
          break;
440
0
        }
441
0
442
0
        while (iterOther != aOther.mStrips.end() && iterOther->right <= mStrips[idx].left) {
443
0
          // Increment aOther's current strip until it lies beyond our current strip.
444
0
          iterOther++;
445
0
        }
446
0
447
0
        if (iterOther == aOther.mStrips.end()) {
448
0
          // End of aOther's strips. Done.
449
0
          break;
450
0
        }
451
0
452
0
        if (iterOther->left < mStrips[idx].right) {
453
0
          // Intersection!
454
0
          break;
455
0
        }
456
0
      }
457
0
458
0
      if (idx == mStrips.Length() || iterOther == aOther.mStrips.end()) {
459
0
        break;
460
0
      }
461
0
462
0
      if (mStrips[idx].left < iterOther->left) {
463
0
        size_t oldIdx = idx;
464
0
        // Our strip starts beyond other's
465
0
        if (mStrips[idx].right > iterOther->right) {
466
0
          // Our strip ends beyond other's as well.
467
0
          Strip newStrip(mStrips[idx]);
468
0
          newStrip.left = iterOther->right;
469
0
          mStrips.InsertElementAt(idx + 1, newStrip);
470
0
          idx++;
471
0
        }
472
0
        mStrips[oldIdx].right = iterOther->left;
473
0
        // Either idx was just incremented, or the current index no longer intersects with iterOther.
474
0
        continue;
475
0
      } else if (mStrips[idx].right > iterOther->right) {
476
0
        mStrips[idx].left = iterOther->right;
477
0
        // Current strip no longer intersects, continue.
478
0
        iterOther++;
479
0
        if (iterOther == aOther.mStrips.end()) {
480
0
          break;
481
0
        }
482
0
        continue;
483
0
      }
484
0
485
0
      // Our current strip is completely contained by the other strip.
486
0
      mStrips.RemoveElementAt(idx);
487
0
    }
488
0
  }
489
490
  int32_t top;
491
  int32_t bottom;
492
  StripArray mStrips;
493
};
494
}
495
496
class nsRegion
497
{
498
public:
499
  using Band = regiondetails::Band;
500
  using Strip = regiondetails::Strip;
501
#ifndef DEBUG
502
  using BandArray = regiondetails::UncheckedArray<nsTArray<Band>, Band>;
503
  using StripArray = regiondetails::UncheckedArray<AutoTArray<Strip, 2>, Strip>;
504
#else
505
  using BandArray = nsTArray<Band>;
506
  using StripArray = AutoTArray<Strip, 2>;
507
#endif
508
509
  typedef nsRect RectType;
510
  typedef nsPoint PointType;
511
  typedef nsMargin MarginType;
512
513
0
  nsRegion() { }
514
  MOZ_IMPLICIT nsRegion(const nsRect& aRect) {
515
    mBounds = nsRectAbsolute::FromRect(aRect);
516
  }
517
0
  MOZ_IMPLICIT nsRegion(const nsRectAbsolute& aRect) {
518
0
    mBounds = aRect;
519
0
  }
520
  explicit nsRegion(mozilla::gfx::ArrayView<pixman_box32_t> aRects)
521
0
  {
522
0
    for (uint32_t i = 0; i < aRects.Length(); i++) {
523
0
      AddRect(BoxToRect(aRects[i]));
524
0
    }
525
0
  }
526
527
0
  nsRegion(const nsRegion& aRegion) { Copy(aRegion); }
528
0
  nsRegion(nsRegion&& aRegion) { mBands.SwapElements(aRegion.mBands); mBounds = aRegion.mBounds; aRegion.SetEmpty(); }
529
0
  nsRegion& operator =(nsRegion&& aRegion) {
530
0
    mBands.SwapElements(aRegion.mBands);
531
0
    mBounds = aRegion.mBounds;
532
0
    aRegion.SetEmpty();
533
0
    return *this;
534
0
  }
535
  nsRegion& operator =(const nsRect& aRect) { Copy(aRect); return *this; }
536
0
  nsRegion& operator =(const nsRegion& aRegion) { Copy(aRegion); return *this; }
537
  bool operator==(const nsRegion& aRgn) const
538
0
  {
539
0
    return IsEqual(aRgn);
540
0
  }
541
  bool operator!=(const nsRegion& aRgn) const
542
0
  {
543
0
    return !(*this == aRgn);
544
0
  }
545
546
  friend std::ostream& operator<<(std::ostream& stream, const nsRegion& m);
547
  void OutputToStream(std::string aObjName, std::ostream& stream) const;
548
549
  static
550
    nsresult InitStatic()
551
0
  {
552
0
    return NS_OK;
553
0
  }
554
555
  static
556
0
    void ShutdownStatic() {}
557
558
private:
559
#ifdef DEBUG_REGIONS
560
  class OperationStringGenerator
561
  {
562
  public:
563
    virtual ~OperationStringGenerator() {}
564
565
    virtual void OutputOp() = 0;
566
  };
567
#endif
568
public:
569
570
  void AssertStateInternal() const;
571
0
  void AssertState() const {
572
#ifdef DEBUG_REGIONS
573
    AssertStateInternal();
574
#endif
575
  }
576
577
private:
578
  void And(BandArray& aOut, const BandArray& aIn1, const BandArray& aIn2)
579
  {
580
    size_t idx = 0;
581
    size_t idxOther = 0;
582
583
    // This algorithm essentially forms a new list of bands, by iterating over
584
    // both regions' lists of band simultaneously, and building a new band
585
    // wherever the two regions intersect.
586
    while (true) {
587
      while (true) {
588
        while (idx != aIn1.Length() && aIn1[idx].bottom <= aIn2[idxOther].top) {
589
          // Increment our current band until it ends beyond aOther's current band.
590
          idx++;
591
        }
592
593
        if (idx == aIn1.Length()) {
594
          // This region is out of bands, the other region's future bands are ignored.
595
          break;
596
        }
597
598
        while (idxOther != aIn2.Length() && aIn2[idxOther].bottom <= aIn1[idx].top) {
599
          // Increment aOther's current band until it ends beyond our current band.
600
          idxOther++;
601
        }
602
603
        if (idxOther == aIn2.Length()) {
604
          // The other region's bands are all processed, all our future bands are ignored.
605
          break;
606
        }
607
608
        if (aIn2[idxOther].top < aIn1[idx].bottom) {
609
          // We know the other band's bottom lies beyond our band's top because
610
          // otherwise we would've incremented above. Intersecting bands found.
611
          break;
612
        }
613
      }
614
615
      if (idx == aIn1.Length() || idxOther == aIn2.Length()) {
616
        // The above loop executed a break because we're done.
617
        break;
618
      }
619
620
      Band newBand(aIn1[idx]);
621
      // The new band is the intersection of the two current bands from both regions.
622
      newBand.top = std::max(aIn1[idx].top, aIn2[idxOther].top);
623
      newBand.bottom = std::min(aIn1[idx].bottom, aIn2[idxOther].bottom);
624
      newBand.IntersectStrips(aIn2[idxOther]);
625
626
      if (newBand.mStrips.Length()) {
627
        // The intersecting area of the bands had overlapping strips, if it is
628
        // identical to the band above it merge, otherwise append.
629
        if (aOut.Length() && aOut.LastElement().bottom == newBand.top &&
630
          aOut.LastElement().EqualStrips(newBand)) {
631
          aOut.LastElement().bottom = newBand.bottom;
632
        } else {
633
          aOut.AppendElement(std::move(newBand));
634
        }
635
      }
636
637
      if (aIn2[idxOther].bottom < aIn1[idx].bottom) {
638
        idxOther++;
639
        if (idxOther == aIn2.Length()) {
640
          // Since we will access idxOther the next iteration, check if we're not done.
641
          break;
642
        }
643
      } else {
644
        // No need to check here since we do at the beginning of the next iteration.
645
        idx++;
646
      }
647
    }
648
  }
649
650
public:
651
  nsRegion& AndWith(const nsRegion& aRegion)
652
  {
653
#ifdef DEBUG_REGIONS
654
    class OperationStringGeneratorAndWith : public OperationStringGenerator
655
    {
656
    public:
657
      OperationStringGeneratorAndWith(nsRegion& aRegion, const nsRegion& aOtherRegion)
658
        : mRegion(&aRegion), mRegionCopy(aRegion), mOtherRegion(aOtherRegion)
659
      {
660
        aRegion.mCurrentOpGenerator = this;
661
      }
662
      virtual ~OperationStringGeneratorAndWith()
663
      {
664
        mRegion->mCurrentOpGenerator = nullptr;
665
      }
666
667
      virtual void OutputOp() override
668
      {
669
        std::stringstream stream;
670
        mRegionCopy.OutputToStream("r1", stream);
671
        mOtherRegion.OutputToStream("r2", stream);
672
        stream << "r1.AndWith(r2);\n";
673
        gfxCriticalError() << stream.str();
674
      }
675
    private:
676
      nsRegion * mRegion;
677
      nsRegion mRegionCopy;
678
      nsRegion mOtherRegion;
679
    };
680
681
    OperationStringGeneratorAndWith opGenerator(*this, aRegion);
682
#endif
683
    if (mBounds.IsEmpty()) {
684
      // Region is empty, stays empty.
685
      return *this;
686
    }
687
688
    if (aRegion.IsEmpty()) {
689
      SetEmpty();
690
      return *this;
691
    }
692
693
    if (aRegion.mBands.IsEmpty()) {
694
      // Other region is a rect.
695
      return AndWith(aRegion.mBounds);
696
    }
697
698
    if (mBands.IsEmpty()) {
699
      mBands.AppendElement(mBounds);
700
    }
701
702
    BandArray newBands;
703
704
    And(newBands, mBands, aRegion.mBands);
705
706
    mBands = std::move(newBands);
707
    if (!mBands.Length()) {
708
      mBounds = nsRectAbsolute();
709
    } else {
710
      mBounds = CalculateBounds();
711
    }
712
713
    EnsureSimplified();
714
    AssertState();
715
    return *this;
716
  }
717
718
  nsRegion& AndWith(const nsRectAbsolute& aRect)
719
0
  {
720
#ifdef DEBUG_REGIONS
721
    class OperationStringGeneratorAndWith : public OperationStringGenerator
722
    {
723
    public:
724
      OperationStringGeneratorAndWith(nsRegion& aRegion, const nsRectAbsolute& aRect)
725
        : mRegion(&aRegion), mRegionCopy(aRegion), mRect(aRect)
726
      {
727
        aRegion.mCurrentOpGenerator = this;
728
      }
729
      virtual ~OperationStringGeneratorAndWith()
730
      {
731
        mRegion->mCurrentOpGenerator = nullptr;
732
      }
733
734
      virtual void OutputOp() override
735
      {
736
        std::stringstream stream;
737
        mRegionCopy.OutputToStream("r", stream);
738
        stream << "r.AndWith(nsRect(" << mRect.X() << ", " << mRect.Y() << ", " << mRect.Width() << ", " << mRect.Height() << "));\n";
739
        gfxCriticalError() << stream.str();
740
      }
741
    private:
742
      nsRegion * mRegion;
743
      nsRegion mRegionCopy;
744
      nsRectAbsolute mRect;
745
    };
746
747
    OperationStringGeneratorAndWith opGenerator(*this, aRect);
748
#endif
749
0
    if (aRect.IsEmpty()) {
750
0
      SetEmpty();
751
0
      return *this;
752
0
    }
753
0
754
0
    if (mBands.IsEmpty()) {
755
0
      mBounds = mBounds.Intersect(aRect);
756
0
      return *this;
757
0
    }
758
0
759
0
    size_t idx = 0;
760
0
761
0
    size_t removeStart = 0;
762
0
763
0
    // This removes all bands that do not intersect with aRect, and intersects
764
0
    // the remaining ones with aRect.
765
0
766
0
    // Start by figuring out how much to remove from the start.
767
0
    while (idx != mBands.Length() && mBands[idx].bottom <= aRect.Y()) {
768
0
      idx++;
769
0
    }
770
0
771
0
    // We'll remove these later to avoid needless copying in the array.
772
0
    removeStart = idx;
773
0
774
0
    while (idx != mBands.Length()) {
775
0
      if (mBands[idx].top >= aRect.YMost()) {
776
0
        mBands.TruncateLength(idx);
777
0
        break;
778
0
      }
779
0
780
0
      mBands[idx].top = std::max(mBands[idx].top, aRect.Y());
781
0
      mBands[idx].bottom = std::min(mBands[idx].bottom, aRect.YMost());
782
0
783
0
      mBands[idx].IntersectStrip(Strip(aRect.X(), aRect.XMost()));
784
0
785
0
      if (!mBands[idx].mStrips.Length()) {
786
0
        mBands.RemoveElementAt(idx);
787
0
      } else {
788
0
        if (idx > removeStart) {
789
0
          CompressBefore(idx);
790
0
        }
791
0
        idx++;
792
0
      }
793
0
    }
794
0
795
0
    if (removeStart) {
796
0
      mBands.RemoveElementsAt(0, removeStart);
797
0
    }
798
0
799
0
    if (mBands.Length()) {
800
0
      mBounds = CalculateBounds();
801
0
    } else {
802
0
      mBounds.SetEmpty();
803
0
    }
804
0
    EnsureSimplified();
805
0
    AssertState();
806
0
    return *this;
807
0
  }
808
0
  nsRegion& AndWith(const nsRect& aRect) {
809
0
    return AndWith(nsRectAbsolute::FromRect(aRect));
810
0
  }
811
  nsRegion& And(const nsRegion& aRgn1, const nsRegion& aRgn2)
812
  {
813
    if (&aRgn1 == this) {
814
      return AndWith(aRgn2);
815
    }
816
#ifdef DEBUG_REGIONS
817
    class OperationStringGeneratorAnd : public OperationStringGenerator
818
    {
819
    public:
820
      OperationStringGeneratorAnd(nsRegion& aRegion, const nsRegion& aRegion1, const nsRegion& aRegion2)
821
        : mRegion(&aRegion), mRegion1(aRegion1), mRegion2(aRegion2)
822
      {
823
        aRegion.mCurrentOpGenerator = this;
824
      }
825
      virtual ~OperationStringGeneratorAnd()
826
      {
827
        mRegion->mCurrentOpGenerator = nullptr;
828
      }
829
830
      virtual void OutputOp() override
831
      {
832
        std::stringstream stream;
833
        mRegion1.OutputToStream("r1", stream);
834
        mRegion2.OutputToStream("r2", stream);
835
        stream << "nsRegion r3;\nr3.And(r1, r2);\n";
836
        gfxCriticalError() << stream.str();
837
      }
838
    private:
839
      nsRegion * mRegion;
840
      nsRegion mRegion1;
841
      nsRegion mRegion2;
842
    };
843
844
    OperationStringGeneratorAnd opGenerator(*this, aRgn1, aRgn2);
845
#endif
846
    mBands.Clear();
847
848
    if (aRgn1.IsEmpty() || aRgn2.IsEmpty()) {
849
      mBounds.SetEmpty();
850
      return *this;
851
    }
852
853
    if (aRgn1.mBands.IsEmpty() && aRgn2.mBands.IsEmpty()) {
854
      mBounds = aRgn1.mBounds.Intersect(aRgn2.mBounds);
855
      return *this;
856
    } else if (aRgn1.mBands.IsEmpty()) {
857
      return And(aRgn2, aRgn1.mBounds);
858
    } else if (aRgn2.mBands.IsEmpty()) {
859
      return And(aRgn1, aRgn2.mBounds);
860
    }
861
862
    And(mBands, aRgn1.mBands, aRgn2.mBands);
863
864
    if (!mBands.Length()) {
865
      mBounds = nsRectAbsolute();
866
    } else {
867
      mBounds = CalculateBounds();
868
    }
869
870
    EnsureSimplified();
871
    AssertState();
872
    return *this;
873
  }
874
  nsRegion& And(const nsRect& aRect, const nsRegion& aRegion)
875
0
  {
876
0
    return And(aRegion, aRect);
877
0
  }
878
  nsRegion& And(const nsRegion& aRegion, const nsRectAbsolute& aRect)
879
0
  {
880
0
    if (&aRegion == this) {
881
0
      return AndWith(aRect);
882
0
    }
883
#ifdef DEBUG_REGIONS
884
    class OperationStringGeneratorAnd : public OperationStringGenerator
885
    {
886
    public:
887
      OperationStringGeneratorAnd(nsRegion& aThisRegion, const nsRegion& aRegion, const nsRectAbsolute& aRect)
888
        : mThisRegion(&aThisRegion), mRegion(aRegion), mRect(aRect)
889
      {
890
        aThisRegion.mCurrentOpGenerator = this;
891
      }
892
      virtual ~OperationStringGeneratorAnd()
893
      {
894
        mThisRegion->mCurrentOpGenerator = nullptr;
895
      }
896
897
      virtual void OutputOp() override
898
      {
899
        std::stringstream stream;
900
        mRegion.OutputToStream("r", stream);
901
        stream << "nsRegion r2;\nr.And(r2, nsRect(" << mRect.X() << ", " << mRect.Y() << ", " << mRect.Width() << ", " << mRect.Height() << "));\n";
902
        gfxCriticalError() << stream.str();
903
      }
904
    private:
905
      nsRegion* mThisRegion;
906
      nsRegion mRegion;
907
      nsRectAbsolute mRect;
908
    };
909
910
    OperationStringGeneratorAnd opGenerator(*this, aRegion, aRect);
911
#endif
912
0
    mBands.Clear();
913
0
914
0
    if (aRect.IsEmpty()) {
915
0
      mBounds.SetEmpty();
916
0
      return *this;
917
0
    }
918
0
919
0
    if (aRegion.mBands.IsEmpty()) {
920
0
      mBounds = aRegion.mBounds.Intersect(aRect);
921
0
      return *this;
922
0
    }
923
0
924
0
    size_t idx = 0;
925
0
    const BandArray& bands = aRegion.mBands;
926
0
927
0
    mBands.SetCapacity(bands.Length() + 3);
928
0
    while (idx != bands.Length()) {
929
0
      // Ignore anything before.
930
0
      if (bands[idx].bottom <= aRect.Y()) {
931
0
        idx++;
932
0
        continue;
933
0
      }
934
0
      // We're done once we've reached the bottom.
935
0
      if (bands[idx].top >= aRect.YMost()) {
936
0
        break;
937
0
      }
938
0
939
0
      // Now deal with bands actually intersecting the rectangle.
940
0
      Band newBand(bands[idx]);
941
0
      newBand.top = std::max(bands[idx].top, aRect.Y());
942
0
      newBand.bottom = std::min(bands[idx].bottom, aRect.YMost());
943
0
944
0
      newBand.IntersectStrip(Strip(aRect.X(), aRect.XMost()));
945
0
946
0
      if (newBand.mStrips.Length()) {
947
0
        if (!mBands.IsEmpty() &&
948
0
            newBand.top == mBands.LastElement().bottom &&
949
0
            newBand.EqualStrips(mBands.LastElement())) {
950
0
          mBands.LastElement().bottom = newBand.bottom;
951
0
        } else {
952
0
          mBands.AppendElement(std::move(newBand));
953
0
        }
954
0
      }
955
0
      idx++;
956
0
    }
957
0
958
0
    if (mBands.Length()) {
959
0
      mBounds = CalculateBounds();
960
0
    } else {
961
0
      mBounds.SetEmpty();
962
0
    }
963
0
964
0
    EnsureSimplified();
965
0
    AssertState();
966
0
    return *this;
967
0
  }
968
  nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
969
0
  {
970
0
    return And(aRegion, nsRectAbsolute::FromRect(aRect));
971
0
  }
972
  nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
973
0
  {
974
0
    nsRect tmpRect;
975
0
976
0
    tmpRect.IntersectRect(aRect1, aRect2);
977
0
    return Copy(tmpRect);
978
0
  }
979
980
  nsRegion& OrWith(const nsRegion& aOther)
981
0
  {
982
0
    for (RectIterator idx(aOther); !idx.Done(); idx.Next()) {
983
0
      AddRect(idx.GetAbsolute());
984
0
    }
985
0
    return *this;
986
0
  }
987
  nsRegion& OrWith(const nsRect& aOther)
988
0
  {
989
0
    AddRect(nsRectAbsolute::FromRect(aOther));
990
0
    return *this;
991
0
  }
992
  nsRegion& Or(const nsRegion& aRgn1, const nsRegion& aRgn2)
993
  {
994
    if (&aRgn1 != this) {
995
      *this = aRgn1;
996
    }
997
    for (RectIterator idx(aRgn2); !idx.Done(); idx.Next()) {
998
      AddRect(idx.GetAbsolute());
999
    }
1000
    return *this;
1001
  }
1002
  nsRegion& Or(const nsRegion& aRegion, const nsRect& aRect)
1003
  {
1004
    if (&aRegion != this) {
1005
      *this = aRegion;
1006
    }
1007
    AddRect(nsRectAbsolute::FromRect(aRect));
1008
    return *this;
1009
  }
1010
  nsRegion& Or(const nsRect& aRect, const nsRegion& aRegion)
1011
0
  {
1012
0
    return  Or(aRegion, aRect);
1013
0
  }
1014
  nsRegion& Or(const nsRect& aRect1, const nsRect& aRect2)
1015
0
  {
1016
0
    Copy(aRect1);
1017
0
    return Or(*this, aRect2);
1018
0
  }
1019
1020
  nsRegion& XorWith(const nsRegion& aOther)
1021
0
  {
1022
0
    return Xor(*this, aOther);
1023
0
  }
1024
  nsRegion& XorWith(const nsRect& aOther)
1025
0
  {
1026
0
    return Xor(*this, aOther);
1027
0
  }
1028
  nsRegion& Xor(const nsRegion& aRgn1, const nsRegion& aRgn2)
1029
0
  {
1030
0
    // this could be implemented better if pixman had direct
1031
0
    // support for xoring regions.
1032
0
    nsRegion p;
1033
0
    p.Sub(aRgn1, aRgn2);
1034
0
    nsRegion q;
1035
0
    q.Sub(aRgn2, aRgn1);
1036
0
    return Or(p, q);
1037
0
  }
1038
  nsRegion& Xor(const nsRegion& aRegion, const nsRect& aRect)
1039
0
  {
1040
0
    return Xor(aRegion, nsRegion(aRect));
1041
0
  }
1042
  nsRegion& Xor(const nsRect& aRect, const nsRegion& aRegion)
1043
0
  {
1044
0
    return Xor(nsRegion(aRect), aRegion);
1045
0
  }
1046
  nsRegion& Xor(const nsRect& aRect1, const nsRect& aRect2)
1047
0
  {
1048
0
    return Xor(nsRegion(aRect1), nsRegion(aRect2));
1049
0
  }
1050
1051
  nsRegion ToAppUnits(nscoord aAppUnitsPerPixel) const;
1052
1053
  nsRegion& SubWith(const nsRegion& aOther)
1054
0
  {
1055
#ifdef DEBUG_REGIONS
1056
    class OperationStringGeneratorSubWith : public OperationStringGenerator
1057
    {
1058
    public:
1059
      OperationStringGeneratorSubWith(nsRegion& aRegion, const nsRegion& aOtherRegion)
1060
        : mRegion(&aRegion), mRegionCopy(aRegion), mOtherRegion(aOtherRegion)
1061
      {
1062
        aRegion.mCurrentOpGenerator = this;
1063
      }
1064
      virtual ~OperationStringGeneratorSubWith()
1065
      {
1066
        mRegion->mCurrentOpGenerator = nullptr;
1067
      }
1068
1069
      virtual void OutputOp() override
1070
      {
1071
        std::stringstream stream;
1072
        mRegionCopy.OutputToStream("r1", stream);
1073
        mOtherRegion.OutputToStream("r2", stream);
1074
        stream << "r1.SubWith(r2);\n";
1075
        gfxCriticalError() << stream.str();
1076
      }
1077
    private:
1078
      nsRegion * mRegion;
1079
      nsRegion mRegionCopy;
1080
      nsRegion mOtherRegion;
1081
    };
1082
1083
    OperationStringGeneratorSubWith opGenerator(*this, aOther);
1084
#endif
1085
1086
0
    if (mBounds.IsEmpty()) {
1087
0
      return *this;
1088
0
    }
1089
0
1090
0
    if (aOther.mBands.IsEmpty()) {
1091
0
      return SubWith(aOther.mBounds);
1092
0
    }
1093
0
1094
0
    if (mBands.IsEmpty()) {
1095
0
      mBands.AppendElement(Band(mBounds));
1096
0
    }
1097
0
1098
0
    size_t idx = 0;
1099
0
    size_t idxOther = 0;
1100
0
    while (idx < mBands.Length()) {
1101
0
      while (true) {
1102
0
        while (idx != mBands.Length() && mBands[idx].bottom <= aOther.mBands[idxOther].top) {
1103
0
          // Increment our current band until it ends beyond aOther's current band.
1104
0
          idx++;
1105
0
        }
1106
0
1107
0
        if (idx == mBands.Length()) {
1108
0
          // This region is out of bands, the other region's future bands are ignored.
1109
0
          break;
1110
0
        }
1111
0
1112
0
        while (idxOther != aOther.mBands.Length() && aOther.mBands[idxOther].bottom <= mBands[idx].top) {
1113
0
          // Increment aOther's current band until it ends beyond our current band.
1114
0
          idxOther++;
1115
0
        }
1116
0
1117
0
        if (idxOther == aOther.mBands.Length()) {
1118
0
          // The other region's bands are all processed, all our future bands are ignored.
1119
0
          break;
1120
0
        }
1121
0
1122
0
        if (aOther.mBands[idxOther].top < mBands[idx].bottom) {
1123
0
          // We know the other band's bottom lies beyond our band's top because
1124
0
          // otherwise we would've incremented above. Intersecting bands found.
1125
0
          break;
1126
0
        }
1127
0
      }
1128
0
1129
0
      if (idx == mBands.Length() || idxOther == aOther.mBands.Length()) {
1130
0
        // The above loop executed a break because we're done.
1131
0
        break;
1132
0
      }
1133
0
1134
0
      const Band& bandOther = aOther.mBands[idxOther];
1135
0
1136
0
      if (!mBands[idx].Intersects(bandOther)) {
1137
0
        if (mBands[idx].bottom < bandOther.bottom) {
1138
0
          idx++;
1139
0
        } else {
1140
0
          idxOther++;
1141
0
          if (idxOther == aOther.mBands.Length()) {
1142
0
            break;
1143
0
          }
1144
0
        }
1145
0
        continue;
1146
0
      }
1147
0
1148
0
      // These bands actually intersect.
1149
0
      if (mBands[idx].top < bandOther.top) {
1150
0
        mBands.InsertElementAt(idx + 1, Band(mBands[idx]));
1151
0
        mBands[idx].bottom = bandOther.top;
1152
0
        idx++;
1153
0
        mBands[idx].top = bandOther.top;
1154
0
      }
1155
0
1156
0
      // mBands[idx].top >= bandOther.top;
1157
0
      if (mBands[idx].bottom <= bandOther.bottom) {
1158
0
        mBands[idx].SubStrips(bandOther);
1159
0
        if (mBands[idx].mStrips.IsEmpty()) {
1160
0
          mBands.RemoveElementAt(idx);
1161
0
        } else {
1162
0
          CompressBefore(idx);
1163
0
          idx++;
1164
0
          // The band before us just changed, it may be identical now.
1165
0
          CompressBefore(idx);
1166
0
        }
1167
0
        continue;
1168
0
      }
1169
0
1170
0
      // mBands[idx].bottom > bandOther.bottom
1171
0
      Band newBand = mBands[idx];
1172
0
      newBand.SubStrips(bandOther);
1173
0
1174
0
      if (!newBand.mStrips.IsEmpty()) {
1175
0
        mBands.InsertElementAt(idx, newBand);
1176
0
        mBands[idx].bottom = bandOther.bottom;
1177
0
        CompressBefore(idx);
1178
0
        idx++;
1179
0
      }
1180
0
1181
0
      mBands[idx].top = bandOther.bottom;
1182
0
1183
0
      idxOther++;
1184
0
      if (idxOther == aOther.mBands.Length()) {
1185
0
        break;
1186
0
      }
1187
0
    }
1188
0
1189
0
    if (mBands.IsEmpty()) {
1190
0
      mBounds.SetEmpty();
1191
0
    } else {
1192
0
      mBounds = CalculateBounds();
1193
0
    }
1194
0
1195
0
    AssertState();
1196
0
    EnsureSimplified();
1197
0
    return *this;
1198
0
  }
1199
  nsRegion& SubOut(const nsRegion& aOther)
1200
0
  {
1201
0
    return SubWith(aOther);
1202
0
  }
1203
  nsRegion& SubOut(const nsRect& aOther)
1204
0
  {
1205
0
    return SubWith(aOther);
1206
0
  }
1207
1208
private:
1209
  void AppendOrExtend(const Band& aNewBand)
1210
0
  {
1211
0
    if (aNewBand.mStrips.IsEmpty()) {
1212
0
      return;
1213
0
    }
1214
0
    if (mBands.IsEmpty()) {
1215
0
      mBands.AppendElement(aNewBand);
1216
0
      return;
1217
0
    }
1218
0
1219
0
    if (mBands.LastElement().bottom == aNewBand.top && mBands.LastElement().EqualStrips(aNewBand)) {
1220
0
      mBands.LastElement().bottom = aNewBand.bottom;
1221
0
    } else {
1222
0
      mBands.AppendElement(aNewBand);
1223
0
    }
1224
0
  }
1225
  void AppendOrExtend(const Band&& aNewBand)
1226
0
  {
1227
0
    if (aNewBand.mStrips.IsEmpty()) {
1228
0
      return;
1229
0
    }
1230
0
    if (mBands.IsEmpty()) {
1231
0
      mBands.AppendElement(std::move(aNewBand));
1232
0
      return;
1233
0
    }
1234
0
1235
0
    if (mBands.LastElement().bottom == aNewBand.top && mBands.LastElement().EqualStrips(aNewBand)) {
1236
0
      mBands.LastElement().bottom = aNewBand.bottom;
1237
0
    } else {
1238
0
      mBands.AppendElement(std::move(aNewBand));
1239
0
    }
1240
0
  }
1241
public:
1242
  nsRegion& Sub(const nsRegion& aRgn1, const nsRegion& aRgn2)
1243
0
  {
1244
0
    if (&aRgn1 == this) {
1245
0
      return SubWith(aRgn2);
1246
0
    }
1247
#ifdef DEBUG_REGIONS
1248
    class OperationStringGeneratorSub : public OperationStringGenerator
1249
    {
1250
    public:
1251
      OperationStringGeneratorSub(nsRegion& aRegion, const nsRegion& aRgn1, const nsRegion& aRgn2)
1252
        : mRegion(&aRegion), mRegion1(aRgn1), mRegion2(aRgn2)
1253
      {
1254
        aRegion.mCurrentOpGenerator = this;
1255
      }
1256
      virtual ~OperationStringGeneratorSub()
1257
      {
1258
        mRegion->mCurrentOpGenerator = nullptr;
1259
      }
1260
1261
      virtual void OutputOp() override
1262
      {
1263
        std::stringstream stream;
1264
        mRegion1.OutputToStream("r1", stream);
1265
        mRegion2.OutputToStream("r2", stream);
1266
        stream << "nsRegion r3;\nr3.Sub(r1, r2);\n";
1267
        gfxCriticalError() << stream.str();
1268
      }
1269
    private:
1270
      nsRegion* mRegion;
1271
      nsRegion mRegion1;
1272
      nsRegion mRegion2;
1273
    };
1274
1275
    OperationStringGeneratorSub opGenerator(*this, aRgn1, aRgn2);
1276
#endif
1277
1278
0
    mBands.Clear();
1279
0
1280
0
    if (aRgn1.mBounds.IsEmpty()) {
1281
0
      mBounds.SetEmpty();
1282
0
      return *this;
1283
0
    }
1284
0
1285
0
    if (aRgn2.mBounds.IsEmpty()) {
1286
0
      Copy(aRgn1);
1287
0
      return *this;
1288
0
    }
1289
0
1290
0
    if (aRgn1.mBands.IsEmpty() && aRgn2.mBands.IsEmpty()) {
1291
0
      return Sub(aRgn1.mBounds, aRgn2.mBounds);
1292
0
    } else if (aRgn1.mBands.IsEmpty()) {
1293
0
      return Sub(aRgn1.mBounds, aRgn2);
1294
0
    } else if (aRgn2.mBands.IsEmpty()) {
1295
0
      return Sub(aRgn1, aRgn2.mBounds);
1296
0
    }
1297
0
1298
0
    const BandArray& bands1 = aRgn1.mBands;
1299
0
    const BandArray& bands2 = aRgn2.mBands;
1300
0
1301
0
    size_t idx = 0;
1302
0
    size_t idxOther = 0;
1303
0
1304
0
    // We iterate the source region's bands, subtracting the other regions bands from them as we
1305
0
    // move them into ours.
1306
0
    while (idx < bands1.Length()) {
1307
0
      while (idxOther < bands2.Length() && bands2[idxOther].bottom <= bands1[idx].top) {
1308
0
        // These other bands are irrelevant as they don't intersect with the
1309
0
        // band we're currently processing.
1310
0
        idxOther++;
1311
0
      }
1312
0
      if (idxOther == bands2.Length()) {
1313
0
        break;
1314
0
      }
1315
0
1316
0
      const Band& other = bands2[idxOther];
1317
0
1318
0
      // bands2[idxOther].bottom >= bands1[idx].top
1319
0
      Band origBand(bands1[idx]);
1320
0
      if (other.top >= origBand.bottom) {
1321
0
        // No intersecting bands, append and continue.
1322
0
        AppendOrExtend(origBand);
1323
0
        idx++;
1324
0
        continue;
1325
0
      }
1326
0
1327
0
      // Push a band for an uncovered region above our band.
1328
0
      if (origBand.top < other.top) {
1329
0
        Band newBand(origBand);
1330
0
        newBand.bottom = other.top;
1331
0
        AppendOrExtend(std::move(newBand));
1332
0
      }
1333
0
1334
0
      int32_t lastBottom = std::max(other.top, origBand.top);
1335
0
      while (idxOther < bands2.Length() && bands2[idxOther].top < origBand.bottom) {
1336
0
        const Band& other = bands2[idxOther];
1337
0
        Band newBand(origBand);
1338
0
        newBand.top = std::max(origBand.top, other.top);
1339
0
        newBand.bottom = std::min(origBand.bottom, other.bottom);
1340
0
1341
0
        // If there was a gap, we need to add the original band there.
1342
0
        if (newBand.top > lastBottom) {
1343
0
          Band betweenBand(newBand);
1344
0
          betweenBand.top = lastBottom;
1345
0
          betweenBand.bottom = newBand.top;
1346
0
          AppendOrExtend(std::move(betweenBand));
1347
0
        }
1348
0
1349
0
        lastBottom = newBand.bottom;
1350
0
        newBand.SubStrips(other);
1351
0
        AppendOrExtend(std::move(newBand));
1352
0
        idxOther++;
1353
0
      }
1354
0
      // Decrement other here so we are back at the last band in region 2
1355
0
      // that intersected.
1356
0
      idxOther--;
1357
0
1358
0
      if (bands2[idxOther].bottom < origBand.bottom) {
1359
0
        // The last band in region2 that intersected ended before this one,
1360
0
        // we can copy the rest.
1361
0
        Band newBand(origBand);
1362
0
        newBand.top = bands2[idxOther].bottom;
1363
0
        AppendOrExtend(std::move(newBand));
1364
0
        idxOther++;
1365
0
      }
1366
0
      idx++;
1367
0
    }
1368
0
1369
0
    // Copy any remaining bands, the first one may have to be extended to fit
1370
0
    // the last one added before. The rest can be unconditionally appended.
1371
0
    if (idx < bands1.Length()) {
1372
0
      AppendOrExtend(bands1[idx]);
1373
0
      idx++;
1374
0
    }
1375
0
1376
0
    while (idx < bands1.Length()) {
1377
0
      mBands.AppendElement(bands1[idx]);
1378
0
      idx++;
1379
0
    }
1380
0
1381
0
    if (mBands.IsEmpty()) {
1382
0
      mBounds.SetEmpty();
1383
0
    }
1384
0
    else {
1385
0
      mBounds = CalculateBounds();
1386
0
    }
1387
0
1388
0
    AssertState();
1389
0
    EnsureSimplified();
1390
0
    return *this;
1391
0
  }
1392
1393
private:
1394
  // Internal helper for executing subtraction.
1395
  void RunSubtraction(const nsRectAbsolute& aRect)
1396
0
  {
1397
0
    Strip rectStrip(aRect.X(), aRect.XMost());
1398
0
1399
0
    size_t idx = 0;
1400
0
1401
0
    while (idx < mBands.Length()) {
1402
0
      if (mBands[idx].top >= aRect.YMost()) {
1403
0
        return;
1404
0
      }
1405
0
1406
0
      if (mBands[idx].bottom <= aRect.Y()) {
1407
0
        // This band is entirely before aRect, move on.
1408
0
        idx++;
1409
0
        continue;
1410
0
      }
1411
0
1412
0
      if (!mBands[idx].Intersects(Strip(aRect.X(), aRect.XMost()))) {
1413
0
        // This band does not intersect aRect horizontally. Move on.
1414
0
        idx++;
1415
0
        continue;
1416
0
      }
1417
0
1418
0
      // This band intersects with aRect.
1419
0
1420
0
      if (mBands[idx].top < aRect.Y()) {
1421
0
        // This band starts above the start of aRect, split the band into two
1422
0
        // along the intersection, and continue to the next iteration to process
1423
0
        // the one that now intersects exactly.
1424
0
        auto above = mBands.InsertElementAt(idx, Band(mBands[idx]));
1425
0
        above->bottom = aRect.Y();
1426
0
        idx++;
1427
0
        mBands[idx].top = aRect.Y();
1428
0
        // Continue to run the loop for the next band.
1429
0
        continue;
1430
0
      }
1431
0
1432
0
      if (mBands[idx].bottom <= aRect.YMost()) {
1433
0
        // This band ends before the end of aRect.
1434
0
        mBands[idx].SubStrip(rectStrip);
1435
0
        if (mBands[idx].mStrips.Length()) {
1436
0
          CompressAdjacentBands(idx);
1437
0
        } else {
1438
0
          mBands.RemoveElementAt(idx);
1439
0
        }
1440
0
        continue;
1441
0
      }
1442
0
1443
0
      // This band extends beyond aRect.
1444
0
      Band newBand = mBands[idx];
1445
0
      newBand.SubStrip(rectStrip);
1446
0
      newBand.bottom = aRect.YMost();
1447
0
      mBands[idx].top = aRect.YMost();
1448
0
1449
0
      if (newBand.mStrips.Length()) {
1450
0
        if (idx && mBands[idx - 1].bottom == newBand.top && newBand.EqualStrips(mBands[idx - 1])) {
1451
0
          mBands[idx - 1].bottom = aRect.YMost();
1452
0
        } else {
1453
0
          mBands.InsertElementAt(idx, std::move(newBand));
1454
0
        }
1455
0
      }
1456
0
1457
0
      return;
1458
0
    }
1459
0
  }
1460
1461
public:
1462
0
  nsRegion& SubWith(const nsRectAbsolute& aRect) {
1463
0
    if (!mBounds.Intersects(aRect)) {
1464
0
      return *this;
1465
0
    }
1466
0
1467
0
    if (aRect.Contains(mBounds)) {
1468
0
      SetEmpty();
1469
0
      return *this;
1470
0
    }
1471
0
1472
#ifdef DEBUG_REGIONS
1473
    class OperationStringGeneratorSubWith : public OperationStringGenerator
1474
    {
1475
    public:
1476
      OperationStringGeneratorSubWith(nsRegion& aRegion, const nsRectAbsolute& aRect)
1477
        : mRegion(&aRegion), mRegionCopy(aRegion), mRect(aRect)
1478
      {
1479
        aRegion.mCurrentOpGenerator = this;
1480
      }
1481
      virtual ~OperationStringGeneratorSubWith()
1482
      {
1483
        mRegion->mCurrentOpGenerator = nullptr;
1484
      }
1485
1486
      virtual void OutputOp() override
1487
      {
1488
        std::stringstream stream;
1489
        mRegionCopy.OutputToStream("r", stream);
1490
        stream << "r.SubWith(nsRect(" << mRect.X() << ", " << mRect.Y() << ", " << mRect.Width() << ", " << mRect.Height() << "));\n";
1491
        gfxCriticalError() << stream.str();
1492
      }
1493
    private:
1494
      nsRegion * mRegion;
1495
      nsRegion mRegionCopy;
1496
      nsRectAbsolute mRect;
1497
    };
1498
1499
    OperationStringGeneratorSubWith opGenerator(*this, aRect);
1500
#endif
1501
1502
0
    if (mBands.IsEmpty()) {
1503
0
      mBands.AppendElement(Band(mBounds));
1504
0
    }
1505
0
1506
0
    RunSubtraction(aRect);
1507
0
1508
0
    if (aRect.X() <= mBounds.X() || aRect.Y() <= mBounds.Y() ||
1509
0
        aRect.XMost() >= mBounds.XMost() || aRect.YMost() >= mBounds.YMost()) {
1510
0
      mBounds = CalculateBounds();
1511
0
    }
1512
0
    EnsureSimplified();
1513
0
    AssertState();
1514
0
    return *this;
1515
0
  }
1516
  nsRegion& Sub(const nsRegion& aRegion, const nsRectAbsolute& aRect)
1517
0
  {
1518
0
    if (aRect.Contains(aRegion.mBounds)) {
1519
0
      SetEmpty();
1520
0
      return *this;
1521
0
    }
1522
0
    if (&aRegion == this) {
1523
0
      return SubWith(aRect);
1524
0
    }
1525
#ifdef DEBUG_REGIONS
1526
    class OperationStringGeneratorSub : public OperationStringGenerator
1527
    {
1528
    public:
1529
      OperationStringGeneratorSub(nsRegion& aRegion, const nsRegion& aRegionOther, const nsRectAbsolute& aRect)
1530
        : mRegion(&aRegion), mRegionOther(aRegionOther), mRect(aRect)
1531
      {
1532
        aRegion.mCurrentOpGenerator = this;
1533
      }
1534
      virtual ~OperationStringGeneratorSub()
1535
      {
1536
        mRegion->mCurrentOpGenerator = nullptr;
1537
      }
1538
1539
      virtual void OutputOp() override
1540
      {
1541
        std::stringstream stream;
1542
        mRegionOther.OutputToStream("r1", stream);
1543
        stream << "nsRegion r2;\nr2.Sub(r1, nsRect(" << mRect.X() << ", " << mRect.Y() << ", " << mRect.Width() << ", " << mRect.Height() << "));\n";
1544
        gfxCriticalError() << stream.str();
1545
      }
1546
    private:
1547
      nsRegion * mRegion;
1548
      nsRegion mRegionOther;
1549
      nsRectAbsolute mRect;
1550
    };
1551
1552
    OperationStringGeneratorSub opGenerator(*this, aRegion, aRect);
1553
#endif
1554
1555
0
    mBands.Clear();
1556
0
1557
0
    if (aRegion.mBounds.IsEmpty()) {
1558
0
      mBounds.SetEmpty();
1559
0
      return *this;
1560
0
    }
1561
0
1562
0
    if (aRect.IsEmpty()) {
1563
0
      Copy(aRegion);
1564
0
      return *this;
1565
0
    }
1566
0
1567
0
    if (aRegion.mBands.IsEmpty()) {
1568
0
      Copy(aRegion.mBounds);
1569
0
      return SubWith(aRect);
1570
0
    }
1571
0
1572
0
    const BandArray& bands = aRegion.mBands;
1573
0
1574
0
    size_t idx = 0;
1575
0
1576
0
    Strip strip(aRect.X(), aRect.XMost());
1577
0
1578
0
    mBands.SetCapacity(bands.Length() + 3);
1579
0
1580
0
    // Process all bands that lie before aRect.
1581
0
    while (idx < bands.Length() && bands[idx].bottom <= aRect.Y()) {
1582
0
      mBands.AppendElement(bands[idx]);
1583
0
      idx++;
1584
0
    }
1585
0
1586
0
    // This band's bottom lies beyond aRect.
1587
0
    if (idx < bands.Length() && bands[idx].top < aRect.Y()) {
1588
0
      Band newBand(bands[idx]);
1589
0
      if (bands[idx].Intersects(strip)) {
1590
0
        newBand.bottom = aRect.Y();
1591
0
      } else {
1592
0
        idx++;
1593
0
      }
1594
0
      mBands.AppendElement(std::move(newBand));
1595
0
    }
1596
0
1597
0
    // This tracks whether the band when we -exit- the next loop intersected the rectangle.
1598
0
    bool didIntersect = false;
1599
0
1600
0
    while (idx < bands.Length() && bands[idx].top < aRect.YMost()) {
1601
0
      // Process all bands intersecting with aRect.
1602
0
      if (!bands[idx].Intersects(strip)) {
1603
0
        AppendOrExtend(bands[idx]);
1604
0
        idx++;
1605
0
        didIntersect = false;
1606
0
        continue;
1607
0
      }
1608
0
1609
0
      didIntersect = true;
1610
0
      Band newBand(bands[idx]);
1611
0
      newBand.top = std::max(newBand.top, aRect.Y());
1612
0
      newBand.bottom = std::min(newBand.bottom, aRect.YMost());
1613
0
      newBand.SubStrip(strip);
1614
0
      AppendOrExtend(std::move(newBand));
1615
0
      idx++;
1616
0
    }
1617
0
1618
0
    if (didIntersect) {
1619
0
      if (aRect.YMost() < bands[idx - 1].bottom) {
1620
0
        // If this band does not intersect the loop above has already added the
1621
0
        // whole unmodified band.
1622
0
        Band newBand(bands[idx - 1]);
1623
0
        newBand.top = aRect.YMost();
1624
0
        AppendOrExtend(std::move(newBand));
1625
0
      }
1626
0
    }
1627
0
1628
0
    // Now process all bands beyond aRect.
1629
0
    if (idx < bands.Length()) {
1630
0
      AppendOrExtend(bands[idx]);
1631
0
      idx++;
1632
0
    }
1633
0
1634
0
    mBands.AppendElements(bands.Elements() + idx, bands.Length() - idx);
1635
0
1636
0
    if (mBands.IsEmpty()) {
1637
0
      mBounds.SetEmpty();
1638
0
    } else {
1639
0
      mBounds = CalculateBounds();
1640
0
    }
1641
0
1642
0
    AssertState();
1643
0
    EnsureSimplified();
1644
0
    return *this;
1645
0
  }
1646
0
  nsRegion& SubWith(const nsRect& aRect) {
1647
0
    return SubWith(nsRectAbsolute::FromRect(aRect));
1648
0
  }
1649
  nsRegion& Sub(const nsRect& aRect, const nsRegion& aRegion)
1650
0
  {
1651
0
    Copy(aRect);
1652
0
    return SubWith(aRegion);
1653
0
  }
1654
  nsRegion& Sub(const nsRectAbsolute& aRect, const nsRegion& aRegion)
1655
0
  {
1656
0
    Copy(aRect);
1657
0
    return SubWith(aRegion);
1658
0
  }
1659
  nsRegion& Sub(const nsRect& aRect1, const nsRect& aRect2)
1660
0
  {
1661
0
    Copy(aRect1);
1662
0
    return SubWith(aRect2);
1663
0
  }
1664
  nsRegion& Sub(const nsRegion& aRegion, const nsRect& aRect)
1665
0
  {
1666
0
    return Sub(aRegion, nsRectAbsolute::FromRect(aRect));
1667
0
  }
1668
  nsRegion& Sub(const nsRectAbsolute& aRect1, const nsRectAbsolute& aRect2)
1669
0
  {
1670
0
    Copy(aRect1);
1671
0
    return SubWith(aRect2);
1672
0
  }
1673
1674
  /**
1675
   * Returns true if the given point is inside the region. A region
1676
   * created from a rect (x=0, y=0, w=100, h=100) will NOT contain
1677
   * the point x=100, y=100.
1678
   */
1679
  bool Contains(int aX, int aY) const
1680
0
  {
1681
0
    if (mBands.IsEmpty()) {
1682
0
      return mBounds.Contains(aX, aY);
1683
0
    }
1684
0
1685
0
    auto iter = mBands.begin();
1686
0
1687
0
    while (iter != mBands.end()) {
1688
0
      if (iter->bottom <= aY) {
1689
0
        iter++;
1690
0
        continue;
1691
0
      }
1692
0
1693
0
      if (iter->top > aY) {
1694
0
        return false;
1695
0
      }
1696
0
1697
0
      if (iter->ContainsStrip(Strip(aX, aX + 1))) {
1698
0
        return true;
1699
0
      }
1700
0
      return false;
1701
0
    }
1702
0
    return false;
1703
0
  }
1704
  bool Contains(const nsRectAbsolute& aRect) const
1705
0
  {
1706
0
    if (aRect.IsEmpty()) {
1707
0
      return false;
1708
0
    }
1709
0
1710
0
    if (mBands.IsEmpty()) {
1711
0
      return mBounds.Contains(aRect);
1712
0
    }
1713
0
1714
0
    auto iter = mBands.begin();
1715
0
1716
0
    while (iter != mBands.end()) {
1717
0
      if (iter->bottom <= aRect.Y()) {
1718
0
        iter++;
1719
0
        continue;
1720
0
      }
1721
0
1722
0
      if (iter->top > aRect.Y()) {
1723
0
        return false;
1724
0
      }
1725
0
1726
0
      // Now inside the rectangle.
1727
0
      if (!iter->ContainsStrip(Strip(aRect.X(), aRect.XMost()))) {
1728
0
        return false;
1729
0
      }
1730
0
1731
0
      if (iter->bottom >= aRect.YMost()) {
1732
0
        return true;
1733
0
      }
1734
0
1735
0
      int32_t lastY = iter->bottom;
1736
0
      iter++;
1737
0
      while (iter != mBands.end()) {
1738
0
        // Bands do not connect.
1739
0
        if (iter->top != lastY) {
1740
0
          return false;
1741
0
        }
1742
0
1743
0
        if (!iter->ContainsStrip(Strip(aRect.X(), aRect.XMost()))) {
1744
0
          return false;
1745
0
        }
1746
0
1747
0
        if (iter->bottom >= aRect.YMost()) {
1748
0
          return true;
1749
0
        }
1750
0
1751
0
        lastY = iter->bottom;
1752
0
        iter++;
1753
0
      }
1754
0
    }
1755
0
    return false;
1756
0
  }
1757
  bool Contains(const nsRect& aRect) const
1758
0
  {
1759
0
    return Contains(nsRectAbsolute::FromRect(aRect));
1760
0
  }
1761
1762
  bool Contains(const nsRegion& aRgn) const;
1763
  bool Intersects(const nsRectAbsolute& aRect) const;
1764
0
  bool Intersects(const nsRect& aRect) const {
1765
0
    return Intersects(nsRectAbsolute::FromRect(aRect));
1766
0
  }
1767
1768
  void MoveBy(int32_t aXOffset, int32_t aYOffset)
1769
0
  {
1770
0
    MoveBy(nsPoint(aXOffset, aYOffset));
1771
0
  }
1772
  void MoveBy(nsPoint aPt)
1773
0
  {
1774
#ifdef DEBUG_REGIONS
1775
    class OperationStringGeneratorMoveBy : public OperationStringGenerator
1776
    {
1777
    public:
1778
      OperationStringGeneratorMoveBy(nsRegion& aRegion, const nsPoint& aPoint)
1779
        : mRegion(&aRegion), mRegionCopy(aRegion), mPoint(aPoint)
1780
      {
1781
        aRegion.mCurrentOpGenerator = this;
1782
      }
1783
      virtual ~OperationStringGeneratorMoveBy()
1784
      {
1785
        mRegion->mCurrentOpGenerator = nullptr;
1786
      }
1787
1788
      virtual void OutputOp() override
1789
      {
1790
        std::stringstream stream;
1791
        mRegionCopy.OutputToStream("r", stream);
1792
        stream << "r.MoveBy(nsPoint(" << mPoint.x << ", " << mPoint.y << "));\n";
1793
        gfxCriticalError() << stream.str();
1794
      }
1795
    private:
1796
      nsRegion * mRegion;
1797
      nsRegion mRegionCopy;
1798
      nsPoint mPoint;
1799
    };
1800
1801
    OperationStringGeneratorMoveBy opGenerator(*this, aPt);
1802
#endif
1803
1804
0
    mBounds.MoveBy(aPt);
1805
0
    for (Band& band : mBands) {
1806
0
      band.top += aPt.Y();
1807
0
      band.bottom += aPt.Y();
1808
0
      for (Strip& strip : band.mStrips) {
1809
0
        strip.left += aPt.X();
1810
0
        strip.right += aPt.X();
1811
0
      }
1812
0
    }
1813
0
    AssertState();
1814
0
  }
1815
  void SetEmpty()
1816
0
  {
1817
0
    mBands.Clear();
1818
0
    mBounds.SetEmpty();
1819
0
  }
1820
1821
  nsRegion MovedBy(int32_t aXOffset, int32_t aYOffset) const
1822
0
  {
1823
0
    return MovedBy(nsPoint(aXOffset, aYOffset));
1824
0
  }
1825
  nsRegion MovedBy(const nsPoint& aPt) const
1826
0
  {
1827
0
    nsRegion copy(*this);
1828
0
    copy.MoveBy(aPt);
1829
0
    return copy;
1830
0
  }
1831
1832
  nsRegion Intersect(const nsRegion& aOther) const
1833
0
  {
1834
0
    nsRegion intersection;
1835
0
    intersection.And(*this, aOther);
1836
0
    return intersection;
1837
0
  }
1838
1839
  void Inflate(const nsMargin& aMargin);
1840
1841
  nsRegion Inflated(const nsMargin& aMargin) const
1842
0
  {
1843
0
    nsRegion copy(*this);
1844
0
    copy.Inflate(aMargin);
1845
0
    return copy;
1846
0
  }
1847
1848
  bool IsEmpty() const { return mBounds.IsEmpty(); }
1849
0
  bool IsComplex() const { return GetNumRects() > 1; }
1850
  bool IsEqual(const nsRegion& aRegion) const
1851
0
  {
1852
0
    if (!mBounds.IsEqualInterior(aRegion.mBounds)) {
1853
0
      return false;
1854
0
    }
1855
0
1856
0
    if (mBands.Length() != aRegion.mBands.Length()) {
1857
0
      return false;
1858
0
    }
1859
0
1860
0
    for (auto iter1 = mBands.begin(), iter2 = aRegion.mBands.begin();
1861
0
      iter1 != mBands.end(); iter1++, iter2++)
1862
0
    {
1863
0
      if (iter1->top != iter2->top || iter1->bottom != iter2->bottom ||
1864
0
          !iter1->EqualStrips(*iter2)) {
1865
0
        return false;
1866
0
      }
1867
0
    }
1868
0
1869
0
    return true;
1870
0
  }
1871
1872
  uint32_t GetNumRects() const
1873
  {
1874
    if (mBands.IsEmpty()) {
1875
      return mBounds.IsEmpty() ? 0 : 1;
1876
    }
1877
1878
    uint32_t rects = 0;
1879
1880
    for (const Band& band : mBands) {
1881
      rects += band.mStrips.Length();
1882
    }
1883
1884
    return rects;
1885
  }
1886
0
  const nsRect GetBounds() const { return mBounds.ToNSRect(); }
1887
0
  const nsRectAbsolute GetAbsoluteBounds() const { return mBounds; }
1888
  uint64_t Area() const;
1889
1890
  /**
1891
   * Return this region scaled to a different appunits per pixel (APP) ratio.
1892
   * This applies nsRect::ScaleToOtherAppUnitsRoundOut/In to each rect of the region.
1893
   * @param aFromAPP the APP to scale from
1894
   * @param aToAPP the APP to scale to
1895
   * @note this can turn an empty region into a non-empty region
1896
   */
1897
  MOZ_MUST_USE nsRegion
1898
    ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
1899
  MOZ_MUST_USE nsRegion
1900
    ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
1901
  nsRegion& ScaleRoundOut(float aXScale, float aYScale);
1902
  nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale);
1903
  nsRegion& Transform(const mozilla::gfx::Matrix4x4 &aTransform);
1904
  nsIntRegion ScaleToOutsidePixels(float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
1905
  nsIntRegion ScaleToInsidePixels(float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
1906
  nsIntRegion ScaleToNearestPixels(float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
1907
  nsIntRegion ToOutsidePixels(nscoord aAppUnitsPerPixel) const;
1908
  nsIntRegion ToNearestPixels(nscoord aAppUnitsPerPixel) const;
1909
1910
  /**
1911
   * Gets the largest rectangle contained in the region.
1912
   * @param aContainingRect if non-empty, we choose a rectangle that
1913
   * maximizes the area intersecting with aContainingRect (and break ties by
1914
   * then choosing the largest rectangle overall)
1915
   */
1916
  nsRect GetLargestRectangle(const nsRect& aContainingRect = nsRect()) const;
1917
1918
  /**
1919
   * Make sure the region has at most aMaxRects by adding area to it
1920
   * if necessary. The simplified region will be a superset of the
1921
   * original region. The simplified region's bounding box will be
1922
   * the same as for the current region.
1923
   */
1924
  void SimplifyOutward(uint32_t aMaxRects);
1925
  /**
1926
   * Simplify the region by adding at most aThreshold area between spans of
1927
   * rects.  The simplified region will be a superset of the original region.
1928
   * The simplified region's bounding box will be the same as for the current
1929
   * region.
1930
   */
1931
  void SimplifyOutwardByArea(uint32_t aThreshold);
1932
  /**
1933
   * Make sure the region has at most aMaxRects by removing area from
1934
   * it if necessary. The simplified region will be a subset of the
1935
   * original region.
1936
   */
1937
  void SimplifyInward(uint32_t aMaxRects);
1938
1939
  /**
1940
   * VisitEdges is a weird kind of function that we use for padding
1941
   * out surfaces to prevent texture filtering artifacts.
1942
   * It calls the visitFn callback for each of the exterior edges of
1943
   * the regions. The top and bottom edges will be expanded 1 pixel
1944
   * to the left and right if there's an outside corner. The order
1945
   * the edges are visited is not guaranteed.
1946
   *
1947
   * visitFn has a side parameter that can be TOP,BOTTOM,LEFT,RIGHT
1948
   * and specifies which kind of edge is being visited. x1, y1, x2, y2
1949
   * are the coordinates of the line. (x1 == x2) || (y1 == y2)
1950
   */
1951
  typedef void(*visitFn)(void *closure, VisitSide side, int x1, int y1, int x2, int y2);
1952
  void VisitEdges(visitFn, void *closure) const;
1953
1954
  nsCString ToString() const;
1955
1956
  static inline pixman_box32_t RectToBox(const nsRect &aRect)
1957
0
  {
1958
0
    pixman_box32_t box = { aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost() };
1959
0
    return box;
1960
0
  }
1961
1962
  static inline pixman_box32_t RectToBox(const mozilla::gfx::IntRect &aRect)
1963
0
  {
1964
0
    pixman_box32_t box = { aRect.X(), aRect.Y(), aRect.XMost(), aRect.YMost() };
1965
0
    return box;
1966
0
  }
1967
private:
1968
1969
  nsIntRegion ToPixels(nscoord aAppUnitsPerPixel, bool aOutsidePixels) const;
1970
1971
  nsRegion& Copy(const nsRegion& aRegion)
1972
0
  {
1973
0
    mBounds = aRegion.mBounds;
1974
0
    mBands = aRegion.mBands;
1975
0
    return *this;
1976
0
  }
1977
1978
  nsRegion& Copy(const nsRect& aRect)
1979
  {
1980
    mBands.Clear();
1981
    mBounds = nsRectAbsolute::FromRect(aRect);
1982
    return *this;
1983
  }
1984
1985
  nsRegion& Copy(const nsRectAbsolute& aRect)
1986
0
  {
1987
0
    mBands.Clear();
1988
0
    mBounds = aRect;
1989
0
    return *this;
1990
0
  }
1991
1992
0
  void EnsureSimplified() {
1993
0
    if (mBands.Length() == 1 && mBands.begin()->mStrips.Length() == 1) {
1994
0
      mBands.Clear();
1995
0
    }
1996
0
  }
1997
1998
  static inline nsRectAbsolute BoxToRect(const pixman_box32_t &aBox)
1999
0
  {
2000
0
    return nsRectAbsolute(aBox.x1, aBox.y1,
2001
0
                          aBox.x2, aBox.y2);
2002
0
  }
2003
2004
  void AddRect(const nsRectAbsolute& aRect)
2005
0
  {
2006
#ifdef DEBUG_REGIONS
2007
    class OperationStringGeneratorAddRect : public OperationStringGenerator
2008
    {
2009
    public:
2010
      OperationStringGeneratorAddRect(nsRegion& aRegion, const nsRectAbsolute& aRect)
2011
        : mRegion(&aRegion), mRegionCopy(aRegion), mRect(aRect)
2012
      {
2013
        aRegion.mCurrentOpGenerator = this;
2014
      }
2015
      virtual ~OperationStringGeneratorAddRect()
2016
      {
2017
        mRegion->mCurrentOpGenerator = nullptr;
2018
      }
2019
2020
      virtual void OutputOp() override
2021
      {
2022
        std::stringstream stream;
2023
        mRegionCopy.OutputToStream("r", stream);
2024
        stream << "r.OrWith(nsRect(" << mRect.X() << ", " << mRect.Y() << ", " << mRect.Width() << ", " << mRect.Height() << "));\n";
2025
        gfxCriticalError() << stream.str();
2026
      }
2027
    private:
2028
      nsRegion* mRegion;
2029
      nsRegion mRegionCopy;
2030
      nsRectAbsolute mRect;
2031
    };
2032
2033
    OperationStringGeneratorAddRect opGenerator(*this, aRect);
2034
#endif
2035
0
    if (aRect.IsEmpty()) {
2036
0
      return;
2037
0
    }
2038
0
2039
0
    if (mBands.IsEmpty()) {
2040
0
      if (mBounds.IsEmpty()) {
2041
0
        mBounds = aRect;
2042
0
        return;
2043
0
      } else if (mBounds.Contains(aRect)) {
2044
0
        return;
2045
0
      }
2046
0
2047
0
      mBands.AppendElement(Band(mBounds));
2048
0
    }
2049
0
2050
0
    mBounds = aRect.UnsafeUnion(mBounds);
2051
0
2052
0
    size_t idx = 0;
2053
0
2054
0
    Strip strip(aRect.X(), aRect.XMost());
2055
0
    Band remaining(aRect);
2056
0
2057
0
    while (idx != mBands.Length()) {
2058
0
      if (mBands[idx].bottom <= remaining.top) {
2059
0
        // This band lies wholly above aRect.
2060
0
        idx++;
2061
0
        continue;
2062
0
      }
2063
0
2064
0
      if (remaining.top >= remaining.bottom) {
2065
0
        AssertState();
2066
0
        EnsureSimplified();
2067
0
        return;
2068
0
      }
2069
0
2070
0
      if (mBands[idx].top >= remaining.bottom) {
2071
0
        // This band lies wholly below aRect.
2072
0
        break;
2073
0
      }
2074
0
2075
0
      if (mBands[idx].EqualStrips(remaining)) {
2076
0
        mBands[idx].top = std::min(mBands[idx].top, remaining.top);
2077
0
        // Nothing to do for this band. Just expand.
2078
0
        remaining.top = mBands[idx].bottom;
2079
0
        CompressBefore(idx);
2080
0
        idx++;
2081
0
        continue;
2082
0
      }
2083
0
2084
0
      if (mBands[idx].top > remaining.top) {
2085
0
        auto before = mBands.InsertElementAt(idx, remaining);
2086
0
        before->bottom = mBands[idx + 1].top;
2087
0
        remaining.top = before->bottom;
2088
0
        CompressBefore(idx);
2089
0
        idx++;
2090
0
        CompressBefore(idx);
2091
0
        continue;
2092
0
      }
2093
0
2094
0
      if (mBands[idx].ContainsStrip(strip)) {
2095
0
        remaining.top = mBands[idx].bottom;
2096
0
        idx++;
2097
0
        continue;
2098
0
      }
2099
0
2100
0
      // mBands[idx].top <= remaining.top.
2101
0
2102
0
      if (mBands[idx].top < remaining.top) {
2103
0
        auto before = mBands.InsertElementAt(idx, Band(mBands[idx]));
2104
0
        before->bottom = remaining.top;
2105
0
        idx++;
2106
0
        mBands[idx].top = remaining.top;
2107
0
        continue;
2108
0
      }
2109
0
2110
0
      // mBands[idx].top == remaining.top
2111
0
      if (mBands[idx].bottom > remaining.bottom) {
2112
0
        auto below = mBands.InsertElementAt(idx + 1, Band(mBands[idx]));
2113
0
        below->top = remaining.bottom;
2114
0
        mBands[idx].bottom = remaining.bottom;
2115
0
      }
2116
0
2117
0
      mBands[idx].InsertStrip(strip);
2118
0
      CompressBefore(idx);
2119
0
      remaining.top = mBands[idx].bottom;
2120
0
      idx++;
2121
0
      CompressBefore(idx);
2122
0
    }
2123
0
2124
0
    if (remaining.top < remaining.bottom) {
2125
0
      // We didn't find any bands that overlapped aRect.
2126
0
      if (idx) {
2127
0
        if (mBands[idx - 1].bottom == remaining.top && mBands[idx - 1].EqualStrips(remaining)) {
2128
0
          mBands[idx - 1].bottom = remaining.bottom;
2129
0
          CompressBefore(idx);
2130
0
          AssertState();
2131
0
          EnsureSimplified();
2132
0
          return;
2133
0
        }
2134
0
      }
2135
0
      mBands.InsertElementAt(idx, remaining);
2136
0
      idx++;
2137
0
      CompressBefore(idx);
2138
0
    } else {
2139
0
      CompressBefore(idx);
2140
0
    }
2141
0
2142
0
    AssertState();
2143
0
    EnsureSimplified();
2144
0
  }
2145
2146
  // Most callers could probably do this on the fly, if this ever shows up
2147
  // in profiles we could optimize this.
2148
  nsRectAbsolute CalculateBounds() const
2149
0
  {
2150
0
    if (mBands.IsEmpty()) {
2151
0
      return mBounds;
2152
0
    }
2153
0
2154
0
    int32_t top = mBands.begin()->top;
2155
0
    int32_t bottom = mBands.LastElement().bottom;
2156
0
2157
0
    int32_t leftMost = mBands.begin()->mStrips.begin()->left;
2158
0
    int32_t rightMost = mBands.begin()->mStrips.LastElement().right;
2159
0
    for (const Band& band : mBands) {
2160
0
      leftMost = std::min(leftMost, band.mStrips.begin()->left);
2161
0
      rightMost = std::max(rightMost, band.mStrips.LastElement().right);
2162
0
    }
2163
0
2164
0
    return nsRectAbsolute(leftMost, top, rightMost, bottom);
2165
0
  }
2166
2167
  static uint32_t ComputeMergedAreaIncrease(const Band& aTopBand,
2168
                                            const Band& aBottomBand);
2169
2170
  // Returns true if idx is now referring to the 'next' band
2171
  bool CompressAdjacentBands(size_t& aIdx)
2172
0
  {
2173
0
    if ((aIdx + 1) < mBands.Length()) {
2174
0
      if (mBands[aIdx + 1].top == mBands[aIdx].bottom && mBands[aIdx + 1].EqualStrips(mBands[aIdx])) {
2175
0
        mBands[aIdx].bottom = mBands[aIdx + 1].bottom;
2176
0
        mBands.RemoveElementAt(aIdx + 1);
2177
0
      }
2178
0
    }
2179
0
    if (aIdx) {
2180
0
      if (mBands[aIdx - 1].bottom == mBands[aIdx].top && mBands[aIdx].EqualStrips(mBands[aIdx - 1])) {
2181
0
        mBands[aIdx - 1].bottom = mBands[aIdx].bottom;
2182
0
        mBands.RemoveElementAt(aIdx);
2183
0
        return true;
2184
0
      }
2185
0
    }
2186
0
    return false;
2187
0
  }
2188
2189
  void CompressBefore(size_t& aIdx)
2190
0
  {
2191
0
    if (aIdx && aIdx < mBands.Length()) {
2192
0
      if (mBands[aIdx - 1].bottom == mBands[aIdx].top && mBands[aIdx - 1].EqualStrips(mBands[aIdx])) {
2193
0
        mBands[aIdx].top = mBands[aIdx - 1].top;
2194
0
        mBands.RemoveElementAt(aIdx - 1);
2195
0
        aIdx--;
2196
0
      }
2197
0
    }
2198
0
  }
2199
2200
2201
  BandArray mBands;
2202
  // Considering we only ever OR with nsRects, the bounds should fit in an nsRect as well.
2203
  nsRectAbsolute mBounds;
2204
#ifdef DEBUG_REGIONS
2205
  friend class OperationStringGenerator;
2206
  OperationStringGenerator* mCurrentOpGenerator;
2207
#endif
2208
2209
public:
2210
  class RectIterator
2211
  {
2212
    const nsRegion& mRegion;
2213
    typename BandArray::const_iterator mCurrentBand;
2214
    typename StripArray::const_iterator mCurrentStrip;
2215
2216
  public:
2217
    explicit RectIterator(const nsRegion& aRegion)
2218
      : mRegion(aRegion)
2219
      , mCurrentBand(aRegion.mBands.begin())
2220
#ifndef DEBUG
2221
      , mCurrentStrip(nullptr)
2222
#endif
2223
0
    {
2224
0
      mIsDone = mRegion.mBounds.IsEmpty();
2225
0
      if (mCurrentBand != aRegion.mBands.end()) {
2226
0
        mCurrentStrip = mCurrentBand->mStrips.begin();
2227
0
      }
2228
0
    }
2229
2230
0
    bool Done() const { return mIsDone; }
2231
2232
    const nsRect Get() const
2233
0
    {
2234
0
      if (mRegion.mBands.IsEmpty()) {
2235
0
        return mRegion.GetBounds();
2236
0
      }
2237
0
      return nsRect(mCurrentStrip->left, mCurrentBand->top,
2238
0
        mCurrentStrip->right - mCurrentStrip->left,
2239
0
        mCurrentBand->bottom - mCurrentBand->top);
2240
0
    }
2241
2242
    const nsRectAbsolute GetAbsolute() const
2243
    {
2244
      if (mRegion.mBands.IsEmpty()) {
2245
        return mRegion.mBounds;
2246
      }
2247
      return nsRectAbsolute(mCurrentStrip->left, mCurrentBand->top,
2248
                            mCurrentStrip->right, mCurrentBand->bottom);
2249
    }
2250
2251
    void Next()
2252
0
    {
2253
0
      if (mRegion.mBands.IsEmpty()) {
2254
0
        mIsDone = true;
2255
0
        return;
2256
0
      }
2257
0
2258
0
      mCurrentStrip++;
2259
0
      if (mCurrentStrip == mCurrentBand->mStrips.end()) {
2260
0
        mCurrentBand++;
2261
0
        if (mCurrentBand != mRegion.mBands.end()) {
2262
0
          mCurrentStrip = mCurrentBand->mStrips.begin();
2263
0
        } else {
2264
0
          mIsDone = true;
2265
0
        }
2266
0
      }
2267
0
    }
2268
2269
    bool mIsDone;
2270
  };
2271
2272
  RectIterator RectIter() const { return RectIterator(*this); }
2273
};
2274
2275
namespace mozilla {
2276
namespace gfx {
2277
2278
/**
2279
 * BaseIntRegions use int32_t coordinates.
2280
 */
2281
template <typename Derived, typename Rect, typename Point, typename Margin>
2282
class BaseIntRegion
2283
{
2284
  friend class ::nsRegion;
2285
2286
  // Give access to all specializations of IntRegionTyped, not just ones that
2287
  // derive from this specialization of BaseIntRegion.
2288
  template <typename units>
2289
  friend class IntRegionTyped;
2290
2291
public:
2292
  typedef Rect RectType;
2293
  typedef Point PointType;
2294
  typedef Margin MarginType;
2295
2296
0
  BaseIntRegion () {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::BaseIntRegion()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::BaseIntRegion()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::BaseIntRegion()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::BaseIntRegion()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::BaseIntRegion()
2297
0
  MOZ_IMPLICIT BaseIntRegion (const Rect& aRect) : mImpl (ToRect(aRect)) {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::BaseIntRegion(mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::BaseIntRegion(mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::BaseIntRegion(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
2298
0
  explicit BaseIntRegion (mozilla::gfx::ArrayView<pixman_box32_t> aRects) : mImpl (aRects) {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::BaseIntRegion(mozilla::gfx::ArrayView<pixman_box32>)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::BaseIntRegion(mozilla::gfx::ArrayView<pixman_box32>)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::BaseIntRegion(mozilla::gfx::ArrayView<pixman_box32>)
2299
0
  BaseIntRegion (const BaseIntRegion& aRegion) : mImpl (aRegion.mImpl) {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> > const&)
2300
0
  BaseIntRegion (BaseIntRegion&& aRegion) : mImpl (std::move(aRegion.mImpl)) {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::BaseIntRegion(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >&&)
2301
  Derived& operator = (const Rect& aRect) { mImpl = ToRect (aRect); return This(); }
2302
0
  Derived& operator = (const Derived& aRegion) { mImpl = aRegion.mImpl; return This(); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2303
0
  Derived& operator = (Derived&& aRegion) { mImpl = std::move(aRegion.mImpl); return This(); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>&&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::operator=(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>&&)
2304
2305
  bool operator==(const Derived& aRgn) const
2306
0
  {
2307
0
    return IsEqual(aRgn);
2308
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::operator==(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::operator==(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::operator==(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&) const
2309
  bool operator!=(const Derived& aRgn) const
2310
0
  {
2311
0
    return !(*this == aRgn);
2312
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::operator!=(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::operator!=(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&) const
2313
2314
  friend std::ostream& operator<<(std::ostream& stream, const Derived& m) {
2315
    return stream << m.mImpl;
2316
  }
2317
2318
  void AndWith(const Derived& aOther)
2319
0
  {
2320
0
    And(This(), aOther);
2321
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::AndWith(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::AndWith(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::AndWith(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2322
  void AndWith(const Rect& aOther)
2323
0
  {
2324
0
    And(This(), aOther);
2325
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::AndWith(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::AndWith(mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::AndWith(mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
2326
  Derived& And  (const Derived& aRgn1,   const Derived& aRgn2)
2327
0
  {
2328
0
    mImpl.And (aRgn1.mImpl, aRgn2.mImpl);
2329
0
    return This();
2330
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::And(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::And(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2331
  Derived& And  (const Derived& aRegion, const Rect& aRect)
2332
0
  {
2333
0
    mImpl.And (aRegion.mImpl, ToRect (aRect));
2334
0
    return This();
2335
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::And(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::And(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&, mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::And(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::And(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel> const&, mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
2336
  Derived& And  (const Rect& aRect, const Derived& aRegion)
2337
0
  {
2338
0
    return  And  (aRegion, aRect);
2339
0
  }
2340
  Derived& And  (const Rect& aRect1, const Rect& aRect2)
2341
0
  {
2342
0
    Rect TmpRect;
2343
0
2344
0
    TmpRect.IntersectRect (aRect1, aRect2);
2345
0
    mImpl = ToRect (TmpRect);
2346
0
    return This();
2347
0
  }
2348
2349
  Derived& OrWith(const Derived& aOther)
2350
0
  {
2351
0
    return Or(This(), aOther);
2352
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::OrWith(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::OrWith(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
2353
  Derived& OrWith(const Rect& aOther)
2354
0
  {
2355
0
    return Or(This(), aOther);
2356
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::OrWith(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::OrWith(mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
2357
  Derived& Or   (const Derived& aRgn1,   const Derived& aRgn2)
2358
0
  {
2359
0
    mImpl.Or (aRgn1.mImpl, aRgn2.mImpl);
2360
0
    return This();
2361
0
  }
2362
  Derived& Or   (const Derived& aRegion, const Rect& aRect)
2363
0
  {
2364
0
    mImpl.Or (aRegion.mImpl, ToRect (aRect));
2365
0
    return This();
2366
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::Or(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&, mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::Or(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::Or(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel> const&, mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
2367
  Derived& Or   (const Rect& aRect, const Derived& aRegion)
2368
  {
2369
    return  Or   (aRegion, aRect);
2370
  }
2371
  Derived& Or   (const Rect& aRect1, const Rect& aRect2)
2372
0
  {
2373
0
    mImpl = ToRect (aRect1);
2374
0
    return Or (This(), aRect2);
2375
0
  }
2376
2377
  Derived& XorWith(const Derived& aOther)
2378
0
  {
2379
0
    return Xor(This(), aOther);
2380
0
  }
2381
  Derived& XorWith(const Rect& aOther)
2382
  {
2383
    return Xor(This(), aOther);
2384
  }
2385
  Derived& Xor  (const Derived& aRgn1,   const Derived& aRgn2)
2386
0
  {
2387
0
    mImpl.Xor (aRgn1.mImpl, aRgn2.mImpl);
2388
0
    return This();
2389
0
  }
2390
  Derived& Xor  (const Derived& aRegion, const Rect& aRect)
2391
0
  {
2392
0
    mImpl.Xor (aRegion.mImpl, ToRect (aRect));
2393
0
    return This();
2394
0
  }
2395
  Derived& Xor  (const Rect& aRect, const Derived& aRegion)
2396
  {
2397
    return  Xor  (aRegion, aRect);
2398
  }
2399
  Derived& Xor  (const Rect& aRect1, const Rect& aRect2)
2400
0
  {
2401
0
    mImpl = ToRect (aRect1);
2402
0
    return Xor (This(), aRect2);
2403
0
  }
2404
2405
  Derived& SubOut(const Derived& aOther)
2406
0
  {
2407
0
    return Sub(This(), aOther);
2408
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::SubOut(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::SubOut(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::SubOut(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2409
  Derived& SubOut(const Rect& aOther)
2410
  {
2411
    return Sub(This(), aOther);
2412
  }
2413
  Derived& Sub  (const Derived& aRgn1,   const Derived& aRgn2)
2414
0
  {
2415
0
    mImpl.Sub (aRgn1.mImpl, aRgn2.mImpl);
2416
0
    return This();
2417
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2418
  Derived& Sub  (const Derived& aRegion, const Rect& aRect)
2419
0
  {
2420
0
    mImpl.Sub (aRegion.mImpl, ToRect (aRect));
2421
0
    return This();
2422
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel> const&, mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::Sub(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
2423
  Derived& Sub  (const Rect& aRect, const Derived& aRegion)
2424
0
  {
2425
0
    return Sub (Derived (aRect), aRegion);
2426
0
  }
2427
  Derived& Sub  (const Rect& aRect1, const Rect& aRect2)
2428
0
  {
2429
0
    mImpl = ToRect (aRect1);
2430
0
    return Sub (This(), aRect2);
2431
0
  }
2432
2433
  /**
2434
   * Returns true iff the given point is inside the region. A region
2435
   * created from a rect (x=0, y=0, w=100, h=100) will NOT contain
2436
   * the point x=100, y=100.
2437
   */
2438
  bool Contains (int aX, int aY) const
2439
0
  {
2440
0
    return mImpl.Contains(aX, aY);
2441
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::Contains(int, int) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::Contains(int, int) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::Contains(int, int) const
2442
  bool Contains (const Rect& aRect) const
2443
0
  {
2444
0
    return mImpl.Contains (ToRect (aRect));
2445
0
  }
2446
  bool Contains (const Derived& aRgn) const
2447
0
  {
2448
0
    return mImpl.Contains (aRgn.mImpl);
2449
0
  }
2450
  bool Intersects (const Rect& aRect) const
2451
0
  {
2452
0
    return mImpl.Intersects (ToRect (aRect));
2453
0
  }
2454
2455
  void MoveBy (int32_t aXOffset, int32_t aYOffset)
2456
0
  {
2457
0
    MoveBy (Point (aXOffset, aYOffset));
2458
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::MoveBy(int, int)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::MoveBy(int, int)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::MoveBy(int, int)
2459
  void MoveBy (Point aPt)
2460
0
  {
2461
0
    mImpl.MoveBy (aPt.X(), aPt.Y());
2462
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::MoveBy(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::MoveBy(mozilla::gfx::IntPointTyped<mozilla::LayerPixel>)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::MoveBy(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::MoveBy(mozilla::gfx::IntPointTyped<mozilla::CSSPixel>)
2463
  Derived MovedBy(int32_t aXOffset, int32_t aYOffset) const
2464
  {
2465
    return MovedBy(Point(aXOffset, aYOffset));
2466
  }
2467
  Derived MovedBy(const Point& aPt) const
2468
  {
2469
    Derived copy(This());
2470
    copy.MoveBy(aPt);
2471
    return copy;
2472
  }
2473
2474
  Derived Intersect(const Derived& aOther) const
2475
  {
2476
    Derived intersection;
2477
    intersection.And(This(), aOther);
2478
    return intersection;
2479
  }
2480
2481
  void Inflate(const Margin& aMargin)
2482
  {
2483
    mImpl.Inflate(nsMargin(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left));
2484
  }
2485
  Derived Inflated(const Margin& aMargin) const
2486
  {
2487
    Derived copy(This());
2488
    copy.Inflate(aMargin);
2489
    return copy;
2490
  }
2491
2492
  void SetEmpty ()
2493
0
  {
2494
0
    mImpl.SetEmpty  ();
2495
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::SetEmpty()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::SetEmpty()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::SetEmpty()
2496
2497
0
  bool IsEmpty () const { return mImpl.IsEmpty (); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::IsEmpty() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::IsEmpty() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::IsEmpty() const
2498
  bool IsComplex () const { return mImpl.IsComplex (); }
2499
  bool IsEqual (const Derived& aRegion) const
2500
0
  {
2501
0
    return mImpl.IsEqual (aRegion.mImpl);
2502
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::IsEqual(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::IsEqual(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::IsEqual(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&) const
2503
0
  uint32_t GetNumRects () const { return mImpl.GetNumRects (); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::GetNumRects() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::GetNumRects() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::GetNumRects() const
2504
0
  Rect GetBounds () const { return FromRect (mImpl.GetBounds ()); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::GetBounds() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::GetBounds() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::GetBounds() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::GetBounds() const
2505
0
  uint64_t Area () const { return mImpl.Area(); }
2506
  nsRegion ToAppUnits (nscoord aAppUnitsPerPixel) const
2507
0
  {
2508
0
    nsRegion result;
2509
0
    for (auto iter = RectIterator(*this); !iter.Done(); iter.Next()) {
2510
0
      nsRect appRect = ::ToAppUnits(iter.Get(), aAppUnitsPerPixel);
2511
0
      result.Or(result, appRect);
2512
0
    }
2513
0
    return result;
2514
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::ToAppUnits(int) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::ToAppUnits(int) const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::ToAppUnits(int) const
2515
  Rect GetLargestRectangle (const Rect& aContainingRect = Rect()) const
2516
  {
2517
    return FromRect (mImpl.GetLargestRectangle( ToRect(aContainingRect) ));
2518
  }
2519
2520
  Derived& ScaleRoundOut (float aXScale, float aYScale)
2521
0
  {
2522
0
    mImpl.ScaleRoundOut(aXScale, aYScale);
2523
0
    return This();
2524
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::ScaleRoundOut(float, float)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::ScaleRoundOut(float, float)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::ScaleRoundOut(float, float)
2525
2526
  Derived& ScaleInverseRoundOut (float aXScale, float aYScale)
2527
0
  {
2528
0
    mImpl.ScaleInverseRoundOut(aXScale, aYScale);
2529
0
    return This();
2530
0
  }
2531
2532
  // Prefer using TransformBy(matrix, region) from UnitTransforms.h,
2533
  // as applying the transform should typically change the unit system.
2534
  // TODO(botond): Move this to IntRegionTyped and disable it for
2535
  //               unit != UnknownUnits.
2536
  Derived& Transform (const mozilla::gfx::Matrix4x4 &aTransform)
2537
0
  {
2538
0
    mImpl.Transform(aTransform);
2539
0
    return This();
2540
0
  }
2541
2542
  /**
2543
   * Make sure the region has at most aMaxRects by adding area to it
2544
   * if necessary. The simplified region will be a superset of the
2545
   * original region. The simplified region's bounding box will be
2546
   * the same as for the current region.
2547
   */
2548
  void SimplifyOutward (uint32_t aMaxRects)
2549
0
  {
2550
0
    mImpl.SimplifyOutward (aMaxRects);
2551
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::SimplifyOutward(unsigned int)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::SimplifyOutward(unsigned int)
2552
  void SimplifyOutwardByArea (uint32_t aThreshold)
2553
0
  {
2554
0
    mImpl.SimplifyOutwardByArea (aThreshold);
2555
0
  }
2556
  /**
2557
   * Make sure the region has at most aMaxRects by removing area from
2558
   * it if necessary. The simplified region will be a subset of the
2559
   * original region.
2560
   */
2561
  void SimplifyInward (uint32_t aMaxRects)
2562
  {
2563
    mImpl.SimplifyInward (aMaxRects);
2564
  }
2565
2566
  typedef void (*visitFn)(void *closure, VisitSide side, int x1, int y1, int x2, int y2);
2567
  void VisitEdges (visitFn visit, void *closure) const
2568
0
  {
2569
0
    mImpl.VisitEdges (visit, closure);
2570
0
  }
2571
2572
0
  nsCString ToString() const { return mImpl.ToString(); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::ToString() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::ToString() const
2573
2574
  class RectIterator
2575
  {
2576
    nsRegion::RectIterator mImpl; // The underlying iterator.
2577
    mutable Rect mTmp;            // The most recently gotten rectangle.
2578
2579
  public:
2580
    explicit RectIterator(const BaseIntRegion& aRegion)
2581
      : mImpl(aRegion.mImpl)
2582
0
    {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator::RectIterator(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator::RectIterator(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator::RectIterator(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::RectIterator::RectIterator(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> > const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::RectIterator::RectIterator(mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> > const&)
2583
2584
0
    bool Done() const { return mImpl.Done(); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator::Done() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator::Done() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator::Done() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::RectIterator::Done() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::RectIterator::Done() const
2585
2586
    const Rect& Get() const
2587
0
    {
2588
0
      mTmp = FromRect(mImpl.Get());
2589
0
      return mTmp;
2590
0
    }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator::Get() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator::Get() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator::Get() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::RectIterator::Get() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::RectIterator::Get() const
2591
2592
0
    void Next() { mImpl.Next(); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIterator::Next()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIterator::Next()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIterator::Next()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::RectIterator::Next()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::RectIterator::Next()
2593
  };
2594
2595
0
  RectIterator RectIter() const { return RectIterator(*this); }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::RectIter() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::RectIter() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::RectIter() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::RectIter() const
2596
2597
protected:
2598
  // Expose enough to derived classes from them to define conversions
2599
  // between different types of BaseIntRegions.
2600
0
  explicit BaseIntRegion(const nsRegion& aImpl) : mImpl(aImpl) {}
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::BaseIntRegion(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::BaseIntRegion(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSTransformedLayerPixel> >::BaseIntRegion(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::BaseIntRegion(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::BaseIntRegion(nsRegion const&)
2601
0
  const nsRegion& Impl() const { return mImpl; }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::Impl() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::Impl() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSTransformedLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSTransformedLayerPixel> >::Impl() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::Impl() const
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::Impl() const
2602
private:
2603
  nsRegion mImpl;
2604
2605
  static nsRect ToRect(const Rect& aRect)
2606
0
  {
2607
0
    return nsRect (aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
2608
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::ToRect(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::ToRect(mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::ToRect(mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::ToRect(mozilla::gfx::IntRectTyped<mozilla::CSSPixel> const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::ToRect(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
2609
  static Rect FromRect(const nsRect& aRect)
2610
0
  {
2611
0
    return Rect (aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
2612
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::FromRect(nsRect const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::FromRect(nsRect const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::FromRect(nsRect const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::FromRect(nsRect const&)
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::FromRect(nsRect const&)
2613
2614
  Derived& This()
2615
0
  {
2616
0
    return *static_cast<Derived*>(this);
2617
0
  }
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntMarginTyped<mozilla::gfx::UnknownUnits> >::This()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>, mozilla::gfx::IntRectTyped<mozilla::LayerPixel>, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::LayerPixel> >::This()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntMarginTyped<mozilla::LayoutDevicePixel> >::This()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntMarginTyped<mozilla::ParentLayerPixel> >::This()
Unexecuted instantiation: mozilla::gfx::BaseIntRegion<mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>, mozilla::gfx::IntRectTyped<mozilla::CSSPixel>, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntMarginTyped<mozilla::CSSPixel> >::This()
2618
  const Derived& This() const
2619
  {
2620
    return *static_cast<const Derived*>(this);
2621
  }
2622
};
2623
2624
template <class units>
2625
class IntRegionTyped :
2626
    public BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>>
2627
{
2628
  typedef BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>> Super;
2629
2630
  // Make other specializations of IntRegionTyped friends.
2631
  template <typename OtherUnits>
2632
  friend class IntRegionTyped;
2633
2634
  static_assert(IsPixel<units>::value, "'units' must be a coordinate system tag");
2635
2636
public:
2637
  typedef IntRectTyped<units> RectType;
2638
  typedef IntPointTyped<units> PointType;
2639
  typedef IntMarginTyped<units> MarginType;
2640
2641
  // Forward constructors.
2642
0
  IntRegionTyped() {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::IntRegionTyped()
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::IntRegionTyped()
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::IntRegionTyped()
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::IntRegionTyped()
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>::IntRegionTyped()
2643
0
  MOZ_IMPLICIT IntRegionTyped(const IntRectTyped<units>& aRect) : Super(aRect) {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::IntRegionTyped(mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::IntRegionTyped(mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::IntRegionTyped(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&)
2644
0
  IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel> const&)
2645
0
  explicit IntRegionTyped(mozilla::gfx::ArrayView<pixman_box32_t> aRects) : Super(aRects) {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::IntRegionTyped(mozilla::gfx::ArrayView<pixman_box32>)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::IntRegionTyped(mozilla::gfx::ArrayView<pixman_box32>)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::IntRegionTyped(mozilla::gfx::ArrayView<pixman_box32>)
2646
0
  IntRegionTyped(IntRegionTyped&& aRegion) : Super(std::move(aRegion)) {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>::IntRegionTyped(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>&&)
2647
2648
  // Assignment operators need to be forwarded as well, otherwise the compiler
2649
  // will declare deleted ones.
2650
  IntRegionTyped& operator=(const IntRegionTyped& aRegion)
2651
0
  {
2652
0
    return Super::operator=(aRegion);
2653
0
  }
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::operator=(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel> const&)
2654
  IntRegionTyped& operator=(IntRegionTyped&& aRegion)
2655
0
  {
2656
0
    return Super::operator=(std::move(aRegion));
2657
0
  }
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::operator=(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>&&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>::operator=(mozilla::gfx::IntRegionTyped<mozilla::CSSPixel>&&)
2658
2659
  static IntRegionTyped FromUnknownRegion(const IntRegion& aRegion)
2660
0
  {
2661
0
    return IntRegionTyped(aRegion.Impl());
2662
0
  }
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel>::FromUnknownRegion(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::FromUnknownRegion(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::FromUnknownRegion(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::FromUnknownRegion(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&)
2663
  IntRegion ToUnknownRegion() const
2664
0
  {
2665
0
    // Need |this->| because Impl() is defined in a dependent base class.
2666
0
    return IntRegion(this->Impl());
2667
0
  }
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::ToUnknownRegion() const
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel>::ToUnknownRegion() const
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::ToUnknownRegion() const
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::ToUnknownRegion() const
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::ToUnknownRegion() const
2668
private:
2669
  // This is deliberately private, so calling code uses FromUnknownRegion().
2670
0
  explicit IntRegionTyped(const nsRegion& aRegion) : Super(aRegion) {}
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits>::IntRegionTyped(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel>::IntRegionTyped(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel>::IntRegionTyped(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayoutDevicePixel>::IntRegionTyped(nsRegion const&)
Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel>::IntRegionTyped(nsRegion const&)
2671
};
2672
2673
} // namespace gfx
2674
} // namespace mozilla
2675
2676
typedef mozilla::gfx::IntRegion nsIntRegion;
2677
2678
#endif