Browse Source

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

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
f953c19efb
6 changed files with 1691 additions and 1601 deletions
  1. +1596
    -1596
      extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp
  2. +48
    -3
      juce_amalgamated.cpp
  3. +14
    -1
      juce_amalgamated.h
  4. +6
    -0
      src/gui/components/windows/juce_ComponentPeer.cpp
  5. +13
    -0
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  6. +14
    -1
      src/native/windows/juce_win32_AutoLinkLibraries.h

+ 1596
- 1596
extras/audio plugins/wrapper/VST/juce_VST_Wrapper.cpp
File diff suppressed because it is too large
View File


+ 48
- 3
juce_amalgamated.cpp 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;
}


+ 14
- 1
juce_amalgamated.h 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")


+ 6
- 0
src/gui/components/windows/juce_ComponentPeer.cpp 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,


+ 13
- 0
src/native/mac/juce_mac_CoreGraphicsContext.mm 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;
}


+ 14
- 1
src/native/windows/juce_win32_AutoLinkLibraries.h 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")


Loading…
Cancel
Save