Browse Source

Corrected geometry of drawLine in CoreGraphics to match the software renderer. Minor code clean-ups.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
574694f458
24 changed files with 521 additions and 369 deletions
  1. +223
    -180
      juce_amalgamated.cpp
  2. +41
    -8
      juce_amalgamated.h
  3. +3
    -0
      src/application/juce_ApplicationCommandManager.h
  4. +3
    -0
      src/audio/audio_file_formats/juce_AudioFormatWriter.h
  5. +55
    -39
      src/audio/audio_file_formats/juce_FlacAudioFormat.cpp
  6. +12
    -12
      src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp
  7. +3
    -0
      src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp
  8. +3
    -0
      src/audio/devices/juce_MidiInput.h
  9. +7
    -8
      src/audio/devices/juce_MidiOutput.cpp
  10. +10
    -8
      src/audio/devices/juce_MidiOutput.h
  11. +3
    -0
      src/audio/processors/juce_AudioProcessorEditor.h
  12. +3
    -0
      src/gui/components/mouse/juce_ComponentDragger.h
  13. +3
    -0
      src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp
  14. +77
    -69
      src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp
  15. +30
    -23
      src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp
  16. +3
    -0
      src/io/files/juce_FileOutputStream.h
  17. +4
    -2
      src/io/streams/juce_GZIPCompressorOutputStream.cpp
  18. +15
    -11
      src/io/streams/juce_GZIPDecompressorInputStream.cpp
  19. +3
    -0
      src/io/streams/juce_MemoryInputStream.h
  20. +3
    -0
      src/io/streams/juce_MemoryOutputStream.h
  21. +7
    -9
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  22. +3
    -0
      src/native/mac/juce_mac_Fonts.mm
  23. +3
    -0
      src/text/juce_XmlDocument.h
  24. +4
    -0
      src/threads/juce_CriticalSection.h

+ 223
- 180
juce_amalgamated.cpp View File

@@ -21380,6 +21380,9 @@ private:
DetachMovieFromCurrentThread (movie);
#endif
}

QTAudioReader (const QTAudioReader&);
QTAudioReader& operator= (const QTAudioReader&);
};

QuickTimeAudioFormat::QuickTimeAudioFormat()
@@ -24876,23 +24879,22 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_MidiOutput.cpp ***/
BEGIN_JUCE_NAMESPACE

MidiOutput::MidiOutput() throw()
MidiOutput::MidiOutput()
: Thread ("midi out"),
internal (0),
firstMessage (0)
{
}

MidiOutput::PendingMessage::PendingMessage (const uint8* const data,
const int len,
const double sampleNumber) throw()
MidiOutput::PendingMessage::PendingMessage (const uint8* const data, const int len,
const double sampleNumber)
: message (data, len, sampleNumber)
{
}

void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer,
const double millisecondCounterToStartAt,
double samplesPerSecondForBuffer) throw()
double samplesPerSecondForBuffer)
{
// You've got to call startBackgroundThread() for this to actually work..
jassert (isThreadRunning());
@@ -24936,7 +24938,7 @@ void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer,
notify();
}

void MidiOutput::clearAllPendingMessages() throw()
void MidiOutput::clearAllPendingMessages()
{
const ScopedLock sl (lock);

@@ -24948,12 +24950,12 @@ void MidiOutput::clearAllPendingMessages() throw()
}
}

void MidiOutput::startBackgroundThread() throw()
void MidiOutput::startBackgroundThread()
{
startThread (9);
}

void MidiOutput::stopBackgroundThread() throw()
void MidiOutput::stopBackgroundThread()
{
stopThread (5000);
}
@@ -71342,6 +71344,9 @@ public:
private:
AudioDeviceManager* const manager;
float level;

SimpleDeviceManagerInputLevelMeter (const SimpleDeviceManagerInputLevelMeter&);
SimpleDeviceManagerInputLevelMeter& operator= (const SimpleDeviceManagerInputLevelMeter&);
};

class MidiInputSelectorComponentListBox : public ListBox,
@@ -92976,8 +92981,6 @@ ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));

BEGIN_JUCE_NAMESPACE

using namespace zlibNamespace;

// internal helper object that holds the zlib structures so they don't have to be
// included publicly.
class GZIPCompressorHelper
@@ -92993,6 +92996,7 @@ public:
finished (false),
shouldFinish (false)
{
using namespace zlibNamespace;
zerostruct (stream);

streamIsValid = (deflateInit2 (&stream, compLevel, Z_DEFLATED,
@@ -93002,6 +93006,7 @@ public:

~GZIPCompressorHelper()
{
using namespace zlibNamespace;
if (streamIsValid)
deflateEnd (&stream);
}
@@ -93019,6 +93024,7 @@ public:

int doNextBlock (uint8* const dest, const int destSize) throw()
{
using namespace zlibNamespace;
if (streamIsValid)
{
stream.next_in = data;
@@ -93051,7 +93057,7 @@ public:
}

private:
z_stream stream;
zlibNamespace::z_stream stream;
uint8* data;
int dataSize, compLevel, strategy;
bool setParams, streamIsValid;
@@ -98728,28 +98734,28 @@ void zcfree (voidpf opaque, voidpf ptr)

BEGIN_JUCE_NAMESPACE

using namespace zlibNamespace;

// internal helper object that holds the zlib structures so they don't have to be
// included publicly.
class GZIPDecompressHelper
{
public:
GZIPDecompressHelper (const bool noWrap) throw()
: data (0),
dataSize (0),
finished (true),
GZIPDecompressHelper (const bool noWrap)
: finished (true),
needsDictionary (false),
error (true),
streamIsValid (false)
streamIsValid (false),
data (0),
dataSize (0)
{
using namespace zlibNamespace;
zerostruct (stream);
streamIsValid = (inflateInit2 (&stream, noWrap ? -MAX_WBITS : MAX_WBITS) == Z_OK);
finished = error = ! streamIsValid;
}

~GZIPDecompressHelper() throw()
~GZIPDecompressHelper()
{
using namespace zlibNamespace;
if (streamIsValid)
inflateEnd (&stream);
}
@@ -98762,8 +98768,9 @@ public:
dataSize = size;
}

int doNextBlock (uint8* const dest, const int destSize) throw()
int doNextBlock (uint8* const dest, const int destSize)
{
using namespace zlibNamespace;
if (streamIsValid && data != 0 && ! finished)
{
stream.next_in = data;
@@ -98799,13 +98806,15 @@ public:
return 0;
}

bool finished, needsDictionary, error, streamIsValid;

private:
z_stream stream;
zlibNamespace::z_stream stream;
uint8* data;
int dataSize;

public:
bool finished, needsDictionary, error, streamIsValid;
GZIPDecompressHelper (const GZIPDecompressHelper&);
GZIPDecompressHelper& operator= (const GZIPDecompressHelper&);
};

const int gzipDecompBufferSize = 32768;
@@ -114504,18 +114513,11 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L)

BEGIN_JUCE_NAMESPACE

using namespace FlacNamespace;

static const char* const flacFormatName = "FLAC file";
static const tchar* const flacExtensions[] = { T(".flac"), 0 };

class FlacReader : public AudioFormatReader
{
FLAC__StreamDecoder* decoder;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;
bool ok, scanningForLength;

public:

FlacReader (InputStream* const in)
@@ -114557,10 +114559,10 @@ public:

~FlacReader()
{
FLAC__stream_decoder_delete (decoder);
FlacNamespace::FLAC__stream_decoder_delete (decoder);
}

void useMetadata (const FLAC__StreamMetadata_StreamInfo& info)
void useMetadata (const FlacNamespace::FLAC__StreamMetadata_StreamInfo& info)
{
sampleRate = info.sample_rate;
bitsPerSample = info.bits_per_sample;
@@ -114637,7 +114639,7 @@ public:
return true;
}

void useSamples (const FLAC__int32* const buffer[], int numSamples)
void useSamples (const FlacNamespace::FLAC__int32* const buffer[], int numSamples)
{
if (scanningForLength)
{
@@ -114652,7 +114654,7 @@ public:

for (int i = 0; i < (int) numChannels; ++i)
{
const FLAC__int32* src = buffer[i];
const FlacNamespace::FLAC__int32* src = buffer[i];

int n = i;
while (src == 0 && n > 0)
@@ -114671,65 +114673,75 @@ public:
}
}

static FLAC__StreamDecoderReadStatus readCallback_ (const FLAC__StreamDecoder*, FLAC__byte buffer[], size_t* bytes, void* client_data)
static FlacNamespace::FLAC__StreamDecoderReadStatus readCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__byte buffer[], size_t* bytes, void* client_data)
{
using namespace FlacNamespace;
*bytes = (unsigned int) ((const FlacReader*) client_data)->input->read (buffer, (int) *bytes);
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}

static FLAC__StreamDecoderSeekStatus seekCallback_ (const FLAC__StreamDecoder*, FLAC__uint64 absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamDecoderSeekStatus seekCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64 absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
((const FlacReader*) client_data)->input->setPosition ((int) absolute_byte_offset);
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}

static FLAC__StreamDecoderTellStatus tellCallback_ (const FLAC__StreamDecoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamDecoderTellStatus tellCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
*absolute_byte_offset = ((const FlacReader*) client_data)->input->getPosition();
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
}

static FLAC__StreamDecoderLengthStatus lengthCallback_ (const FLAC__StreamDecoder*, FLAC__uint64* stream_length, void* client_data)
static FlacNamespace::FLAC__StreamDecoderLengthStatus lengthCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* stream_length, void* client_data)
{
using namespace FlacNamespace;
*stream_length = ((const FlacReader*) client_data)->input->getTotalLength();
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
}

static FLAC__bool eofCallback_ (const FLAC__StreamDecoder*, void* client_data)
static FlacNamespace::FLAC__bool eofCallback_ (const FlacNamespace::FLAC__StreamDecoder*, void* client_data)
{
return ((const FlacReader*) client_data)->input->isExhausted();
}

static FLAC__StreamDecoderWriteStatus writeCallback_ (const FLAC__StreamDecoder*,
const FLAC__Frame* frame,
const FLAC__int32* const buffer[],
void* client_data)
static FlacNamespace::FLAC__StreamDecoderWriteStatus writeCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
const FlacNamespace::FLAC__Frame* frame,
const FlacNamespace::FLAC__int32* const buffer[],
void* client_data)
{
using namespace FlacNamespace;
((FlacReader*) client_data)->useSamples (buffer, frame->header.blocksize);
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}

static void metadataCallback_ (const FLAC__StreamDecoder*,
const FLAC__StreamMetadata* metadata,
static void metadataCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
const FlacNamespace::FLAC__StreamMetadata* metadata,
void* client_data)
{
((FlacReader*) client_data)->useMetadata (metadata->data.stream_info);
}

static void errorCallback_ (const FLAC__StreamDecoder*, FLAC__StreamDecoderErrorStatus, void*)
static void errorCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__StreamDecoderErrorStatus, void*)
{
}

juce_UseDebuggingNewOperator

private:
FlacNamespace::FLAC__StreamDecoder* decoder;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;
bool ok, scanningForLength;

FlacReader (const FlacReader&);
FlacReader& operator= (const FlacReader&);
};

