43 for (
int i =
bounds.getHeight(); --
i >= 0;)
83 const double startX = 256.0f * iter.
x1;
84 const double multiplier = (iter.
x2 - iter.
x1) / (iter.
y2 - iter.
y1);
85 auto stepSize =
jlimit (1, 256, 256 / (1 + (
int) std::abs (multiplier)));
89 auto step =
jmin (stepSize, y2 - y1, 256 - (y1 & 255));
90 auto x =
roundToInt (startX + multiplier * ((y1 + (step >> 1)) - startY));
94 else if (
x >= rightLimit)
109 :
bounds (rectangleToAdd),
120 for (
int i = rectangleToAdd.
getHeight(); --
i >= 0;)
132 :
bounds (rectanglesToAdd.getBounds()),
140 for (
auto&
r : rectanglesToAdd)
142 auto x1 =
scale *
r.getX();
143 auto x2 =
scale *
r.getRight();
146 for (
int j =
r.getHeight(); --
j >= 0;)
154 :
bounds (rectanglesToAdd.getBounds().getSmallestIntegerContainer()),
162 for (
auto&
r : rectanglesToAdd)
170 if (x2 <= x1 || y2 <= y1)
174 auto lastLine = y2 /
scale;
198 2 + (
int) rectangleToAdd.getWidth(),
199 2 + (
int) rectangleToAdd.getHeight()),
213 if (x2 <= x1 || y2 <= y1)
236 t[2] = 255 - (y1 & 255);
242 while (lineY < (y2 /
scale))
263 while (lineY <
bounds.getHeight())
296 return (
size_t) (lineStride * (2 +
jmax (0,
height)));
308 for (
int i =
bounds.getHeight(); --
i >= 0;)
317 while (--numLines >= 0)
319 memcpy (dest, src, (
size_t) (src[0] * 2 + 1) *
sizeof (
int));
320 src += srcLineStride;
321 dest += destLineStride;
328 int* lineStart =
table;
330 for (
int y =
bounds.getHeight(); --
y >= 0;)
332 auto num = lineStart[0];
336 auto* items =
reinterpret_cast<LineItem*
> (lineStart + 1);
337 auto* itemsEnd = items + num;
340 std::sort (items, itemsEnd);
343 auto correctedNum = num;
346 while (src < itemsEnd)
352 while (src < itemsEnd && src->
x ==
x)
359 auto corrected = std::abs (level);
361 if (corrected /
scale)
363 if (useNonZeroWinding)
371 if (corrected /
scale)
372 corrected = 511 - corrected;
377 items->level = corrected;
381 lineStart[0] = correctedNum;
382 (items - 1)->level = 0;
402 table.swapWith (newTable);
415 int maxLineElements = 0;
417 for (
int i =
bounds.getHeight(); --
i >= 0;)
428 auto numPoints = line[0];
436 line[0] = numPoints + 1;
437 line += numPoints * 2;
447 auto numPoints = line[0];
455 line[0] = numPoints + 2;
456 line += numPoints * 2;
465 bounds.translate ((
int) std::floor (dx),
dy);
467 int* lineStart =
table;
468 auto intDx = (
int) (dx * 256.0f);
470 for (
int i =
bounds.getHeight(); --
i >= 0;)
472 auto* line = lineStart;
486 int* lineStart =
table;
487 auto multiplier = (
int) (amount * 256.0f);
489 for (
int y = 0;
y <
bounds.getHeight(); ++
y)
491 auto numPoints = lineStart[0];
492 auto* item =
reinterpret_cast<LineItem*
> (lineStart + 1);
495 while (--numPoints > 0)
497 item->level =
jmin (255, (item->level * multiplier) /
scale);
508 auto srcNum1 = *srcLine;
513 auto srcNum2 = *otherLine;
525 if (srcNum2 == 2 && otherLine[2] >= 255)
531 bool isUsingTempSpace =
false;
533 const int* src1 = srcLine + 1;
536 const int* src2 = otherLine + 1;
539 int destIndex = 0, destTotal = 0;
540 int level1 = 0, level2 = 0;
541 int lastX = std::numeric_limits<int>::min(), lastLevel = 0;
543 while (srcNum1 > 0 && srcNum2 > 0)
576 auto nextLevel = (level1 * (level2 + 1)) /
scale;
579 if (nextLevel != lastLevel)
583 srcLine[0] = destTotal;
585 if (isUsingTempSpace)
587 auto tempSize = (size_t) srcNum1 * 2 *
sizeof (
int);
588 auto oldTemp =
static_cast<int*
> (alloca (tempSize));
589 memcpy (oldTemp, src1, tempSize);
595 memcpy (newTemp, oldTemp, tempSize);
606 lastLevel = nextLevel;
608 if (! isUsingTempSpace)
610 isUsingTempSpace =
true;
612 memcpy (temp, src1, (
size_t) srcNum1 * 2 *
sizeof (
int));
616 srcLine[++destIndex] = nextX;
617 srcLine[++destIndex] = nextLevel;
626 srcLine[0] = destTotal;
632 srcLine[++destIndex] =
right;
633 srcLine[++destIndex] = 0;
636 srcLine[0] = destTotal;
641 int* lastItem = dest + (dest[0] * 2 - 1);
643 if (x2 < lastItem[0])
651 while (x2 < lastItem[-2])
663 while (lastItem[0] > x1)
666 auto itemsRemoved = (
int) (lastItem - (dest + 1)) / 2;
668 if (itemsRemoved > 0)
670 dest[0] -= itemsRemoved;
671 memmove (dest + 1, lastItem, (
size_t) dest[0] * (
sizeof (
int) * 2));
682 auto clipped =
r.getIntersection (
bounds);
684 if (clipped.isEmpty())
691 auto top = clipped.getY() -
bounds.getY();
692 auto bottom = clipped.getBottom() -
bounds.getY();
694 if (bottom <
bounds.getHeight())
695 bounds.setHeight (bottom);
697 for (
int i = 0;
i < top; ++
i)
700 if (clipped.getX() >
bounds.getX() || clipped.getRight() <
bounds.getRight())
702 auto x1 =
scale * clipped.getX();
706 for (
int i = bottom - top; --
i >= 0;)
721 auto clipped =
r.getIntersection (
bounds);
723 if (! clipped.isEmpty())
725 auto top = clipped.getY() -
bounds.getY();
726 auto bottom = clipped.getBottom() -
bounds.getY();
728 const int rectLine[] = { 4, std::numeric_limits<int>::min(), 255,
729 scale * clipped.getX(), 0,
730 scale * clipped.getRight(), 255,
731 std::numeric_limits<int>::max(), 0 };
733 for (
int i = top;
i < bottom; ++
i)
744 if (clipped.isEmpty())
751 auto top = clipped.getY() -
bounds.getY();
752 auto bottom = clipped.getBottom() -
bounds.getY();
754 if (bottom <
bounds.getHeight())
755 bounds.setHeight (bottom);
757 if (clipped.getRight() <
bounds.getRight())
758 bounds.setRight (clipped.getRight());
760 for (
int i = 0;
i < top; ++
i)
765 for (
int i = top;
i < bottom; ++
i)
790 auto* tempLine =
static_cast<int*
> (alloca ((
size_t) (numPixels * 2 + 4) *
sizeof (
int)));
791 int destIndex = 0, lastLevel = 0;
793 while (--numPixels >= 0)
798 if (alpha != lastLevel)
800 tempLine[++destIndex] = (
x *
scale);
801 tempLine[++destIndex] = alpha;
810 tempLine[++destIndex] = (
x *
scale);
811 tempLine[++destIndex] = 0;
814 tempLine[0] = destIndex >> 1;
826 for (
int i =
bounds.getHeight(); --
i >= 0;)
837 return bounds.getHeight() == 0;
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
static const unsigned long mask[]
Definition bitwise.c:31
bool isEmpty() noexcept
Definition juce_EdgeTable.cpp:819
~EdgeTable()
Definition juce_EdgeTable.cpp:288
int maxEdgesPerLine
Definition juce_EdgeTable.h:209
static constexpr auto defaultEdgesPerLine
Definition juce_EdgeTable.h:195
static constexpr auto scale
Definition juce_EdgeTable.h:196
EdgeTable(Rectangle< int > clipLimits, const Path &pathToAdd, const AffineTransform &transform)
Definition juce_EdgeTable.cpp:31
void excludeRectangle(Rectangle< int > r)
Definition juce_EdgeTable.cpp:719
HeapBlock< int > table
Definition juce_EdgeTable.h:207
void optimiseTable()
Definition juce_EdgeTable.cpp:413
void clipToEdgeTable(const EdgeTable &)
Definition juce_EdgeTable.cpp:740
void multiplyLevels(float factor)
Definition juce_EdgeTable.cpp:484
void clipLineToMask(int x, int y, const uint8 *mask, int maskStride, int numPixels)
Definition juce_EdgeTable.cpp:775
void translate(float dx, int dy) noexcept
Definition juce_EdgeTable.cpp:463
void remapTableForNumEdges(int newNumEdgesPerLine)
Definition juce_EdgeTable.cpp:389
bool needToCheckEmptiness
Definition juce_EdgeTable.h:210
void clearLineSizes() noexcept
Definition juce_EdgeTable.cpp:304
static void copyEdgeTableData(int *dest, int destLineStride, const int *src, int srcLineStride, int numLines) noexcept
Definition juce_EdgeTable.cpp:315
void remapWithExtraSpace(int numPointsNeeded)
Definition juce_EdgeTable.cpp:407
int lineStrideElements
Definition juce_EdgeTable.h:209
void intersectWithEdgeTableLine(int y, const int *otherLine)
Definition juce_EdgeTable.cpp:503
void clipToRectangle(Rectangle< int > r)
Definition juce_EdgeTable.cpp:680
void allocate()
Definition juce_EdgeTable.cpp:299
Rectangle< int > bounds
Definition juce_EdgeTable.h:208
void sanitiseLevels(bool useNonZeroWinding) noexcept
Definition juce_EdgeTable.cpp:325
void addEdgePointPair(int x1, int x2, int y, int winding)
Definition juce_EdgeTable.cpp:442
void clipEdgeTableLineToRange(int *line, int x1, int x2) noexcept
Definition juce_EdgeTable.cpp:639
void addEdgePoint(int x, int y, int winding)
Definition juce_EdgeTable.cpp:423
Definition juce_HeapBlock.h:87
Definition juce_PathIterator.h:42
bool next()
Definition juce_PathIterator.cpp:60
float y2
Definition juce_PathIterator.h:76
float x2
Definition juce_PathIterator.h:75
float y1
Definition juce_PathIterator.h:74
float x1
Definition juce_PathIterator.h:73
Definition juce_Path.h:65
Definition juce_Rectangle.h:67
ValueType getRight() const noexcept
Definition juce_Rectangle.h:139
Rectangle getIntersection(Rectangle other) const noexcept
Definition juce_Rectangle.h:664
ValueType getHeight() const noexcept
Definition juce_Rectangle.h:136
ValueType getBottom() const noexcept
Definition juce_Rectangle.h:142
ValueType getX() const noexcept
Definition juce_Rectangle.h:127
bool isEmpty() const noexcept
Definition juce_Rectangle.h:121
ValueType getY() const noexcept
Definition juce_Rectangle.h:130
Definition juce_RectangleList.h:43
struct huft * t
Definition inflate.c:943
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
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 right
static int int height
Definition pugl.h:1594
JSAMPIMAGE data
Definition jpeglib.h:945
#define JUCE_BEGIN_IGNORE_WARNINGS_MSVC(warnings)
Definition juce_CompilerWarnings.h:198
#define JUCE_END_IGNORE_WARNINGS_MSVC
Definition juce_CompilerWarnings.h:199
Definition carla_juce.cpp:31
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
constexpr Type jmax(Type a, Type b)
Definition juce_MathsFunctions.h:94
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Definition juce_MathsFunctions.h:262
static size_t getEdgeTableAllocationSize(int lineStride, int height) noexcept
Definition juce_EdgeTable.cpp:293
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
unsigned char uint8
Definition juce_MathsFunctions.h:37
int roundToInt(const FloatType value) noexcept
Definition juce_MathsFunctions.h:465
Definition juce_Uuid.h:141
#define true
Definition ordinals.h:82
Definition juce_EdgeTable.h:201
memcpy(hh, h, RAND_HEAD_LEN)
int r
Definition crypt.c:458
typedef int(UZ_EXP MsgFn)()
dy
Definition zipinfo.c:2288
#define const
Definition zconf.h:137