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

CoreGraphics alpha-channel clipping fix.

This commit is contained in:
Julian Storer 2011-01-12 10:20:27 +00:00
parent b0ba2f7388
commit 88ca4b9901
3 changed files with 15 additions and 10 deletions

View file

@ -95464,7 +95464,8 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const
if (image == 0 || newFormat == image->format)
return *this;
Image newImage (newFormat, image->width, image->height, false, image->getType());
const int w = image->width, h = image->height;
Image newImage (newFormat, w, h, false, image->getType());
if (newFormat == SingleChannel)
{
@ -95474,15 +95475,15 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const
}
else
{
const BitmapData destData (newImage, 0, 0, image->width, image->height, true);
const BitmapData srcData (*this, 0, 0, image->width, image->height);
const BitmapData destData (newImage, 0, 0, w, h, true);
const BitmapData srcData (*this, 0, 0, w, h);
for (int y = 0; y < image->height; ++y)
for (int y = 0; y < h; ++y)
{
const PixelARGB* src = (const PixelARGB*) srcData.getLinePointer(y);
uint8* dst = destData.getLinePointer (y);
for (int x = image->width; --x >= 0;)
for (int x = w; --x >= 0;)
{
*dst++ = src->getAlpha();
++src;
@ -266125,6 +266126,7 @@ public:
applyTransform (t.inverted());
flip();
CGContextFlush (context);
CGImageRelease (image);
lastClipRectIsValid = false;
}
@ -270821,6 +270823,7 @@ public:
applyTransform (t.inverted());
flip();
CGContextFlush (context);
CGImageRelease (image);
lastClipRectIsValid = false;
}

View file

@ -209,7 +209,8 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const
if (image == 0 || newFormat == image->format)
return *this;
Image newImage (newFormat, image->width, image->height, false, image->getType());
const int w = image->width, h = image->height;
Image newImage (newFormat, w, h, false, image->getType());
if (newFormat == SingleChannel)
{
@ -219,15 +220,15 @@ const Image Image::convertedToFormat (PixelFormat newFormat) const
}
else
{
const BitmapData destData (newImage, 0, 0, image->width, image->height, true);
const BitmapData srcData (*this, 0, 0, image->width, image->height);
const BitmapData destData (newImage, 0, 0, w, h, true);
const BitmapData srcData (*this, 0, 0, w, h);
for (int y = 0; y < image->height; ++y)
for (int y = 0; y < h; ++y)
{
const PixelARGB* src = (const PixelARGB*) srcData.getLinePointer(y);
uint8* dst = destData.getLinePointer (y);
for (int x = image->width; --x >= 0;)
for (int x = w; --x >= 0;)
{
*dst++ = src->getAlpha();
++src;

View file

@ -277,6 +277,7 @@ public:
applyTransform (t.inverted());
flip();
CGContextFlush (context);
CGImageRelease (image);
lastClipRectIsValid = false;
}