diff --git a/build/macosx/platform_specific_code/juce_mac_MiscUtilities.mm b/build/macosx/platform_specific_code/juce_mac_MiscUtilities.mm index 5001614f35..60a2083421 100644 --- a/build/macosx/platform_specific_code/juce_mac_MiscUtilities.mm +++ b/build/macosx/platform_specific_code/juce_mac_MiscUtilities.mm @@ -78,7 +78,7 @@ bool AlertWindow::showNativeDialogBox (const String& title, juceStringToNS (bodyText), @"Ok", isOkCancel ? @"Cancel" : nil, - nil) == 0; + nil) == NSAlertDefaultReturn; } //============================================================================== diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index d122ff6b4e..88c8b2f61b 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -20306,6 +20306,56 @@ struct BWAVChunk } PACKED; +struct SMPLChunk +{ + struct SampleLoop + { + uint32 identifier; + uint32 type; + uint32 start; + uint32 end; + uint32 fraction; + uint32 playCount; + } PACKED; + + uint32 manufacturer; + uint32 product; + uint32 samplePeriod; + uint32 midiUnityNote; + uint32 midiPitchFraction; + uint32 smpteFormat; + uint32 smpteOffset; + uint32 numSampleLoops; + uint32 samplerData; + SampleLoop loops[1]; + + void copyTo (StringPairArray& values, const int totalSize) const + { + values.set (T("Manufacturer"), String (swapIfBigEndian (manufacturer))); + values.set (T("Product"), String (swapIfBigEndian (product))); + values.set (T("SamplePeriod"), String (swapIfBigEndian (samplePeriod))); + values.set (T("MidiUnityNote"), String (swapIfBigEndian (midiUnityNote))); + values.set (T("MidiPitchFraction"), String (swapIfBigEndian (midiPitchFraction))); + values.set (T("SmpteFormat"), String (swapIfBigEndian (smpteFormat))); + values.set (T("SmpteOffset"), String (swapIfBigEndian (smpteOffset))); + values.set (T("NumSampleLoops"), String (swapIfBigEndian (numSampleLoops))); + values.set (T("SamplerData"), String (swapIfBigEndian (samplerData))); + + for (uint32 i = 0; i < numSampleLoops; ++i) + { + if ((uint8*) (loops + (i + 1)) > ((uint8*) this) + totalSize) + break; + + values.set (String::formatted (T("Loop%dIdentifier"), i), String (swapIfBigEndian (loops[i].identifier))); + values.set (String::formatted (T("Loop%dType"), i), String (swapIfBigEndian (loops[i].type))); + values.set (String::formatted (T("Loop%dStart"), i), String (swapIfBigEndian (loops[i].start))); + values.set (String::formatted (T("Loop%dEnd"), i), String (swapIfBigEndian (loops[i].end))); + values.set (String::formatted (T("Loop%dFraction"), i), String (swapIfBigEndian (loops[i].fraction))); + values.set (String::formatted (T("Loop%dPlayCount"), i), String (swapIfBigEndian (loops[i].playCount))); + } + } +} PACKED; + #if JUCE_MSVC #pragma pack (pop) #endif @@ -20383,15 +20433,18 @@ public: // Broadcast-wav extension chunk.. BWAVChunk* const bwav = (BWAVChunk*) juce_calloc (jmax (length + 1, (int) sizeof (BWAVChunk))); - - if (bwav != 0) - { - input->read (bwav, length); - bwav->copyTo (metadataValues); - juce_free (bwav); - } + input->read (bwav, length); + bwav->copyTo (metadataValues); + juce_free (bwav); } - else if ((hasGotType && hasGotData) || chunkEnd <= input->getPosition()) + else if (chunkType == chunkName ("smpl")) + { + SMPLChunk* const smpl = (SMPLChunk*) juce_calloc (jmax (length + 1, (int) sizeof (SMPLChunk))); + input->read (smpl, length); + smpl->copyTo (metadataValues, length); + juce_free (smpl); + } + else if (chunkEnd <= input->getPosition()) { break; } @@ -78941,36 +78994,71 @@ static void transformedImageRender (Image& destImage, if (quality == Graphics::lowResamplingQuality) // nearest-neighbour.. { - for (int y = 0; y < destClipH; ++y) + if (alpha == 255) { - double sx = srcX; - double sy = srcY; - - DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); - - for (int x = 0; x < destClipW; ++x) + for (int y = 0; y < destClipH; ++y) { - const int ix = roundDoubleToInt (floor (sx)) - srcClipX; + double sx = srcX; + double sy = srcY; - if (((unsigned int) ix) < (unsigned int) srcClipWidth) + DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); + + for (int x = destClipW; --x >= 0;) { - const int iy = roundDoubleToInt (floor (sy)) - srcClipY; + const int ix = ((int) sx) - srcClipX; - if (((unsigned int) iy) < (unsigned int) srcClipHeight) + if (((unsigned int) ix) < (unsigned int) srcClipWidth) { - const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + const int iy = ((int) sy) - srcClipY; - dest->blend (*src, alpha); + if (((unsigned int) iy) < (unsigned int) srcClipHeight) + { + const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + dest->set (*src); + } } + + ++dest; + sx += pixelDX; + sy += pixelDY; } - ++dest; - sx += pixelDX; - sy += pixelDY; + srcX += lineDX; + srcY += lineDY; } + } + else + { + for (int y = 0; y < destClipH; ++y) + { + double sx = srcX; + double sy = srcY; - srcX += lineDX; - srcY += lineDY; + DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); + + for (int x = destClipW; --x >= 0;) + { + const int ix = ((int) sx) - srcClipX; + + if (((unsigned int) ix) < (unsigned int) srcClipWidth) + { + const int iy = ((int) sy) - srcClipY; + + if (((unsigned int) iy) < (unsigned int) srcClipHeight) + { + const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + dest->blend (*src, alpha); + } + } + + ++dest; + sx += pixelDX; + sy += pixelDY; + } + + srcX += lineDX; + srcY += lineDY; + } } } else @@ -266752,7 +266840,7 @@ bool AlertWindow::showNativeDialogBox (const String& title, juceStringToNS (bodyText), @"Ok", isOkCancel ? @"Cancel" : nil, - nil) == 0; + nil) == NSAlertDefaultReturn; } bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& files, const bool canMoveFiles) diff --git a/juce_amalgamated.h b/juce_amalgamated.h index dcd60ea7be..830815f7ee 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -669,6 +669,10 @@ #define JUCE_API __declspec (dllimport) #pragma warning (disable: 4251) #endif +#elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) + #ifdef JUCE_DLL_BUILD + #define JUCE_API __attribute__ ((visibility("default"))) + #endif #endif #ifndef JUCE_API @@ -11428,7 +11432,7 @@ public: bool isObject() const throw() { return type == objectType; } bool isMethod() const throw() { return type == methodType; } - class identifier + class JUCE_API identifier { public: identifier (const char* const name) throw(); @@ -40843,7 +40847,7 @@ public: @see ImageFileFormat, JPEGImageFormat */ -class PNGImageFormat : public ImageFileFormat +class JUCE_API PNGImageFormat : public ImageFileFormat { public: @@ -40863,7 +40867,7 @@ public: @see ImageFileFormat, PNGImageFormat */ -class JPEGImageFormat : public ImageFileFormat +class JUCE_API JPEGImageFormat : public ImageFileFormat { public: @@ -53393,7 +53397,7 @@ class WebBrowserComponentInternal; Windows, probably IE. */ -class WebBrowserComponent : public Component +class JUCE_API WebBrowserComponent : public Component { public: diff --git a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp index ec4239709c..2be4a36c9d 100644 --- a/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp +++ b/src/juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.cpp @@ -152,6 +152,58 @@ struct BWAVChunk } PACKED; + +//============================================================================== +struct SMPLChunk +{ + struct SampleLoop + { + uint32 identifier; + uint32 type; + uint32 start; + uint32 end; + uint32 fraction; + uint32 playCount; + } PACKED; + + uint32 manufacturer; + uint32 product; + uint32 samplePeriod; + uint32 midiUnityNote; + uint32 midiPitchFraction; + uint32 smpteFormat; + uint32 smpteOffset; + uint32 numSampleLoops; + uint32 samplerData; + SampleLoop loops[1]; + + void copyTo (StringPairArray& values, const int totalSize) const + { + values.set (T("Manufacturer"), String (swapIfBigEndian (manufacturer))); + values.set (T("Product"), String (swapIfBigEndian (product))); + values.set (T("SamplePeriod"), String (swapIfBigEndian (samplePeriod))); + values.set (T("MidiUnityNote"), String (swapIfBigEndian (midiUnityNote))); + values.set (T("MidiPitchFraction"), String (swapIfBigEndian (midiPitchFraction))); + values.set (T("SmpteFormat"), String (swapIfBigEndian (smpteFormat))); + values.set (T("SmpteOffset"), String (swapIfBigEndian (smpteOffset))); + values.set (T("NumSampleLoops"), String (swapIfBigEndian (numSampleLoops))); + values.set (T("SamplerData"), String (swapIfBigEndian (samplerData))); + + for (uint32 i = 0; i < numSampleLoops; ++i) + { + if ((uint8*) (loops + (i + 1)) > ((uint8*) this) + totalSize) + break; + + values.set (String::formatted (T("Loop%dIdentifier"), i), String (swapIfBigEndian (loops[i].identifier))); + values.set (String::formatted (T("Loop%dType"), i), String (swapIfBigEndian (loops[i].type))); + values.set (String::formatted (T("Loop%dStart"), i), String (swapIfBigEndian (loops[i].start))); + values.set (String::formatted (T("Loop%dEnd"), i), String (swapIfBigEndian (loops[i].end))); + values.set (String::formatted (T("Loop%dFraction"), i), String (swapIfBigEndian (loops[i].fraction))); + values.set (String::formatted (T("Loop%dPlayCount"), i), String (swapIfBigEndian (loops[i].playCount))); + } + } +} PACKED; + #if JUCE_MSVC #pragma pack (pop) #endif @@ -231,15 +283,18 @@ public: // Broadcast-wav extension chunk.. BWAVChunk* const bwav = (BWAVChunk*) juce_calloc (jmax (length + 1, (int) sizeof (BWAVChunk))); - - if (bwav != 0) - { - input->read (bwav, length); - bwav->copyTo (metadataValues); - juce_free (bwav); - } + input->read (bwav, length); + bwav->copyTo (metadataValues); + juce_free (bwav); } - else if ((hasGotType && hasGotData) || chunkEnd <= input->getPosition()) + else if (chunkType == chunkName ("smpl")) + { + SMPLChunk* const smpl = (SMPLChunk*) juce_calloc (jmax (length + 1, (int) sizeof (SMPLChunk))); + input->read (smpl, length); + smpl->copyTo (metadataValues, length); + juce_free (smpl); + } + else if (chunkEnd <= input->getPosition()) { break; } diff --git a/src/juce_appframework/gui/components/special/juce_WebBrowserComponent.h b/src/juce_appframework/gui/components/special/juce_WebBrowserComponent.h index 6f41416fab..4a627f61e9 100644 --- a/src/juce_appframework/gui/components/special/juce_WebBrowserComponent.h +++ b/src/juce_appframework/gui/components/special/juce_WebBrowserComponent.h @@ -47,7 +47,7 @@ class WebBrowserComponentInternal; Windows, probably IE. */ -class WebBrowserComponent : public Component +class JUCE_API WebBrowserComponent : public Component { public: //============================================================================== diff --git a/src/juce_appframework/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp b/src/juce_appframework/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp index b67d89ee56..e90ee865ca 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp +++ b/src/juce_appframework/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp @@ -890,36 +890,71 @@ static void transformedImageRender (Image& destImage, if (quality == Graphics::lowResamplingQuality) // nearest-neighbour.. { - for (int y = 0; y < destClipH; ++y) + if (alpha == 255) { - double sx = srcX; - double sy = srcY; - - DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); - - for (int x = 0; x < destClipW; ++x) + for (int y = 0; y < destClipH; ++y) { - const int ix = roundDoubleToInt (floor (sx)) - srcClipX; + double sx = srcX; + double sy = srcY; - if (((unsigned int) ix) < (unsigned int) srcClipWidth) + DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); + + for (int x = destClipW; --x >= 0;) { - const int iy = roundDoubleToInt (floor (sy)) - srcClipY; + const int ix = ((int) sx) - srcClipX; - if (((unsigned int) iy) < (unsigned int) srcClipHeight) + if (((unsigned int) ix) < (unsigned int) srcClipWidth) { - const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + const int iy = ((int) sy) - srcClipY; - dest->blend (*src, alpha); + if (((unsigned int) iy) < (unsigned int) srcClipHeight) + { + const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + dest->set (*src); + } } + + ++dest; + sx += pixelDX; + sy += pixelDY; } - ++dest; - sx += pixelDX; - sy += pixelDY; + srcX += lineDX; + srcY += lineDY; } + } + else + { + for (int y = 0; y < destClipH; ++y) + { + double sx = srcX; + double sy = srcY; - srcX += lineDX; - srcY += lineDY; + DestPixelType* dest = (DestPixelType*) (destPixels + destStride * y); + + for (int x = destClipW; --x >= 0;) + { + const int ix = ((int) sx) - srcClipX; + + if (((unsigned int) ix) < (unsigned int) srcClipWidth) + { + const int iy = ((int) sy) - srcClipY; + + if (((unsigned int) iy) < (unsigned int) srcClipHeight) + { + const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); + dest->blend (*src, alpha); + } + } + + ++dest; + sx += pixelDX; + sy += pixelDY; + } + + srcX += lineDX; + srcY += lineDY; + } } } else diff --git a/src/juce_appframework/gui/graphics/imaging/juce_ImageFileFormat.h b/src/juce_appframework/gui/graphics/imaging/juce_ImageFileFormat.h index 0e9686bfa7..fdd30f17bd 100644 --- a/src/juce_appframework/gui/graphics/imaging/juce_ImageFileFormat.h +++ b/src/juce_appframework/gui/graphics/imaging/juce_ImageFileFormat.h @@ -152,7 +152,7 @@ public: @see ImageFileFormat, JPEGImageFormat */ -class PNGImageFormat : public ImageFileFormat +class JUCE_API PNGImageFormat : public ImageFileFormat { public: //============================================================================== @@ -175,7 +175,7 @@ public: @see ImageFileFormat, PNGImageFormat */ -class JPEGImageFormat : public ImageFileFormat +class JUCE_API JPEGImageFormat : public ImageFileFormat { public: //============================================================================== diff --git a/src/juce_core/basics/juce_StandardHeader.h b/src/juce_core/basics/juce_StandardHeader.h index 7316a905a7..1762831ba3 100644 --- a/src/juce_core/basics/juce_StandardHeader.h +++ b/src/juce_core/basics/juce_StandardHeader.h @@ -121,6 +121,10 @@ #define JUCE_API __declspec (dllimport) #pragma warning (disable: 4251) #endif +#elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) + #ifdef JUCE_DLL_BUILD + #define JUCE_API __attribute__ ((visibility("default"))) + #endif #endif #ifndef JUCE_API diff --git a/src/juce_core/containers/juce_Variant.h b/src/juce_core/containers/juce_Variant.h index e770d8f486..4aaecb4435 100644 --- a/src/juce_core/containers/juce_Variant.h +++ b/src/juce_core/containers/juce_Variant.h @@ -97,7 +97,7 @@ public: bool isMethod() const throw() { return type == methodType; } //============================================================================== - class identifier + class JUCE_API identifier { public: identifier (const char* const name) throw();