class FlacWriter : public AudioFormatWriter
{
FLAC__StreamEncoder* encoder;
MemoryBlock temp;

public:
bool ok;

FlacWriter (OutputStream* const out,
const double sampleRate_,
@@ -114775,6 +114787,7 @@ public:

bool write (const int** samplesToWrite, int numSamples)
{
using namespace FlacNamespace;
if (! ok)
return false;

@@ -114812,8 +114825,9 @@ public:
return output->write (data, size);
}

static void packUint32 (FLAC__uint32 val, FLAC__byte* b, const int bytes)
static void packUint32 (FlacNamespace::FLAC__uint32 val, FlacNamespace::FLAC__byte* b, const int bytes)
{
using namespace FlacNamespace;
b += bytes;

for (int i = 0; i < bytes; ++i)
@@ -114823,7 +114837,7 @@ public:
}
}

void writeMetaData (const FLAC__StreamMetadata* metadata)
void writeMetaData (const FlacNamespace::FLAC__StreamMetadata* metadata)
{
using namespace FlacNamespace;
const FLAC__StreamMetadata_StreamInfo& info = metadata->data.stream_info;
@@ -114854,12 +114868,12 @@ public:
output->write (buffer, FLAC__STREAM_METADATA_STREAMINFO_LENGTH);
}

static FLAC__StreamEncoderWriteStatus encodeWriteCallback (const FLAC__StreamEncoder*,
const FLAC__byte buffer[],
size_t bytes,
unsigned int /*samples*/,
unsigned int /*current_frame*/,
void* client_data)
static FlacNamespace::FLAC__StreamEncoderWriteStatus encodeWriteCallback (const FlacNamespace::FLAC__StreamEncoder*,
const FlacNamespace::FLAC__byte buffer[],
size_t bytes,
unsigned int /*samples*/,
unsigned int /*current_frame*/,
void* client_data)
{
using namespace FlacNamespace;
return ((FlacWriter*) client_data)->writeData (buffer, (int) bytes)
@@ -114867,13 +114881,15 @@ public:
: FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}

static FLAC__StreamEncoderSeekStatus encodeSeekCallback (const FLAC__StreamEncoder*, FLAC__uint64, void*)
static FlacNamespace::FLAC__StreamEncoderSeekStatus encodeSeekCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64, void*)
{
using namespace FlacNamespace;
return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
}

static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamEncoderTellStatus encodeTellCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
if (client_data == 0)
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;

@@ -114881,14 +114897,23 @@ public:
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
}

static void encodeMetadataCallback (const FLAC__StreamEncoder*,
const FLAC__StreamMetadata* metadata,
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*,
const FlacNamespace::FLAC__StreamMetadata* metadata,
void* client_data)
{
((FlacWriter*) client_data)->writeMetaData (metadata);
}

juce_UseDebuggingNewOperator

bool ok;

private:
FlacNamespace::FLAC__StreamEncoder* encoder;
MemoryBlock temp;

FlacWriter (const FlacWriter&);
FlacWriter& operator= (const FlacWriter&);
};

