41template <
typename ValueType>
71 :
rects (std::move (other.rects))
78 rects = std::move (other.rects);
122 bool anyOverlaps =
false;
124 for (
int j =
rects.size(); --
j >= 0;)
126 auto& ourRect =
rects.getReference (
j);
132 else if (! ourRect.reduceIfPartlyContainedIn (rect))
137 if (anyOverlaps && !
isEmpty())
141 for (
auto& ourRect :
rects)
145 r.subtract (ourRect);
195 for (
auto&
r : other)
206 if (
auto numRects =
rects.size())
208 auto x1 = rect.
getX();
209 auto y1 = rect.
getY();
213 for (
int i = numRects; --
i >= 0;)
215 auto&
r =
rects.getReference (
i);
219 auto rx2 = rx1 +
r.getWidth();
220 auto ry2 = ry1 +
r.getHeight();
222 if (! (x2 <= rx1 || x1 >= rx2 || y2 <= ry1 || y1 >= ry2))
224 if (x1 > rx1 && x1 < rx2)
226 if (y1 <= ry1 && y2 >= ry2 && x2 >= rx2)
228 r.setWidth (x1 - rx1);
233 r.setWidth (rx2 - x1);
239 else if (x2 > rx1 && x2 < rx2)
242 r.setWidth (rx2 - x2);
244 if (y1 > ry1 || y2 < ry2 || x1 > rx1)
250 else if (y1 > ry1 && y1 < ry2)
252 if (x1 <= rx1 && x2 >= rx2 && y2 >= ry2)
254 r.setHeight (y1 - ry1);
259 r.setHeight (ry2 - y1);
265 else if (y2 > ry1 && y2 < ry2)
268 r.setHeight (ry2 - y2);
270 if (x1 > rx1 || x2 < rx2 || y1 > ry1)
294 for (
auto&
r : otherList)
318 bool notEmpty =
false;
326 for (
int i =
rects.size(); --
i >= 0;)
328 auto&
r =
rects.getReference (
i);
349 template <
typename OtherValueType>
357 for (
auto& rect :
rects)
359 for (
auto&
r : other)
361 auto clipped =
r.template toType<ValueType>();
363 if (rect.intersectRectangle (clipped))
364 result.rects.add (clipped);
402 rects.swapWith (otherList.rects);
412 if (
r.contains (point))
434 if (
rects.size() > 1)
438 for (
auto& rect :
rects)
448 return rects.getReference (0).contains (rectangleToCheck);
463 if (
r.intersects (rectangleToCheck))
475 if (other.intersectsRectangle (
r))
488 auto&
r =
rects.getReference (0);
490 if (
rects.size() == 1)
493 auto minX =
r.getX();
494 auto minY =
r.getY();
498 for (
int i =
rects.size(); --
i > 0;)
519 for (
int i = 0;
i <
rects.size() - 1; ++
i)
521 auto&
r =
rects.getReference (
i);
524 auto rx2 = rx1 +
r.getWidth();
525 auto ry2 = ry1 +
r.getHeight();
527 for (
int j =
rects.size(); --
j >
i;)
530 auto jrx1 =
r2.getX();
531 auto jry1 =
r2.getY();
532 auto jrx2 = jrx1 +
r2.getWidth();
533 auto jry2 = jry1 +
r2.getHeight();
537 if (jrx1 == rx2 || jrx2 == rx1)
539 if (jry1 > ry1 && jry1 < ry2)
541 r.setHeight (jry1 - ry1);
547 if (jry2 > ry1 && jry2 < ry2)
549 r.setHeight (jry2 - ry1);
554 else if (ry1 > jry1 && ry1 < jry2)
556 r2.setHeight (ry1 - jry1);
561 else if (ry2 > jry1 && ry2 < jry2)
563 r2.setHeight (ry2 - jry1);
572 for (
int i = 0;
i <
rects.size() - 1; ++
i)
574 auto&
r =
rects.getReference (
i);
576 for (
int j =
rects.size(); --
j >
i;)
578 if (
r.enlargeIfAdjacent (
rects.getReference (
j)))
602 template <
typename ScaleType>
616 r =
r.transformedBy (transform);
645 rects.ensureStorageAllocated (minNumRectangles);
Type jmin(const Type a, const Type b)
Definition MathsFunctions.h:60
Type jmax(const Type a, const Type b)
Definition MathsFunctions.h:48
#define noexcept
Definition DistrhoDefines.h:72
#define final
Definition DistrhoDefines.h:74
Definition juce_Array.h:56
Definition juce_Path.h:65
Definition juce_Point.h:42
Definition juce_Rectangle.h:67
bool intersects(Rectangle other) const noexcept
Definition juce_Rectangle.h:641
bool contains(ValueType xCoord, ValueType yCoord) const noexcept
Definition juce_Rectangle.h:622
ValueType getHeight() const noexcept
Definition juce_Rectangle.h:136
ValueType getX() const noexcept
Definition juce_Rectangle.h:127
ValueType getWidth() const noexcept
Definition juce_Rectangle.h:133
bool isFinite() const noexcept
Definition juce_Rectangle.h:124
bool isEmpty() const noexcept
Definition juce_Rectangle.h:121
ValueType getY() const noexcept
Definition juce_Rectangle.h:130
bool intersectRectangle(ValueType &otherX, ValueType &otherY, ValueType &otherW, ValueType &otherH) const noexcept
Definition juce_Rectangle.h:685
bool containsPoint(ValueType x, ValueType y) const noexcept
Definition juce_RectangleList.h:421
RectangleType getRectangle(int index) const noexcept
Definition juce_RectangleList.h:92
bool clipTo(const RectangleList< OtherValueType > &other)
Definition juce_RectangleList.h:350
void clear()
Definition juce_RectangleList.h:96
RectangleType getBounds() const noexcept
Definition juce_RectangleList.h:483
void add(ValueType x, ValueType y, ValueType width, ValueType height)
Definition juce_RectangleList.h:167
RectangleList(RectangleList &&other) noexcept
Definition juce_RectangleList.h:70
void addWithoutMerging(RectangleType rect)
Definition juce_RectangleList.h:180
void subtract(RectangleType rect)
Definition juce_RectangleList.h:204
void offsetAll(ValueType dx, ValueType dy) noexcept
Definition juce_RectangleList.h:596
void add(const RectangleList &other)
Definition juce_RectangleList.h:193
Path toPath() const
Definition juce_RectangleList.h:621
bool subtract(const RectangleList &otherList)
Definition juce_RectangleList.h:292
void offsetAll(Point< ValueType > offset) noexcept
Definition juce_RectangleList.h:589
bool intersectsRectangle(RectangleType rectangleToCheck) const noexcept
Definition juce_RectangleList.h:460
bool containsRectangle(RectangleType rectangleToCheck) const
Definition juce_RectangleList.h:432
void scaleAll(ScaleType scaleFactor) noexcept
Definition juce_RectangleList.h:603
bool intersects(const RectangleList &other) const noexcept
Definition juce_RectangleList.h:472
Rectangle< ValueType > RectangleType
Definition juce_RectangleList.h:45
bool clipTo(RectangleType rect)
Definition juce_RectangleList.h:314
const RectangleType * begin() const noexcept
Definition juce_RectangleList.h:633
bool containsPoint(Point< ValueType > point) const noexcept
Definition juce_RectangleList.h:409
const RectangleType * end() const noexcept
Definition juce_RectangleList.h:635
RectangleList(const RectangleList &other)
Definition juce_RectangleList.h:52
RectangleList(RectangleType rect)
Definition juce_RectangleList.h:57
void add(RectangleType rect)
Definition juce_RectangleList.h:110
int getNumRectangles() const noexcept
Definition juce_RectangleList.h:87
bool isEmpty() const noexcept
Definition juce_RectangleList.h:84
void swapWith(RectangleList &otherList) noexcept
Definition juce_RectangleList.h:400
void ensureStorageAllocated(int minNumRectangles)
Definition juce_RectangleList.h:643
void consolidate()
Definition juce_RectangleList.h:517
bool getIntersectionWith(RectangleType rect, RectangleList &destRegion) const
Definition juce_RectangleList.h:381
void transformAll(const AffineTransform &transform) noexcept
Definition juce_RectangleList.h:613
Array< RectangleType > rects
Definition juce_RectangleList.h:650
register unsigned j
Definition inflate.c:1576
int y
Definition inflate.c:1588
register unsigned i
Definition inflate.c:1575
unsigned x[BMAX+1]
Definition inflate.c:1586
static void r2(register WDL_FFT_REAL *a)
Definition fft.c:1089
static int int minY
Definition pugl.h:1627
static int minX
Definition pugl.h:1626
static int int height
Definition pugl.h:1594
static int int int int maxY
Definition pugl.h:1630
static int width
Definition pugl.h:1593
static int int int maxX
Definition pugl.h:1628
Definition carla_juce.cpp:31
uch * p
Definition crypt.c:594
int r
Definition crypt.c:458
int result
Definition process.c:1455
dy
Definition zipinfo.c:2288
#define const
Definition zconf.h:137