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

Fix for CoreGraphics image loading on iOS. Auto-linked library fix for win32.

This commit is contained in:
Julian Storer 2010-09-01 14:29:16 +01:00
parent 5a89fc6ad8
commit f953c19efb
6 changed files with 1691 additions and 1601 deletions

File diff suppressed because it is too large Load diff

View file

@ -43956,8 +43956,8 @@ void DrawableButton::paintButton (Graphics& g,
{
g.setFont ((float) textH);
g.setColour (getLookAndFeel().findColour (DrawableButton::textColourId)
.withMultipliedAlpha (isEnabled() ? 1.0f : 0.4f));
g.setColour (findColour (DrawableButton::textColourId)
.withMultipliedAlpha (isEnabled() ? 1.0f : 0.4f));
g.drawFittedText (getButtonText(),
2, getHeight() - textH - 1,
@ -77682,6 +77682,12 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo)
(uint8) 0x50));
}
#endif
/** If this fails, it's probably be because your CPU floating-point precision mode has
been set to low.. This setting is sometimes changed by things like Direct3D, and can
mess up a lot of the calculations that the library needs to do.
*/
jassert (roundToInt (10.1f) == 10);
}
bool ComponentPeer::handleKeyPress (const int keyCode,
@ -254321,9 +254327,22 @@ CameraDevice* CameraDevice::openDevice (int index,
#pragma comment(lib, "oleaut32.lib")
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "comsupp.lib")
#pragma comment(lib, "version.lib")
#ifdef _NATIVE_WCHAR_T_DEFINED
#ifdef _DEBUG
#pragma comment(lib, "comsuppwd.lib")
#else
#pragma comment(lib, "comsuppw.lib")
#endif
#else
#ifdef _DEBUG
#pragma comment(lib, "comsuppd.lib")
#else
#pragma comment(lib, "comsupp.lib")
#endif
#endif
#if JUCE_OPENGL
#pragma comment(lib, "OpenGL32.Lib")
#pragma comment(lib, "GlU32.Lib")
@ -266963,6 +266982,15 @@ const Image juce_loadWithCoreImage (InputStream& input)
MemoryBlock data;
input.readIntoMemoryBlock (data, -1);
#if JUCE_IOS
JUCE_AUTORELEASEPOOL
UIImage* image = [UIImage imageWithData: [NSData dataWithBytesNoCopy: data.getData() length: data.getSize()]];
if (image != nil)
{
CGImageRef loadedImage = image.CGImage;
#else
CGDataProviderRef provider = CGDataProviderCreateWithData (0, data.getData(), data.getSize(), 0);
CGImageSourceRef imageSource = CGImageSourceCreateWithDataProvider (provider, 0);
CGDataProviderRelease (provider);
@ -266971,6 +266999,7 @@ const Image juce_loadWithCoreImage (InputStream& input)
{
CGImageRef loadedImage = CGImageSourceCreateImageAtIndex (imageSource, 0, 0);
CFRelease (imageSource);
#endif
if (loadedImage != 0)
{
@ -266984,7 +267013,10 @@ const Image juce_loadWithCoreImage (InputStream& input)
CGContextDrawImage (cgImage->context, CGRectMake (0, 0, image.getWidth(), image.getHeight()), loadedImage);
CGContextFlush (cgImage->context);
#if ! JUCE_IOS
CFRelease (loadedImage);
#endif
return image;
}
@ -271630,6 +271662,15 @@ const Image juce_loadWithCoreImage (InputStream& input)
MemoryBlock data;
input.readIntoMemoryBlock (data, -1);
#if JUCE_IOS
JUCE_AUTORELEASEPOOL
UIImage* image = [UIImage imageWithData: [NSData dataWithBytesNoCopy: data.getData() length: data.getSize()]];
if (image != nil)
{
CGImageRef loadedImage = image.CGImage;
#else
CGDataProviderRef provider = CGDataProviderCreateWithData (0, data.getData(), data.getSize(), 0);
CGImageSourceRef imageSource = CGImageSourceCreateWithDataProvider (provider, 0);
CGDataProviderRelease (provider);
@ -271638,6 +271679,7 @@ const Image juce_loadWithCoreImage (InputStream& input)
{
CGImageRef loadedImage = CGImageSourceCreateImageAtIndex (imageSource, 0, 0);
CFRelease (imageSource);
#endif
if (loadedImage != 0)
{
@ -271651,7 +271693,10 @@ const Image juce_loadWithCoreImage (InputStream& input)
CGContextDrawImage (cgImage->context, CGRectMake (0, 0, image.getWidth(), image.getHeight()), loadedImage);
CGContextFlush (cgImage->context);
#if ! JUCE_IOS
CFRelease (loadedImage);
#endif
return image;
}

View file

@ -61486,9 +61486,22 @@ END_JUCE_NAMESPACE
#pragma comment(lib, "oleaut32.lib")
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "comsupp.lib")
#pragma comment(lib, "version.lib")
#ifdef _NATIVE_WCHAR_T_DEFINED
#ifdef _DEBUG
#pragma comment(lib, "comsuppwd.lib")
#else
#pragma comment(lib, "comsuppw.lib")
#endif
#else
#ifdef _DEBUG
#pragma comment(lib, "comsuppd.lib")
#else
#pragma comment(lib, "comsupp.lib")
#endif
#endif
#if JUCE_OPENGL
#pragma comment(lib, "OpenGL32.Lib")
#pragma comment(lib, "GlU32.Lib")

View file

@ -142,6 +142,12 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo)
(uint8) 0x50));
}
#endif
/** If this fails, it's probably be because your CPU floating-point precision mode has
been set to low.. This setting is sometimes changed by things like Direct3D, and can
mess up a lot of the calculations that the library needs to do.
*/
jassert (roundToInt (10.1f) == 10);
}
bool ComponentPeer::handleKeyPress (const int keyCode,

View file

@ -777,6 +777,15 @@ const Image juce_loadWithCoreImage (InputStream& input)
MemoryBlock data;
input.readIntoMemoryBlock (data, -1);
#if JUCE_IOS
JUCE_AUTORELEASEPOOL
UIImage* image = [UIImage imageWithData: [NSData dataWithBytesNoCopy: data.getData() length: data.getSize()]];
if (image != nil)
{
CGImageRef loadedImage = image.CGImage;
#else
CGDataProviderRef provider = CGDataProviderCreateWithData (0, data.getData(), data.getSize(), 0);
CGImageSourceRef imageSource = CGImageSourceCreateWithDataProvider (provider, 0);
CGDataProviderRelease (provider);
@ -785,6 +794,7 @@ const Image juce_loadWithCoreImage (InputStream& input)
{
CGImageRef loadedImage = CGImageSourceCreateImageAtIndex (imageSource, 0, 0);
CFRelease (imageSource);
#endif
if (loadedImage != 0)
{
@ -798,7 +808,10 @@ const Image juce_loadWithCoreImage (InputStream& input)
CGContextDrawImage (cgImage->context, CGRectMake (0, 0, image.getWidth(), image.getHeight()), loadedImage);
CGContextFlush (cgImage->context);
#if ! JUCE_IOS
CFRelease (loadedImage);
#endif
return image;
}

View file

@ -12,9 +12,22 @@
#pragma comment(lib, "oleaut32.lib")
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "comsupp.lib")
#pragma comment(lib, "version.lib")
#ifdef _NATIVE_WCHAR_T_DEFINED
#ifdef _DEBUG
#pragma comment(lib, "comsuppwd.lib")
#else
#pragma comment(lib, "comsuppw.lib")
#endif
#else
#ifdef _DEBUG
#pragma comment(lib, "comsuppd.lib")
#else
#pragma comment(lib, "comsupp.lib")
#endif
#endif
#if JUCE_OPENGL
#pragma comment(lib, "OpenGL32.Lib")
#pragma comment(lib, "GlU32.Lib")