FlacAudioFormat::FlacAudioFormat()
@@ -171239,15 +171264,13 @@ void _vorbis_apply_window(float *d,int *winno,long *blocksizes,

BEGIN_JUCE_NAMESPACE

using namespace OggVorbisNamespace;

static const char* const oggFormatName = "Ogg-Vorbis file";
static const tchar* const oggExtensions[] = { T(".ogg"), 0 };

class OggReader : public AudioFormatReader
{
OggVorbis_File ovFile;
ov_callbacks callbacks;
OggVorbisNamespace::OggVorbis_File ovFile;
OggVorbisNamespace::ov_callbacks callbacks;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;

@@ -171259,6 +171282,7 @@ public:
reservoirStart (0),
samplesInReservoir (0)
{
using namespace OggVorbisNamespace;
sampleRate = 0;
usesFloatingPointData = true;

@@ -171371,7 +171395,7 @@ public:
return (size_t) (((InputStream*) datasource)->read (ptr, (int) (size * nmemb)) / size);
}

static int oggSeekCallback (void* datasource, ogg_int64_t offset, int whence)
static int oggSeekCallback (void* datasource, OggVorbisNamespace::ogg_int64_t offset, int whence)
{
InputStream* const in = (InputStream*) datasource;

@@ -171399,13 +171423,13 @@ public:

class OggWriter : public AudioFormatWriter
{
ogg_stream_state os;
ogg_page og;
ogg_packet op;
vorbis_info vi;
vorbis_comment vc;
vorbis_dsp_state vd;
vorbis_block vb;
OggVorbisNamespace::ogg_stream_state os;
OggVorbisNamespace::ogg_page og;
OggVorbisNamespace::ogg_packet op;
OggVorbisNamespace::vorbis_info vi;
OggVorbisNamespace::vorbis_comment vc;
OggVorbisNamespace::vorbis_dsp_state vd;
OggVorbisNamespace::vorbis_block vb;

public:
bool ok;
@@ -171420,6 +171444,7 @@ public:
numChannels,
bitsPerSample)
{
using namespace OggVorbisNamespace;
ok = false;

vorbis_info_init (&vi);
@@ -188412,53 +188437,91 @@ jcopy_markers_execute (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,

BEGIN_JUCE_NAMESPACE

using namespace jpeglibNamespace;
namespace JPEGHelpers
{
using namespace jpeglibNamespace;

#if ! JUCE_MSVC
using jpeglibNamespace::boolean;
#endif
#if ! JUCE_MSVC
using jpeglibNamespace::boolean;
#endif

struct JPEGDecodingFailure {};
struct JPEGDecodingFailure {};

static void fatalErrorHandler (j_common_ptr)
{
throw JPEGDecodingFailure();
}
static void fatalErrorHandler (j_common_ptr)
{
throw JPEGDecodingFailure();
}

static void silentErrorCallback1 (j_common_ptr) {}
static void silentErrorCallback2 (j_common_ptr, int) {}
static void silentErrorCallback3 (j_common_ptr, char*) {}
static void silentErrorCallback1 (j_common_ptr) {}
static void silentErrorCallback2 (j_common_ptr, int) {}
static void silentErrorCallback3 (j_common_ptr, char*) {}

static void setupSilentErrorHandler (struct jpeg_error_mgr& err)
{
zerostruct (err);
static void setupSilentErrorHandler (struct jpeg_error_mgr& err)
{
zerostruct (err);

err.error_exit = fatalErrorHandler;
err.emit_message = silentErrorCallback2;
err.output_message = silentErrorCallback1;
err.format_message = silentErrorCallback3;
err.reset_error_mgr = silentErrorCallback1;
}
err.error_exit = fatalErrorHandler;
err.emit_message = silentErrorCallback2;
err.output_message = silentErrorCallback1;
err.format_message = silentErrorCallback3;
err.reset_error_mgr = silentErrorCallback1;
}

static void dummyCallback1 (j_decompress_ptr)
{
}
static void dummyCallback1 (j_decompress_ptr)
{
}

static void jpegSkip (j_decompress_ptr decompStruct, long num)
{
decompStruct->src->next_input_byte += num;
static void jpegSkip (j_decompress_ptr decompStruct, long num)
{
decompStruct->src->next_input_byte += num;

num = jmin (num, (long) decompStruct->src->bytes_in_buffer);
decompStruct->src->bytes_in_buffer -= num;
}
num = jmin (num, (long) decompStruct->src->bytes_in_buffer);
decompStruct->src->bytes_in_buffer -= num;
}

static boolean jpegFill (j_decompress_ptr)
{
return 0;
static boolean jpegFill (j_decompress_ptr)
{
return 0;
}

static const int jpegBufferSize = 512;

struct JuceJpegDest : public jpeg_destination_mgr
{
OutputStream* output;
char* buffer;
};

static void jpegWriteInit (j_compress_ptr)
{
}

static void jpegWriteTerminate (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;

const size_t numToWrite = jpegBufferSize - dest->free_in_buffer;
dest->output->write (dest->buffer, (int) numToWrite);
}

static boolean jpegWriteFlush (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;

const int numToWrite = jpegBufferSize;

dest->next_output_byte = (JOCTET*) dest->buffer;
dest->free_in_buffer = jpegBufferSize;

return dest->output->write (dest->buffer, numToWrite);
}
}

Image* juce_loadJPEGImageFromStream (InputStream& in)
{
using namespace jpeglibNamespace;
using namespace JPEGHelpers;

MemoryBlock mb;
in.readIntoMemoryBlock (mb);

@@ -188551,42 +188614,13 @@ Image* juce_loadJPEGImageFromStream (InputStream& in)
return image;
}

static const int jpegBufferSize = 512;

struct JuceJpegDest : public jpeg_destination_mgr
{
OutputStream* output;
char* buffer;
};

static void jpegWriteInit (j_compress_ptr)
{
}

static void jpegWriteTerminate (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;

const size_t numToWrite = jpegBufferSize - dest->free_in_buffer;
dest->output->write (dest->buffer, (int) numToWrite);
}

static boolean jpegWriteFlush (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;

const int numToWrite = jpegBufferSize;

dest->next_output_byte = (JOCTET*) dest->buffer;
dest->free_in_buffer = jpegBufferSize;

return dest->output->write (dest->buffer, numToWrite);
}

bool juce_writeJPEGImageToStream (const Image& image,
OutputStream& out,
float quality)
{
using namespace jpeglibNamespace;
using namespace JPEGHelpers;

if (image.hasAlphaChannel())
{
// this method could fill the background in white and still save the image..
@@ -210995,27 +211029,43 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)

BEGIN_JUCE_NAMESPACE

using namespace pnglibNamespace;

using ::calloc;
using ::malloc;
using ::free;

static void pngReadCallback (png_structp pngReadStruct, png_bytep data, png_size_t length)
namespace PNGHelpers
{
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct);
in->read (data, (int) length);
}
using namespace pnglibNamespace;

struct PNGErrorStruct {};
static void readCallback (png_structp pngReadStruct, png_bytep data, png_size_t length)
{
using namespace pnglibNamespace;
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct);
in->read (data, (int) length);
}

struct PNGErrorStruct {};

static void errorCallback (png_structp, png_const_charp)
{
throw PNGErrorStruct();
}

static void writeDataCallback (png_structp png_ptr, png_bytep data, png_size_t length)
{
OutputStream* const out = (OutputStream*) png_ptr->io_ptr;

const bool ok = out->write (data, (int) length);

(void) ok;
jassert (ok);
}

static void pngErrorCallback (png_structp, png_const_charp)
{
throw PNGErrorStruct();
}

Image* juce_loadPNGImageFromStream (InputStream& in)
{
using namespace pnglibNamespace;
Image* image = 0;

png_structp pngReadStruct;
@@ -211033,10 +211083,10 @@ Image* juce_loadPNGImageFromStream (InputStream& in)
return 0;
}

png_set_error_fn (pngReadStruct, 0, pngErrorCallback, pngErrorCallback);
png_set_error_fn (pngReadStruct, 0, PNGHelpers::errorCallback, PNGHelpers::errorCallback );

// read the header..
png_set_read_fn (pngReadStruct, &in, pngReadCallback);
png_set_read_fn (pngReadStruct, &in, PNGHelpers::readCallback);

png_uint_32 width, height;
int bitDepth, colorType, interlaceType;
@@ -211124,18 +211174,9 @@ Image* juce_loadPNGImageFromStream (InputStream& in)
return image;
}

static void pngWriteDataCallback (png_structp png_ptr, png_bytep data, png_size_t length)
{
OutputStream* const out = (OutputStream*) png_ptr->io_ptr;

const bool ok = out->write (data, (int) length);

(void) ok;
jassert (ok);
}

bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
{
using namespace pnglibNamespace;
const int width = image.getWidth();
const int height = image.getHeight();

@@ -211152,7 +211193,7 @@ bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
return false;
}

png_set_write_fn (pngWriteStruct, &out, pngWriteDataCallback, 0);
png_set_write_fn (pngWriteStruct, &out, PNGHelpers::writeDataCallback, 0);

png_set_IHDR (pngWriteStruct, pngInfoStruct, width, height, 8,
image.hasAlphaChannel() ? PNG_COLOR_TYPE_RGB_ALPHA
@@ -239667,6 +239708,9 @@ private:

ScopedPointer <CharToGlyphMapper> charToGlyphMapper;
#endif

MacTypeface (const MacTypeface&);
MacTypeface& operator= (const MacTypeface&);
};

const Typeface::Ptr Typeface::createSystemTypefaceFor (const Font& font)
@@ -239726,8 +239770,8 @@ public:
const bool clearImage)
: Image (format_, imageWidth_, imageHeight_, clearImage)
{
CGColorSpaceRef colourSpace = format == Image::SingleChannel ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();
CGColorSpaceRef colourSpace = (format == Image::SingleChannel) ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();

context = CGBitmapContextCreate (imageData, imageWidth, imageHeight, 8, lineStride,
colourSpace, getCGImageFlags (*this));
@@ -240130,8 +240174,8 @@ public:
state->fillType.colour.getFloatRed(), state->fillType.colour.getFloatGreen(),
state->fillType.colour.getFloatBlue(), state->fillType.colour.getFloatAlpha());

CGPoint line[] = { { (float) x1 + 0.5f, flipHeight - ((float) y1 + 0.5f) },
{ (float) x2 + 0.5f, flipHeight - ((float) y2 + 0.5f) } };
CGPoint line[] = { { (CGFloat) x1, flipHeight - (CGFloat) y1 },
{ (CGFloat) x2, flipHeight - (CGFloat) y2 } };

CGContextStrokeLineSegments (context, line, 1);
}
@@ -240225,7 +240269,7 @@ public:

private:
CGContextRef context;
const float flipHeight;
const CGFloat flipHeight;
CGColorSpaceRef rgbColourSpace, greyColourSpace;
CGFunctionCallbacks gradientCallbacks;

@@ -240408,10 +240452,8 @@ private:
CGContextConcatCTM (context, t);
}

float flipY (float y) const
{
return flipHeight - y;
}
CoreGraphicsContext (const CoreGraphicsContext&);
CoreGraphicsContext& operator= (const CoreGraphicsContext&);
};

LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()
@@ -244063,6 +244105,9 @@ private:

ScopedPointer <CharToGlyphMapper> charToGlyphMapper;
#endif

MacTypeface (const MacTypeface&);
MacTypeface& operator= (const MacTypeface&);
};

const Typeface::Ptr Typeface::createSystemTypefaceFor (const Font& font)
@@ -244122,8 +244167,8 @@ public:
const bool clearImage)
: Image (format_, imageWidth_, imageHeight_, clearImage)
{
CGColorSpaceRef colourSpace = format == Image::SingleChannel ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();
CGColorSpaceRef colourSpace = (format == Image::SingleChannel) ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();

context = CGBitmapContextCreate (imageData, imageWidth, imageHeight, 8, lineStride,
colourSpace, getCGImageFlags (*this));
@@ -244526,8 +244571,8 @@ public:
state->fillType.colour.getFloatRed(), state->fillType.colour.getFloatGreen(),
state->fillType.colour.getFloatBlue(), state->fillType.colour.getFloatAlpha());

CGPoint line[] = { { (float) x1 + 0.5f, flipHeight - ((float) y1 + 0.5f) },
{ (float) x2 + 0.5f, flipHeight - ((float) y2 + 0.5f) } };
CGPoint line[] = { { (CGFloat) x1, flipHeight - (CGFloat) y1 },
{ (CGFloat) x2, flipHeight - (CGFloat) y2 } };

CGContextStrokeLineSegments (context, line, 1);
}
@@ -244621,7 +244666,7 @@ public:

private:
CGContextRef context;
const float flipHeight;
const CGFloat flipHeight;
CGColorSpaceRef rgbColourSpace, greyColourSpace;
CGFunctionCallbacks gradientCallbacks;

@@ -244804,10 +244849,8 @@ private:
CGContextConcatCTM (context, t);
}

float flipY (float y) const
{
return flipHeight - y;
}
CoreGraphicsContext (const CoreGraphicsContext&);
CoreGraphicsContext& operator= (const CoreGraphicsContext&);
};

LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()


+ 41
- 8
juce_amalgamated.h View File

@@ -1894,6 +1894,10 @@ public:
};

typedef ScopedLockType ScopedUnlockType;

private:
DummyCriticalSection (const DummyCriticalSection&);
DummyCriticalSection& operator= (const DummyCriticalSection&);
};

#endif // __JUCE_CRITICALSECTION_JUCEHEADER__
@@ -7659,6 +7663,9 @@ private:
int64 currentPosition;
int bufferSize, bytesInBuffer;
HeapBlock <char> buffer;

FileOutputStream (const FileOutputStream&);
FileOutputStream& operator= (const FileOutputStream&);
};

#endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__
@@ -8318,6 +8325,9 @@ private:
const char* data;
size_t dataSize, position;
MemoryBlock internalCopy;

MemoryInputStream (const MemoryInputStream&);
MemoryInputStream& operator= (const MemoryInputStream&);
};

#endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__
@@ -8358,6 +8368,9 @@ private:
MemoryBlock* data;
ScopedPointer <MemoryBlock> dataToDelete;
size_t position, size, blockSize;

MemoryOutputStream (const MemoryOutputStream&);
MemoryOutputStream& operator= (const MemoryOutputStream&);
};

#endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__
@@ -8522,6 +8535,9 @@ private:
const String expandEntity (const String& entity);
const String expandExternalEntity (const String& entity);
const String getParameterEntity (const String& entity);

XmlDocument (const XmlDocument&);
XmlDocument& operator= (const XmlDocument&);
};

#endif // __JUCE_XMLDOCUMENT_JUCEHEADER__
@@ -13291,6 +13307,9 @@ private:
// xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
// version of this method.
virtual short getFirstCommandTarget() { return 0; }

ApplicationCommandManager (const ApplicationCommandManager&);
ApplicationCommandManager& operator= (const ApplicationCommandManager&);
};

class JUCE_API ApplicationCommandManagerListener
@@ -13777,6 +13796,9 @@ protected:

private:
String formatName;

AudioFormatWriter (const AudioFormatWriter&);
AudioFormatWriter& operator= (const AudioFormatWriter&);
};

#endif // __JUCE_AUDIOFORMATWRITER_JUCEHEADER__
@@ -15522,7 +15544,10 @@ protected:
void* internal;

MidiInput (const String& name);

private:
MidiInput (const MidiInput&);
MidiInput& operator= (const MidiInput&);
};

#endif // __JUCE_MIDIINPUT_JUCEHEADER__
@@ -15648,13 +15673,13 @@ public:

virtual void sendBlockOfMessages (const MidiBuffer& buffer,
const double millisecondCounterToStartAt,
double samplesPerSecondForBuffer) throw();
double samplesPerSecondForBuffer);

virtual void clearAllPendingMessages() throw();
virtual void clearAllPendingMessages();

virtual void startBackgroundThread() throw();
virtual void startBackgroundThread();

virtual void stopBackgroundThread() throw();
virtual void stopBackgroundThread();

juce_UseDebuggingNewOperator

@@ -15663,7 +15688,7 @@ protected:

struct PendingMessage
{
PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
PendingMessage (const uint8* data, int len, double sampleNumber);

MidiMessage message;
PendingMessage* next;
@@ -15674,10 +15699,12 @@ protected:
CriticalSection lock;
PendingMessage* firstMessage;

MidiOutput() throw();
MidiOutput (const MidiOutput&);

MidiOutput();
void run();

private:
MidiOutput (const MidiOutput&);
MidiOutput& operator= (const MidiOutput&);
};

#endif // __JUCE_MIDIOUTPUT_JUCEHEADER__
@@ -17548,6 +17575,9 @@ public:
private:

AudioProcessor* const owner;

AudioProcessorEditor (const AudioProcessorEditor&);
AudioProcessorEditor& operator= (const AudioProcessorEditor&);
};

#endif // __JUCE_AUDIOPROCESSOREDITOR_JUCEHEADER__
@@ -22755,6 +22785,9 @@ public:
private:
ComponentBoundsConstrainer* constrainer;
Point<int> originalPos;

