From c583b68cd6f5fcfa9ceaba74ec76620172630e06 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Tue, 12 Oct 2010 10:06:57 +0100 Subject: [PATCH] Fixes for Quicktime, DrawableComposite. --- juce_amalgamated.cpp | 26 ++++++++++++------- .../juce_QuickTimeAudioFormat.cpp | 6 ++++- .../drawables/juce_DrawableComposite.cpp | 20 ++++++++------ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 4b4078afd4..dd69a3cee1 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -22626,6 +22626,7 @@ public: extractor (0), dataHandle (0) { + JUCE_AUTORELEASEPOOL bufferList.calloc (256, 1); #if JUCE_WINDOWS @@ -22751,6 +22752,9 @@ public: ~QTAudioReader() { + JUCE_AUTORELEASEPOOL + checkThreadIsAttached(); + if (dataHandle != 0) DisposeHandle (dataHandle); @@ -22760,7 +22764,6 @@ public: extractor = 0; } - checkThreadIsAttached(); DisposeMovie (movie); #if JUCE_MAC @@ -22771,6 +22774,7 @@ public: bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { + JUCE_AUTORELEASEPOOL checkThreadIsAttached(); bool ok = true; @@ -86401,17 +86405,21 @@ void DrawableComposite::render (const Drawable::RenderingContext& context) const // we need to render everything opaquely into a temp buffer, then blend that // with the target opacity... const Rectangle clipBounds (context.g.getClipBounds()); - Image tempImage (Image::ARGB, clipBounds.getWidth(), clipBounds.getHeight(), true); + if (! clipBounds.isEmpty()) { - Graphics tempG (tempImage); - tempG.setOrigin (-clipBounds.getX(), -clipBounds.getY()); - Drawable::RenderingContext tempContext (tempG, context.transform, 1.0f); - render (tempContext); - } + Image tempImage (Image::ARGB, clipBounds.getWidth(), clipBounds.getHeight(), true); - context.g.setOpacity (context.opacity); - context.g.drawImageAt (tempImage, clipBounds.getX(), clipBounds.getY()); + { + Graphics tempG (tempImage); + tempG.setOrigin (-clipBounds.getX(), -clipBounds.getY()); + Drawable::RenderingContext tempContext (tempG, context.transform, 1.0f); + render (tempContext); + } + + context.g.setOpacity (context.opacity); + context.g.drawImageAt (tempImage, clipBounds.getX(), clipBounds.getY()); + } } } } diff --git a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp index e2502243a5..b004973335 100644 --- a/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp +++ b/src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp @@ -86,6 +86,7 @@ public: extractor (0), dataHandle (0) { + JUCE_AUTORELEASEPOOL bufferList.calloc (256, 1); #if JUCE_WINDOWS @@ -211,6 +212,9 @@ public: ~QTAudioReader() { + JUCE_AUTORELEASEPOOL + checkThreadIsAttached(); + if (dataHandle != 0) DisposeHandle (dataHandle); @@ -220,7 +224,6 @@ public: extractor = 0; } - checkThreadIsAttached(); DisposeMovie (movie); #if JUCE_MAC @@ -231,6 +234,7 @@ public: bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) { + JUCE_AUTORELEASEPOOL checkThreadIsAttached(); bool ok = true; diff --git a/src/gui/graphics/drawables/juce_DrawableComposite.cpp b/src/gui/graphics/drawables/juce_DrawableComposite.cpp index 7ed409d3d2..75827f85ff 100644 --- a/src/gui/graphics/drawables/juce_DrawableComposite.cpp +++ b/src/gui/graphics/drawables/juce_DrawableComposite.cpp @@ -232,17 +232,21 @@ void DrawableComposite::render (const Drawable::RenderingContext& context) const // we need to render everything opaquely into a temp buffer, then blend that // with the target opacity... const Rectangle clipBounds (context.g.getClipBounds()); - Image tempImage (Image::ARGB, clipBounds.getWidth(), clipBounds.getHeight(), true); + if (! clipBounds.isEmpty()) { - Graphics tempG (tempImage); - tempG.setOrigin (-clipBounds.getX(), -clipBounds.getY()); - Drawable::RenderingContext tempContext (tempG, context.transform, 1.0f); - render (tempContext); - } + Image tempImage (Image::ARGB, clipBounds.getWidth(), clipBounds.getHeight(), true); - context.g.setOpacity (context.opacity); - context.g.drawImageAt (tempImage, clipBounds.getX(), clipBounds.getY()); + { + Graphics tempG (tempImage); + tempG.setOrigin (-clipBounds.getX(), -clipBounds.getY()); + Drawable::RenderingContext tempContext (tempG, context.transform, 1.0f); + render (tempContext); + } + + context.g.setOpacity (context.opacity); + context.g.drawImageAt (tempImage, clipBounds.getX(), clipBounds.getY()); + } } } }