1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00

Fixed stack allocation bug in optimised win32 builds

This commit is contained in:
Julian Storer 2009-12-21 11:49:38 +00:00
parent 9e53cdc78e
commit af7d523f4f
2 changed files with 52 additions and 6 deletions

View file

@ -82280,8 +82280,15 @@ public:
pixelOffset (betterQuality_ ? 0.5f : 0.0f),
pixelOffsetInt (betterQuality_ ? -128 : 0),
maxX (srcData_.width - 1),
maxY (srcData_.height - 1)
maxY (srcData_.height - 1),
scratchSize (2048)
{
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
~TransformedImageFillEdgeTableRenderer() throw()
{
juce_free (scratchBuffer);
}
forcedinline void setEdgeTableYPos (const int newY) throw()
@ -82303,7 +82310,14 @@ public:
forcedinline void handleEdgeTableLine (const int x, int width, int alphaLevel) throw()
{
SrcPixelType* span = (SrcPixelType*) alloca (sizeof (SrcPixelType) * width);
if (width > scratchSize)
{
scratchSize = width;
juce_free (scratchBuffer);
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
SrcPixelType* span = scratchBuffer;
generate (span, x, width);
DestPixelType* dest = linePixels + x;
@ -82328,7 +82342,14 @@ public:
void clipEdgeTableLine (EdgeTable& et, int x, int y_, int width) throw()
{
uint8* mask = (uint8*) alloca (sizeof (SrcPixelType) * width);
if (width > scratchSize)
{
scratchSize = width;
juce_free (scratchBuffer);
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
uint8* mask = (uint8*) scratchBuffer;
y = y_;
generate ((SrcPixelType*) mask, x, width);
@ -82633,6 +82654,8 @@ private:
const int pixelOffsetInt, maxX, maxY;
int y;
DestPixelType* linePixels;
SrcPixelType* scratchBuffer;
int scratchSize;
TransformedImageFillEdgeTableRenderer (const TransformedImageFillEdgeTableRenderer&);
const TransformedImageFillEdgeTableRenderer& operator= (const TransformedImageFillEdgeTableRenderer&);

View file

@ -517,8 +517,15 @@ public:
pixelOffset (betterQuality_ ? 0.5f : 0.0f),
pixelOffsetInt (betterQuality_ ? -128 : 0),
maxX (srcData_.width - 1),
maxY (srcData_.height - 1)
maxY (srcData_.height - 1),
scratchSize (2048)
{
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
~TransformedImageFillEdgeTableRenderer() throw()
{
juce_free (scratchBuffer);
}
forcedinline void setEdgeTableYPos (const int newY) throw()
@ -540,7 +547,14 @@ public:
forcedinline void handleEdgeTableLine (const int x, int width, int alphaLevel) throw()
{
SrcPixelType* span = (SrcPixelType*) alloca (sizeof (SrcPixelType) * width);
if (width > scratchSize)
{
scratchSize = width;
juce_free (scratchBuffer);
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
SrcPixelType* span = scratchBuffer;
generate (span, x, width);
DestPixelType* dest = linePixels + x;
@ -565,7 +579,14 @@ public:
void clipEdgeTableLine (EdgeTable& et, int x, int y_, int width) throw()
{
uint8* mask = (uint8*) alloca (sizeof (SrcPixelType) * width);
if (width > scratchSize)
{
scratchSize = width;
juce_free (scratchBuffer);
scratchBuffer = (SrcPixelType*) juce_malloc (scratchSize * sizeof (SrcPixelType));
}
uint8* mask = (uint8*) scratchBuffer;
y = y_;
generate ((SrcPixelType*) mask, x, width);
@ -872,6 +893,8 @@ private:
const int pixelOffsetInt, maxX, maxY;
int y;
DestPixelType* linePixels;
SrcPixelType* scratchBuffer;
int scratchSize;
TransformedImageFillEdgeTableRenderer (const TransformedImageFillEdgeTableRenderer&);
const TransformedImageFillEdgeTableRenderer& operator= (const TransformedImageFillEdgeTableRenderer&);