ComponentDragger (const ComponentDragger&);
ComponentDragger& operator= (const ComponentDragger&);
};

#endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__


+ 3
- 0
src/application/juce_ApplicationCommandManager.h View File

@@ -331,6 +331,9 @@ private:
// xxx this is just here to cause a compile error in old code that hasn't been changed to use the new
// version of this method.
virtual short getFirstCommandTarget() { return 0; }
ApplicationCommandManager (const ApplicationCommandManager&);
ApplicationCommandManager& operator= (const ApplicationCommandManager&);
};


+ 3
- 0
src/audio/audio_file_formats/juce_AudioFormatWriter.h View File

@@ -162,6 +162,9 @@ protected:
private:
String formatName;
AudioFormatWriter (const AudioFormatWriter&);
AudioFormatWriter& operator= (const AudioFormatWriter&);
};


+ 55
- 39
src/audio/audio_file_formats/juce_FlacAudioFormat.cpp View File

@@ -80,7 +80,6 @@ BEGIN_JUCE_NAMESPACE
#include "../../text/juce_LocalisedStrings.h"
#include "../../containers/juce_ScopedPointer.h"
using namespace FlacNamespace;
//==============================================================================
static const char* const flacFormatName = "FLAC file";
@@ -90,11 +89,6 @@ static const tchar* const flacExtensions[] = { T(".flac"), 0 };
//==============================================================================
class FlacReader : public AudioFormatReader
{
FLAC__StreamDecoder* decoder;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;
bool ok, scanningForLength;
public:
//==============================================================================
FlacReader (InputStream* const in)
@@ -136,10 +130,10 @@ public:
~FlacReader()
{
FLAC__stream_decoder_delete (decoder);
FlacNamespace::FLAC__stream_decoder_delete (decoder);
}
void useMetadata (const FLAC__StreamMetadata_StreamInfo& info)
void useMetadata (const FlacNamespace::FLAC__StreamMetadata_StreamInfo& info)
{
sampleRate = info.sample_rate;
bitsPerSample = info.bits_per_sample;
@@ -216,7 +210,7 @@ public:
return true;
}
void useSamples (const FLAC__int32* const buffer[], int numSamples)
void useSamples (const FlacNamespace::FLAC__int32* const buffer[], int numSamples)
{
if (scanningForLength)
{
@@ -231,7 +225,7 @@ public:
for (int i = 0; i < (int) numChannels; ++i)
{
const FLAC__int32* src = buffer[i];
const FlacNamespace::FLAC__int32* src = buffer[i];
int n = i;
while (src == 0 && n > 0)
@@ -251,68 +245,77 @@ public:
}
//==============================================================================
static FLAC__StreamDecoderReadStatus readCallback_ (const FLAC__StreamDecoder*, FLAC__byte buffer[], size_t* bytes, void* client_data)
static FlacNamespace::FLAC__StreamDecoderReadStatus readCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__byte buffer[], size_t* bytes, void* client_data)
{
using namespace FlacNamespace;
*bytes = (unsigned int) ((const FlacReader*) client_data)->input->read (buffer, (int) *bytes);
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
static FLAC__StreamDecoderSeekStatus seekCallback_ (const FLAC__StreamDecoder*, FLAC__uint64 absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamDecoderSeekStatus seekCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64 absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
((const FlacReader*) client_data)->input->setPosition ((int) absolute_byte_offset);
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}
static FLAC__StreamDecoderTellStatus tellCallback_ (const FLAC__StreamDecoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamDecoderTellStatus tellCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
*absolute_byte_offset = ((const FlacReader*) client_data)->input->getPosition();
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
}
static FLAC__StreamDecoderLengthStatus lengthCallback_ (const FLAC__StreamDecoder*, FLAC__uint64* stream_length, void* client_data)
static FlacNamespace::FLAC__StreamDecoderLengthStatus lengthCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__uint64* stream_length, void* client_data)
{
using namespace FlacNamespace;
*stream_length = ((const FlacReader*) client_data)->input->getTotalLength();
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
}
static FLAC__bool eofCallback_ (const FLAC__StreamDecoder*, void* client_data)
static FlacNamespace::FLAC__bool eofCallback_ (const FlacNamespace::FLAC__StreamDecoder*, void* client_data)
{
return ((const FlacReader*) client_data)->input->isExhausted();
}
static FLAC__StreamDecoderWriteStatus writeCallback_ (const FLAC__StreamDecoder*,
const FLAC__Frame* frame,
const FLAC__int32* const buffer[],
void* client_data)
static FlacNamespace::FLAC__StreamDecoderWriteStatus writeCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
const FlacNamespace::FLAC__Frame* frame,
const FlacNamespace::FLAC__int32* const buffer[],
void* client_data)
{
using namespace FlacNamespace;
((FlacReader*) client_data)->useSamples (buffer, frame->header.blocksize);
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
static void metadataCallback_ (const FLAC__StreamDecoder*,
const FLAC__StreamMetadata* metadata,
static void metadataCallback_ (const FlacNamespace::FLAC__StreamDecoder*,
const FlacNamespace::FLAC__StreamMetadata* metadata,
void* client_data)
{
((FlacReader*) client_data)->useMetadata (metadata->data.stream_info);
}
static void errorCallback_ (const FLAC__StreamDecoder*, FLAC__StreamDecoderErrorStatus, void*)
static void errorCallback_ (const FlacNamespace::FLAC__StreamDecoder*, FlacNamespace::FLAC__StreamDecoderErrorStatus, void*)
{
}
juce_UseDebuggingNewOperator
private:
FlacNamespace::FLAC__StreamDecoder* decoder;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;
bool ok, scanningForLength;
FlacReader (const FlacReader&);
FlacReader& operator= (const FlacReader&);
};
//==============================================================================
class FlacWriter : public AudioFormatWriter
{
FLAC__StreamEncoder* encoder;
MemoryBlock temp;
public:
bool ok;
//==============================================================================
FlacWriter (OutputStream* const out,
const double sampleRate_,
@@ -359,6 +362,7 @@ public:
//==============================================================================
bool write (const int** samplesToWrite, int numSamples)
{
using namespace FlacNamespace;
if (! ok)
return false;
@@ -396,8 +400,9 @@ public:
return output->write (data, size);
}
static void packUint32 (FLAC__uint32 val, FLAC__byte* b, const int bytes)
static void packUint32 (FlacNamespace::FLAC__uint32 val, FlacNamespace::FLAC__byte* b, const int bytes)
{
using namespace FlacNamespace;
b += bytes;
for (int i = 0; i < bytes; ++i)
@@ -407,7 +412,7 @@ public:
}
}
void writeMetaData (const FLAC__StreamMetadata* metadata)
void writeMetaData (const FlacNamespace::FLAC__StreamMetadata* metadata)
{
using namespace FlacNamespace;
const FLAC__StreamMetadata_StreamInfo& info = metadata->data.stream_info;
@@ -439,12 +444,12 @@ public:
}
//==============================================================================
static FLAC__StreamEncoderWriteStatus encodeWriteCallback (const FLAC__StreamEncoder*,
const FLAC__byte buffer[],
size_t bytes,
unsigned int /*samples*/,
unsigned int /*current_frame*/,
void* client_data)
static FlacNamespace::FLAC__StreamEncoderWriteStatus encodeWriteCallback (const FlacNamespace::FLAC__StreamEncoder*,
const FlacNamespace::FLAC__byte buffer[],
size_t bytes,
unsigned int /*samples*/,
unsigned int /*current_frame*/,
void* client_data)
{
using namespace FlacNamespace;
return ((FlacWriter*) client_data)->writeData (buffer, (int) bytes)
@@ -452,13 +457,15 @@ public:
: FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}
static FLAC__StreamEncoderSeekStatus encodeSeekCallback (const FLAC__StreamEncoder*, FLAC__uint64, void*)
static FlacNamespace::FLAC__StreamEncoderSeekStatus encodeSeekCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64, void*)
{
using namespace FlacNamespace;
return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
}
static FLAC__StreamEncoderTellStatus encodeTellCallback (const FLAC__StreamEncoder*, FLAC__uint64* absolute_byte_offset, void* client_data)
static FlacNamespace::FLAC__StreamEncoderTellStatus encodeTellCallback (const FlacNamespace::FLAC__StreamEncoder*, FlacNamespace::FLAC__uint64* absolute_byte_offset, void* client_data)
{
using namespace FlacNamespace;
if (client_data == 0)
return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
@@ -466,14 +473,23 @@ public:
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
}
static void encodeMetadataCallback (const FLAC__StreamEncoder*,
const FLAC__StreamMetadata* metadata,
static void encodeMetadataCallback (const FlacNamespace::FLAC__StreamEncoder*,
const FlacNamespace::FLAC__StreamMetadata* metadata,
void* client_data)
{
((FlacWriter*) client_data)->writeMetaData (metadata);
}
juce_UseDebuggingNewOperator
bool ok;
private:
FlacNamespace::FLAC__StreamEncoder* encoder;
MemoryBlock temp;
FlacWriter (const FlacWriter&);
FlacWriter& operator= (const FlacWriter&);
};


+ 12
- 12
src/audio/audio_file_formats/juce_OggVorbisAudioFormat.cpp View File

@@ -80,18 +80,16 @@ BEGIN_JUCE_NAMESPACE
#include "../../io/files/juce_FileInputStream.h"
#include "../../text/juce_LocalisedStrings.h"
using namespace OggVorbisNamespace;
//==============================================================================
static const char* const oggFormatName = "Ogg-Vorbis file";
static const tchar* const oggExtensions[] = { T(".ogg"), 0 };
//==============================================================================
class OggReader : public AudioFormatReader
{
OggVorbis_File ovFile;
ov_callbacks callbacks;
OggVorbisNamespace::OggVorbis_File ovFile;
OggVorbisNamespace::ov_callbacks callbacks;
AudioSampleBuffer reservoir;
int reservoirStart, samplesInReservoir;
@@ -103,6 +101,7 @@ public:
reservoirStart (0),
samplesInReservoir (0)
{
using namespace OggVorbisNamespace;
sampleRate = 0;
usesFloatingPointData = true;
@@ -217,7 +216,7 @@ public:
return (size_t) (((InputStream*) datasource)->read (ptr, (int) (size * nmemb)) / size);
}
static int oggSeekCallback (void* datasource, ogg_int64_t offset, int whence)
static int oggSeekCallback (void* datasource, OggVorbisNamespace::ogg_int64_t offset, int whence)
{
InputStream* const in = (InputStream*) datasource;
@@ -246,13 +245,13 @@ public:
//==============================================================================
class OggWriter : public AudioFormatWriter
{
ogg_stream_state os;
ogg_page og;
ogg_packet op;
vorbis_info vi;
vorbis_comment vc;
vorbis_dsp_state vd;
vorbis_block vb;
OggVorbisNamespace::ogg_stream_state os;
OggVorbisNamespace::ogg_page og;
OggVorbisNamespace::ogg_packet op;
OggVorbisNamespace::vorbis_info vi;
OggVorbisNamespace::vorbis_comment vc;
OggVorbisNamespace::vorbis_dsp_state vd;
OggVorbisNamespace::vorbis_block vb;
public:
bool ok;
@@ -268,6 +267,7 @@ public:
numChannels,
bitsPerSample)
{
using namespace OggVorbisNamespace;
ok = false;
vorbis_info_init (&vi);


+ 3
- 0
src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp View File

@@ -337,6 +337,9 @@ private:
DetachMovieFromCurrentThread (movie);
#endif
}
QTAudioReader (const QTAudioReader&);
QTAudioReader& operator= (const QTAudioReader&);
};


+ 3
- 0
src/audio/devices/juce_MidiInput.h View File

@@ -178,7 +178,10 @@ protected:
void* internal;
MidiInput (const String& name);
private:
MidiInput (const MidiInput&);
MidiInput& operator= (const MidiInput&);
};


+ 7
- 8
src/audio/devices/juce_MidiOutput.cpp View File

@@ -33,23 +33,22 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
MidiOutput::MidiOutput() throw()
MidiOutput::MidiOutput()
: Thread ("midi out"),
internal (0),
firstMessage (0)
{
}
MidiOutput::PendingMessage::PendingMessage (const uint8* const data,
const int len,
const double sampleNumber) throw()
MidiOutput::PendingMessage::PendingMessage (const uint8* const data, const int len,
const double sampleNumber)
: message (data, len, sampleNumber)
{
}
void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer,
const double millisecondCounterToStartAt,
double samplesPerSecondForBuffer) throw()
double samplesPerSecondForBuffer)
{
// You've got to call startBackgroundThread() for this to actually work..
jassert (isThreadRunning());
@@ -93,7 +92,7 @@ void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer,
notify();
}
void MidiOutput::clearAllPendingMessages() throw()
void MidiOutput::clearAllPendingMessages()
{
const ScopedLock sl (lock);
@@ -105,12 +104,12 @@ void MidiOutput::clearAllPendingMessages() throw()
}
}
void MidiOutput::startBackgroundThread() throw()
void MidiOutput::startBackgroundThread()
{
startThread (9);
}
void MidiOutput::stopBackgroundThread() throw()
void MidiOutput::stopBackgroundThread()
{
stopThread (5000);
}


+ 10
- 8
src/audio/devices/juce_MidiOutput.h View File

@@ -129,23 +129,23 @@ public:
*/
virtual void sendBlockOfMessages (const MidiBuffer& buffer,
const double millisecondCounterToStartAt,
double samplesPerSecondForBuffer) throw();
double samplesPerSecondForBuffer);
/** Gets rid of any midi messages that had been added by sendBlockOfMessages().
*/
virtual void clearAllPendingMessages() throw();
virtual void clearAllPendingMessages();
/** Starts up a background thread so that the device can send blocks of data.
Call this to get the device ready, before using sendBlockOfMessages().
*/
virtual void startBackgroundThread() throw();
virtual void startBackgroundThread();
/** Stops the background thread, and clears any pending midi events.
@see startBackgroundThread
*/
virtual void stopBackgroundThread() throw();
virtual void stopBackgroundThread();
//==============================================================================
@@ -156,7 +156,7 @@ protected:
struct PendingMessage
{
PendingMessage (const uint8* const data, const int len, const double sampleNumber) throw();
PendingMessage (const uint8* data, int len, double sampleNumber);
MidiMessage message;
PendingMessage* next;
@@ -167,10 +167,12 @@ protected:
CriticalSection lock;
PendingMessage* firstMessage;
MidiOutput() throw();
MidiOutput (const MidiOutput&);
MidiOutput();
void run();
private:
MidiOutput (const MidiOutput&);
MidiOutput& operator= (const MidiOutput&);
};


+ 3
- 0
src/audio/processors/juce_AudioProcessorEditor.h View File

@@ -60,6 +60,9 @@ public:
private:
//==============================================================================
AudioProcessor* const owner;
AudioProcessorEditor (const AudioProcessorEditor&);
AudioProcessorEditor& operator= (const AudioProcessorEditor&);
};


+ 3
- 0
src/gui/components/mouse/juce_ComponentDragger.h View File

@@ -99,6 +99,9 @@ public:
private:
ComponentBoundsConstrainer* constrainer;
Point<int> originalPos;
ComponentDragger (const ComponentDragger&);
ComponentDragger& operator= (const ComponentDragger&);
};
#endif // __JUCE_COMPONENTDRAGGER_JUCEHEADER__

+ 3
- 0
src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp View File

@@ -73,6 +73,9 @@ public:
private:
AudioDeviceManager* const manager;
float level;
SimpleDeviceManagerInputLevelMeter (const SimpleDeviceManagerInputLevelMeter&);
SimpleDeviceManagerInputLevelMeter& operator= (const SimpleDeviceManagerInputLevelMeter&);
};


+ 77
- 69
src/gui/graphics/imaging/image_file_formats/juce_JPEGLoader.cpp View File

@@ -128,57 +128,96 @@ BEGIN_JUCE_NAMESPACE
#include "../../../../io/streams/juce_OutputStream.h"
#include "../../colour/juce_PixelFormats.h"
using namespace jpeglibNamespace;
//==============================================================================
namespace JPEGHelpers
{
using namespace jpeglibNamespace;
#if ! JUCE_MSVC
using jpeglibNamespace::boolean;
#endif
#if ! JUCE_MSVC
using jpeglibNamespace::boolean;
#endif
//==============================================================================
struct JPEGDecodingFailure {};
struct JPEGDecodingFailure {};
static void fatalErrorHandler (j_common_ptr)
{
throw JPEGDecodingFailure();
}
static void fatalErrorHandler (j_common_ptr)
{
throw JPEGDecodingFailure();
}
static void silentErrorCallback1 (j_common_ptr) {}
static void silentErrorCallback2 (j_common_ptr, int) {}
static void silentErrorCallback3 (j_common_ptr, char*) {}
static void silentErrorCallback1 (j_common_ptr) {}
static void silentErrorCallback2 (j_common_ptr, int) {}
static void silentErrorCallback3 (j_common_ptr, char*) {}
static void setupSilentErrorHandler (struct jpeg_error_mgr& err)
{
zerostruct (err);
static void setupSilentErrorHandler (struct jpeg_error_mgr& err)
{
zerostruct (err);
err.error_exit = fatalErrorHandler;
err.emit_message = silentErrorCallback2;
err.output_message = silentErrorCallback1;
err.format_message = silentErrorCallback3;
err.reset_error_mgr = silentErrorCallback1;
}
err.error_exit = fatalErrorHandler;
err.emit_message = silentErrorCallback2;
err.output_message = silentErrorCallback1;
err.format_message = silentErrorCallback3;
err.reset_error_mgr = silentErrorCallback1;
}
//==============================================================================
static void dummyCallback1 (j_decompress_ptr)
{
}
//==============================================================================
static void dummyCallback1 (j_decompress_ptr)
{
}
static void jpegSkip (j_decompress_ptr decompStruct, long num)
{
decompStruct->src->next_input_byte += num;
static void jpegSkip (j_decompress_ptr decompStruct, long num)
{
decompStruct->src->next_input_byte += num;
num = jmin (num, (long) decompStruct->src->bytes_in_buffer);
decompStruct->src->bytes_in_buffer -= num;
}
num = jmin (num, (long) decompStruct->src->bytes_in_buffer);
decompStruct->src->bytes_in_buffer -= num;
}
static boolean jpegFill (j_decompress_ptr)
{
return 0;
static boolean jpegFill (j_decompress_ptr)
{
return 0;
}
//==============================================================================
static const int jpegBufferSize = 512;
struct JuceJpegDest : public jpeg_destination_mgr
{
OutputStream* output;
char* buffer;
};
static void jpegWriteInit (j_compress_ptr)
{
}
static void jpegWriteTerminate (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
const size_t numToWrite = jpegBufferSize - dest->free_in_buffer;
dest->output->write (dest->buffer, (int) numToWrite);
}
static boolean jpegWriteFlush (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
const int numToWrite = jpegBufferSize;
dest->next_output_byte = (JOCTET*) dest->buffer;
dest->free_in_buffer = jpegBufferSize;
return dest->output->write (dest->buffer, numToWrite);
}
}
//==============================================================================
Image* juce_loadJPEGImageFromStream (InputStream& in)
{
using namespace jpeglibNamespace;
using namespace JPEGHelpers;
MemoryBlock mb;
in.readIntoMemoryBlock (mb);
@@ -271,45 +310,14 @@ Image* juce_loadJPEGImageFromStream (InputStream& in)
return image;
}
//==============================================================================
static const int jpegBufferSize = 512;
struct JuceJpegDest : public jpeg_destination_mgr
{
OutputStream* output;
char* buffer;
};
static void jpegWriteInit (j_compress_ptr)
{
}
static void jpegWriteTerminate (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
const size_t numToWrite = jpegBufferSize - dest->free_in_buffer;
dest->output->write (dest->buffer, (int) numToWrite);
}
static boolean jpegWriteFlush (j_compress_ptr cinfo)
{
JuceJpegDest* const dest = (JuceJpegDest*) cinfo->dest;
const int numToWrite = jpegBufferSize;
dest->next_output_byte = (JOCTET*) dest->buffer;
dest->free_in_buffer = jpegBufferSize;
return dest->output->write (dest->buffer, numToWrite);
}
//==============================================================================
bool juce_writeJPEGImageToStream (const Image& image,
OutputStream& out,
float quality)
{
using namespace jpeglibNamespace;
using namespace JPEGHelpers;
if (image.hasAlphaChannel())
{
// this method could fill the background in white and still save the image..


+ 30
- 23
src/gui/graphics/imaging/image_file_formats/juce_PNGLoader.cpp View File

@@ -102,29 +102,45 @@ BEGIN_JUCE_NAMESPACE
#include "../../../../io/streams/juce_OutputStream.h"
#include "../../colour/juce_PixelFormats.h"
using namespace pnglibNamespace;
using ::calloc;
using ::malloc;
using ::free;
//==============================================================================
static void pngReadCallback (png_structp pngReadStruct, png_bytep data, png_size_t length)
namespace PNGHelpers
{
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct);
in->read (data, (int) length);
}
using namespace pnglibNamespace;
struct PNGErrorStruct {};
static void readCallback (png_structp pngReadStruct, png_bytep data, png_size_t length)
{
using namespace pnglibNamespace;
InputStream* const in = (InputStream*) png_get_io_ptr (pngReadStruct);
in->read (data, (int) length);
}
struct PNGErrorStruct {};
static void errorCallback (png_structp, png_const_charp)
{
throw PNGErrorStruct();
}
static void writeDataCallback (png_structp png_ptr, png_bytep data, png_size_t length)
{
OutputStream* const out = (OutputStream*) png_ptr->io_ptr;
const bool ok = out->write (data, (int) length);
(void) ok;
jassert (ok);
}
static void pngErrorCallback (png_structp, png_const_charp)
{
throw PNGErrorStruct();
}
//==============================================================================
Image* juce_loadPNGImageFromStream (InputStream& in)
{
using namespace pnglibNamespace;
Image* image = 0;
png_structp pngReadStruct;
@@ -142,10 +158,10 @@ Image* juce_loadPNGImageFromStream (InputStream& in)
return 0;
}
png_set_error_fn (pngReadStruct, 0, pngErrorCallback, pngErrorCallback);
png_set_error_fn (pngReadStruct, 0, PNGHelpers::errorCallback, PNGHelpers::errorCallback );
// read the header..
png_set_read_fn (pngReadStruct, &in, pngReadCallback);
png_set_read_fn (pngReadStruct, &in, PNGHelpers::readCallback);
png_uint_32 width, height;
int bitDepth, colorType, interlaceType;
@@ -234,18 +250,9 @@ Image* juce_loadPNGImageFromStream (InputStream& in)
}
//==============================================================================
static void pngWriteDataCallback (png_structp png_ptr, png_bytep data, png_size_t length)
{
OutputStream* const out = (OutputStream*) png_ptr->io_ptr;
const bool ok = out->write (data, (int) length);
(void) ok;
jassert (ok);
}
bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
{
using namespace pnglibNamespace;
const int width = image.getWidth();
const int height = image.getHeight();
@@ -262,7 +269,7 @@ bool juce_writePNGImageToStream (const Image& image, OutputStream& out)
return false;
}
png_set_write_fn (pngWriteStruct, &out, pngWriteDataCallback, 0);
png_set_write_fn (pngWriteStruct, &out, PNGHelpers::writeDataCallback, 0);
png_set_IHDR (pngWriteStruct, pngInfoStruct, width, height, 8,
image.hasAlphaChannel() ? PNG_COLOR_TYPE_RGB_ALPHA


+ 3
- 0
src/io/files/juce_FileOutputStream.h View File

@@ -87,6 +87,9 @@ private:
int64 currentPosition;
int bufferSize, bytesInBuffer;
HeapBlock <char> buffer;
FileOutputStream (const FileOutputStream&);
FileOutputStream& operator= (const FileOutputStream&);
};
#endif // __JUCE_FILEOUTPUTSTREAM_JUCEHEADER__

+ 4
- 2
src/io/streams/juce_GZIPCompressorOutputStream.cpp View File

@@ -41,7 +41,6 @@ BEGIN_JUCE_NAMESPACE
#include "juce_GZIPCompressorOutputStream.h"
using namespace zlibNamespace;
//==============================================================================
// internal helper object that holds the zlib structures so they don't have to be
@@ -59,6 +58,7 @@ public:
finished (false),
shouldFinish (false)
{
using namespace zlibNamespace;
zerostruct (stream);
streamIsValid = (deflateInit2 (&stream, compLevel, Z_DEFLATED,
@@ -68,6 +68,7 @@ public:
~GZIPCompressorHelper()
{
using namespace zlibNamespace;
if (streamIsValid)
deflateEnd (&stream);
}
@@ -85,6 +86,7 @@ public:
int doNextBlock (uint8* const dest, const int destSize) throw()
{
using namespace zlibNamespace;
if (streamIsValid)
{
stream.next_in = data;
@@ -117,7 +119,7 @@ public:
}
private:
z_stream stream;
zlibNamespace::z_stream stream;
uint8* data;
int dataSize, compLevel, strategy;
bool setParams, streamIsValid;


+ 15
- 11
src/io/streams/juce_GZIPDecompressorInputStream.cpp View File

@@ -73,7 +73,6 @@ BEGIN_JUCE_NAMESPACE
#include "juce_GZIPDecompressorInputStream.h"
using namespace zlibNamespace;
//==============================================================================
// internal helper object that holds the zlib structures so they don't have to be
@@ -81,21 +80,23 @@ using namespace zlibNamespace;
class GZIPDecompressHelper
{
public:
GZIPDecompressHelper (const bool noWrap) throw()
: data (0),
dataSize (0),
finished (true),
GZIPDecompressHelper (const bool noWrap)
: finished (true),
needsDictionary (false),
error (true),
streamIsValid (false)
streamIsValid (false),
data (0),
dataSize (0)
{
using namespace zlibNamespace;
zerostruct (stream);
streamIsValid = (inflateInit2 (&stream, noWrap ? -MAX_WBITS : MAX_WBITS) == Z_OK);
finished = error = ! streamIsValid;
}
~GZIPDecompressHelper() throw()
~GZIPDecompressHelper()
{
using namespace zlibNamespace;
if (streamIsValid)
inflateEnd (&stream);
}
@@ -108,8 +109,9 @@ public:
dataSize = size;
}
int doNextBlock (uint8* const dest, const int destSize) throw()
int doNextBlock (uint8* const dest, const int destSize)
{
using namespace zlibNamespace;
if (streamIsValid && data != 0 && ! finished)
{
stream.next_in = data;
@@ -145,13 +147,15 @@ public:
return 0;
}
bool finished, needsDictionary, error, streamIsValid;
private:
z_stream stream;
zlibNamespace::z_stream stream;
uint8* data;
int dataSize;
public:
bool finished, needsDictionary, error, streamIsValid;
GZIPDecompressHelper (const GZIPDecompressHelper&);
GZIPDecompressHelper& operator= (const GZIPDecompressHelper&);
};
//==============================================================================


+ 3
- 0
src/io/streams/juce_MemoryInputStream.h View File

@@ -83,6 +83,9 @@ private:
const char* data;
size_t dataSize, position;
MemoryBlock internalCopy;
MemoryInputStream (const MemoryInputStream&);
MemoryInputStream& operator= (const MemoryInputStream&);
};
#endif // __JUCE_MEMORYINPUTSTREAM_JUCEHEADER__

+ 3
- 0
src/io/streams/juce_MemoryOutputStream.h View File

@@ -90,6 +90,9 @@ private:
MemoryBlock* data;
ScopedPointer <MemoryBlock> dataToDelete;
size_t position, size, blockSize;
MemoryOutputStream (const MemoryOutputStream&);
MemoryOutputStream& operator= (const MemoryOutputStream&);
};
#endif // __JUCE_MEMORYOUTPUTSTREAM_JUCEHEADER__

+ 7
- 9
src/native/mac/juce_mac_CoreGraphicsContext.mm View File

@@ -38,8 +38,8 @@ public:
const bool clearImage)
: Image (format_, imageWidth_, imageHeight_, clearImage)
{
CGColorSpaceRef colourSpace = format == Image::SingleChannel ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();
CGColorSpaceRef colourSpace = (format == Image::SingleChannel) ? CGColorSpaceCreateDeviceGray()
: CGColorSpaceCreateDeviceRGB();
context = CGBitmapContextCreate (imageData, imageWidth, imageHeight, 8, lineStride,
colourSpace, getCGImageFlags (*this));
@@ -450,8 +450,8 @@ public:
state->fillType.colour.getFloatRed(), state->fillType.colour.getFloatGreen(),
state->fillType.colour.getFloatBlue(), state->fillType.colour.getFloatAlpha());
CGPoint line[] = { { (float) x1 + 0.5f, flipHeight - ((float) y1 + 0.5f) },
{ (float) x2 + 0.5f, flipHeight - ((float) y2 + 0.5f) } };
CGPoint line[] = { { (CGFloat) x1, flipHeight - (CGFloat) y1 },
{ (CGFloat) x2, flipHeight - (CGFloat) y2 } };
CGContextStrokeLineSegments (context, line, 1);
}
@@ -545,7 +545,7 @@ public:
private:
CGContextRef context;
const float flipHeight;
const CGFloat flipHeight;
CGColorSpaceRef rgbColourSpace, greyColourSpace;
CGFunctionCallbacks gradientCallbacks;
@@ -728,10 +728,8 @@ private:
CGContextConcatCTM (context, t);
}
float flipY (float y) const
{
return flipHeight - y;
}
CoreGraphicsContext (const CoreGraphicsContext&);
CoreGraphicsContext& operator= (const CoreGraphicsContext&);
};
LowLevelGraphicsContext* CoreGraphicsImage::createLowLevelContext()


+ 3
- 0
src/native/mac/juce_mac_Fonts.mm View File

@@ -478,6 +478,9 @@ private:
ScopedPointer <CharToGlyphMapper> charToGlyphMapper;
#endif
MacTypeface (const MacTypeface&);
MacTypeface& operator= (const MacTypeface&);
};
const Typeface::Ptr Typeface::createSystemTypefaceFor (const Font& font)


+ 3
- 0
src/text/juce_XmlDocument.h View File

@@ -156,6 +156,9 @@ private:
const String expandEntity (const String& entity);
const String expandExternalEntity (const String& entity);
const String getParameterEntity (const String& entity);
XmlDocument (const XmlDocument&);
XmlDocument& operator= (const XmlDocument&);
};


+ 4
- 0
src/threads/juce_CriticalSection.h View File

@@ -144,6 +144,10 @@ public:
/** A dummy scoped-unlocker type to use with a dummy critical section. */
typedef ScopedLockType ScopedUnlockType;
private:
DummyCriticalSection (const DummyCriticalSection&);
DummyCriticalSection& operator= (const DummyCriticalSection&);
};


Loading…
Cancel
Save