@@ -1,176 +1,176 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
Copyright 2004-7 by Raw Material Software ltd. | |||||
------------------------------------------------------------------------------ | |||||
JUCE can be redistributed and/or modified under the terms of the | |||||
GNU General Public License, as published by the Free Software Foundation; | |||||
either version 2 of the License, or (at your option) any later version. | |||||
JUCE is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with JUCE; if not, visit www.gnu.org/licenses or write to the | |||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |||||
Boston, MA 02111-1307 USA | |||||
------------------------------------------------------------------------------ | |||||
If you'd like to release a closed-source product which uses JUCE, commercial | |||||
licenses are also available: visit www.rawmaterialsoftware.com/juce for | |||||
more information. | |||||
============================================================================== | |||||
*/ | |||||
#include "jucedemo_headers.h" | |||||
#include "MainDemoWindow.h" | |||||
//============================================================================== | |||||
class JUCEDemoApplication : public JUCEApplication | |||||
{ | |||||
/* Important! NEVER embed objects directly inside your JUCEApplication class! Use | |||||
ONLY pointers to objects, which you should create during the initialise() method | |||||
(NOT in the constructor!) and delete in the shutdown() method (NOT in the | |||||
destructor!) | |||||
This is because the application object gets created before Juce has been properly | |||||
initialised, so any embedded objects would also get constructed too soon. | |||||
*/ | |||||
MainDemoWindow* theMainWindow; | |||||
public: | |||||
//============================================================================== | |||||
JUCEDemoApplication() | |||||
: theMainWindow (0) | |||||
{ | |||||
// NEVER do anything in here that could involve any Juce function being called | |||||
// - leave all your startup tasks until the initialise() method. | |||||
} | |||||
~JUCEDemoApplication() | |||||
{ | |||||
// Your shutdown() method should already have done all the things necessary to | |||||
// clean up this app object, so you should never need to put anything in | |||||
// the destructor. | |||||
// Making any Juce calls in here could be very dangerous... | |||||
} | |||||
//============================================================================== | |||||
void initialise (const String& commandLine) | |||||
{ | |||||
// just create the main window... | |||||
theMainWindow = new MainDemoWindow(); | |||||
theMainWindow->centreWithSize (700, 600); | |||||
theMainWindow->setVisible (true); | |||||
// this little function just demonstrates a few system info calls | |||||
Logger::outputDebugString (collectSomeSystemInfo()); | |||||
/* on return from this method, the app will go into its the main event | |||||
dispatch loop, and this will run until something calls | |||||
JUCEAppliction::quit(). | |||||
In this case, JUCEAppliction::quit() will be called by the | |||||
demo window when the user clicks on its close button. | |||||
*/ | |||||
} | |||||
void shutdown() | |||||
{ | |||||
delete theMainWindow; | |||||
theMainWindow = 0; | |||||
} | |||||
//============================================================================== | |||||
const String getApplicationName() | |||||
{ | |||||
return T("JUCE Demo"); | |||||
} | |||||
const String getApplicationVersion() | |||||
{ | |||||
return T("1.0"); | |||||
} | |||||
bool moreThanOneInstanceAllowed() | |||||
{ | |||||
return true; | |||||
} | |||||
void anotherInstanceStarted (const String& commandLine) | |||||
{ | |||||
// This will get called if the user launches another copy of the app, but | |||||
// there's nothing that the demo app needs to do here. | |||||
} | |||||
private: | |||||
//============================================================================== | |||||
// this little function just demonstrates a few system info calls | |||||
static const String collectSomeSystemInfo() | |||||
{ | |||||
String systemInfo; | |||||
systemInfo | |||||
<< T("Time and date: ") << Time::getCurrentTime().toString (true, true) | |||||
<< T("\nOperating system: ") << SystemStats::getOperatingSystemName() | |||||
<< T("\nCPU vendor: ") << SystemStats::getCpuVendor() | |||||
<< T("\nCPU speed: ") << SystemStats::getCpuSpeedInMegaherz() << T("MHz\n") | |||||
<< T("\nNumber of CPUs: ") << SystemStats::getNumCpus() | |||||
<< T("\nCPU has MMX: ") << (SystemStats::hasMMX() ? T("yes") : T("no")) | |||||
<< T("\nCPU has SSE: ") << (SystemStats::hasSSE() ? T("yes") : T("no")) | |||||
<< T("\nCPU has SSE2: ") << (SystemStats::hasSSE2() ? T("yes") : T("no")) | |||||
<< T("\nCPU has 3DNOW: ") << (SystemStats::has3DNow() ? T("yes") : T("no")) | |||||
<< T("\nMemory size: ") << SystemStats::getMemorySizeInMegabytes() << T("MB\n"); | |||||
int64 macAddresses[8]; | |||||
const int numAddresses = SystemStats::getMACAddresses (macAddresses, 8); | |||||
for (int i = 0; i < numAddresses; ++i) | |||||
{ | |||||
systemInfo | |||||
<< T("Found network card MAC address: ") | |||||
<< String::formatted (T("%02x-%02x-%02x-%02x-%02x-%02x\n"), | |||||
0xff & (int) (macAddresses [i] >> 40), | |||||
0xff & (int) (macAddresses [i] >> 32), | |||||
0xff & (int) (macAddresses [i] >> 24), | |||||
0xff & (int) (macAddresses [i] >> 16), | |||||
0xff & (int) (macAddresses [i] >> 8), | |||||
0xff & (int) macAddresses [i]); | |||||
} | |||||
systemInfo | |||||
<< T("Current executable file: ") | |||||
<< File::getSpecialLocation (File::currentExecutableFile).getFullPathName() | |||||
<< T("\nCurrent application file: ") | |||||
<< File::getSpecialLocation (File::currentApplicationFile).getFullPathName() | |||||
<< T("\nUser home directory: ") | |||||
<< File::getSpecialLocation (File::userHomeDirectory).getFullPathName() | |||||
<< T("\nUser documents directory: ") | |||||
<< File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() | |||||
<< T("\nUser application data directory: ") | |||||
<< File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() | |||||
<< T("\nCommon application data directory: ") | |||||
<< File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() | |||||
<< T("\nTemp directory: ") | |||||
<< File::getSpecialLocation (File::tempDirectory).getFullPathName() | |||||
<< T("\n\n"); | |||||
return systemInfo; | |||||
} | |||||
}; | |||||
//============================================================================== | |||||
/* | |||||
This macro creates the application's main() function.. | |||||
*/ | |||||
START_JUCE_APPLICATION (JUCEDemoApplication) | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
Copyright 2004-7 by Raw Material Software ltd. | |||||
------------------------------------------------------------------------------ | |||||
JUCE can be redistributed and/or modified under the terms of the | |||||
GNU General Public License, as published by the Free Software Foundation; | |||||
either version 2 of the License, or (at your option) any later version. | |||||
JUCE is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU General Public License for more details. | |||||
You should have received a copy of the GNU General Public License | |||||
along with JUCE; if not, visit www.gnu.org/licenses or write to the | |||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |||||
Boston, MA 02111-1307 USA | |||||
------------------------------------------------------------------------------ | |||||
If you'd like to release a closed-source product which uses JUCE, commercial | |||||
licenses are also available: visit www.rawmaterialsoftware.com/juce for | |||||
more information. | |||||
============================================================================== | |||||
*/ | |||||
#include "jucedemo_headers.h" | |||||
#include "MainDemoWindow.h" | |||||
//============================================================================== | |||||
class JUCEDemoApplication : public JUCEApplication | |||||
{ | |||||
/* Important! NEVER embed objects directly inside your JUCEApplication class! Use | |||||
ONLY pointers to objects, which you should create during the initialise() method | |||||
(NOT in the constructor!) and delete in the shutdown() method (NOT in the | |||||
destructor!) | |||||
This is because the application object gets created before Juce has been properly | |||||
initialised, so any embedded objects would also get constructed too soon. | |||||
*/ | |||||
MainDemoWindow* theMainWindow; | |||||
public: | |||||
//============================================================================== | |||||
JUCEDemoApplication() | |||||
: theMainWindow (0) | |||||
{ | |||||
// NEVER do anything in here that could involve any Juce function being called | |||||
// - leave all your startup tasks until the initialise() method. | |||||
} | |||||
~JUCEDemoApplication() | |||||
{ | |||||
// Your shutdown() method should already have done all the things necessary to | |||||
// clean up this app object, so you should never need to put anything in | |||||
// the destructor. | |||||
// Making any Juce calls in here could be very dangerous... | |||||
} | |||||
//============================================================================== | |||||
void initialise (const String& commandLine) | |||||
{ | |||||
// just create the main window... | |||||
theMainWindow = new MainDemoWindow(); | |||||
theMainWindow->centreWithSize (700, 600); | |||||
theMainWindow->setVisible (true); | |||||
// this little function just demonstrates a few system info calls | |||||
Logger::outputDebugString (collectSomeSystemInfo()); | |||||
/* on return from this method, the app will go into its the main event | |||||
dispatch loop, and this will run until something calls | |||||
JUCEAppliction::quit(). | |||||
In this case, JUCEAppliction::quit() will be called by the | |||||
demo window when the user clicks on its close button. | |||||
*/ | |||||
} | |||||
void shutdown() | |||||
{ | |||||
delete theMainWindow; | |||||
theMainWindow = 0; | |||||
} | |||||
//============================================================================== | |||||
const String getApplicationName() | |||||
{ | |||||
return T("JUCE Demo"); | |||||
} | |||||
const String getApplicationVersion() | |||||
{ | |||||
return T("1.0"); | |||||
} | |||||
bool moreThanOneInstanceAllowed() | |||||
{ | |||||
return true; | |||||
} | |||||
void anotherInstanceStarted (const String& commandLine) | |||||
{ | |||||
// This will get called if the user launches another copy of the app, but | |||||
// there's nothing that the demo app needs to do here. | |||||
} | |||||
private: | |||||
//============================================================================== | |||||
// this little function just demonstrates a few system info calls | |||||
static const String collectSomeSystemInfo() | |||||
{ | |||||
String systemInfo; | |||||
systemInfo | |||||
<< T("Time and date: ") << Time::getCurrentTime().toString (true, true) | |||||
<< T("\nOperating system: ") << SystemStats::getOperatingSystemName() | |||||
<< T("\nCPU vendor: ") << SystemStats::getCpuVendor() | |||||
<< T("\nCPU speed: ") << SystemStats::getCpuSpeedInMegaherz() << T("MHz\n") | |||||
<< T("\nNumber of CPUs: ") << SystemStats::getNumCpus() | |||||
<< T("\nCPU has MMX: ") << (SystemStats::hasMMX() ? T("yes") : T("no")) | |||||
<< T("\nCPU has SSE: ") << (SystemStats::hasSSE() ? T("yes") : T("no")) | |||||
<< T("\nCPU has SSE2: ") << (SystemStats::hasSSE2() ? T("yes") : T("no")) | |||||
<< T("\nCPU has 3DNOW: ") << (SystemStats::has3DNow() ? T("yes") : T("no")) | |||||
<< T("\nMemory size: ") << SystemStats::getMemorySizeInMegabytes() << T("MB\n"); | |||||
int64 macAddresses[8]; | |||||
const int numAddresses = SystemStats::getMACAddresses (macAddresses, 8); | |||||
for (int i = 0; i < numAddresses; ++i) | |||||
{ | |||||
systemInfo | |||||
<< T("Found network card MAC address: ") | |||||
<< String::formatted (T("%02x-%02x-%02x-%02x-%02x-%02x\n"), | |||||
0xff & (int) (macAddresses [i] >> 40), | |||||
0xff & (int) (macAddresses [i] >> 32), | |||||
0xff & (int) (macAddresses [i] >> 24), | |||||
0xff & (int) (macAddresses [i] >> 16), | |||||
0xff & (int) (macAddresses [i] >> 8), | |||||
0xff & (int) macAddresses [i]); | |||||
} | |||||
systemInfo | |||||
<< T("Current executable file: ") | |||||
<< File::getSpecialLocation (File::currentExecutableFile).getFullPathName() | |||||
<< T("\nCurrent application file: ") | |||||
<< File::getSpecialLocation (File::currentApplicationFile).getFullPathName() | |||||
<< T("\nUser home directory: ") | |||||
<< File::getSpecialLocation (File::userHomeDirectory).getFullPathName() | |||||
<< T("\nUser documents directory: ") | |||||
<< File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName() | |||||
<< T("\nUser application data directory: ") | |||||
<< File::getSpecialLocation (File::userApplicationDataDirectory).getFullPathName() | |||||
<< T("\nCommon application data directory: ") | |||||
<< File::getSpecialLocation (File::commonApplicationDataDirectory).getFullPathName() | |||||
<< T("\nTemp directory: ") | |||||
<< File::getSpecialLocation (File::tempDirectory).getFullPathName() | |||||
<< T("\n\n"); | |||||
return systemInfo; | |||||
} | |||||
}; | |||||
//============================================================================== | |||||
/* | |||||
This macro creates the application's main() function.. | |||||
*/ | |||||
START_JUCE_APPLICATION (JUCEDemoApplication) |
@@ -55,6 +55,11 @@ public: | |||||
/** Receives an incoming message. | /** Receives an incoming message. | ||||
A MidiInput object will call this method when a midi event arrives. It'll be | |||||
called on a high-priority system thread, so avoid doing anything time-consuming | |||||
in here, and avoid making any UI calls. You might find the MidiBuffer class helpful | |||||
for queueing incoming messages for use later. | |||||
@param source the MidiInput object that generated the message | @param source the MidiInput object that generated the message | ||||
@param message the incoming message. The message's timestamp is set to a value | @param message the incoming message. The message's timestamp is set to a value | ||||
equivalent to (Time::getMillisecondCounter() / 1000.0) to specify the | equivalent to (Time::getMillisecondCounter() / 1000.0) to specify the | ||||
@@ -52,6 +52,7 @@ InterprocessConnection::InterprocessConnection (const bool callbacksOnMessageThr | |||||
InterprocessConnection::~InterprocessConnection() | InterprocessConnection::~InterprocessConnection() | ||||
{ | { | ||||
callbackConnectionState = false; | |||||
disconnect(); | disconnect(); | ||||
} | } | ||||
@@ -102,7 +102,7 @@ const String Button::getTooltip() | |||||
for (int i = 0; i < keyPresses.size(); ++i) | for (int i = 0; i < keyPresses.size(); ++i) | ||||
{ | { | ||||
const String key (keyPresses.getUnchecked(i).getTextDescription()); | |||||
const String key (keyPresses.getReference(i).getTextDescription()); | |||||
if (key.length() == 1) | if (key.length() == 1) | ||||
tt << " [shortcut: '" << key << "']"; | tt << " [shortcut: '" << key << "']"; | ||||
@@ -583,7 +583,7 @@ bool Button::isShortcutPressed() const throw() | |||||
if (! isCurrentlyBlockedByAnotherModalComponent()) | if (! isCurrentlyBlockedByAnotherModalComponent()) | ||||
{ | { | ||||
for (int i = shortcuts.size(); --i >= 0;) | for (int i = shortcuts.size(); --i >= 0;) | ||||
if (shortcuts.getUnchecked(i).isCurrentlyDown()) | |||||
if (shortcuts.getReference(i).isCurrentlyDown()) | |||||
return true; | return true; | ||||
} | } | ||||
@@ -593,7 +593,7 @@ bool Button::isShortcutPressed() const throw() | |||||
bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() | bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() | ||||
{ | { | ||||
for (int i = shortcuts.size(); --i >= 0;) | for (int i = shortcuts.size(); --i >= 0;) | ||||
if (key == shortcuts.getUnchecked(i)) | |||||
if (key == shortcuts.getReference(i)) | |||||
return true; | return true; | ||||
return false; | return false; | ||||
@@ -2138,7 +2138,7 @@ void Component::inputAttemptWhenModal() | |||||
{ | { | ||||
getTopLevelComponent()->toFront (true); | getTopLevelComponent()->toFront (true); | ||||
PlatformUtilities::beep(); | |||||
getLookAndFeel().playAlertSound(); | |||||
} | } | ||||
bool Component::canModalEventBeSentToComponent (const Component*) | bool Component::canModalEventBeSentToComponent (const Component*) | ||||
@@ -127,15 +127,23 @@ const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const | |||||
const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool clippedToWorkArea) const throw() | const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool clippedToWorkArea) const throw() | ||||
{ | { | ||||
Rectangle best (getMainMonitorArea (clippedToWorkArea)); | |||||
double bestDistance = 1.0e10; | |||||
for (int i = getNumDisplayMonitors(); --i > 0;) | for (int i = getNumDisplayMonitors(); --i > 0;) | ||||
{ | { | ||||
const Rectangle rect (getDisplayMonitorCoordinates (i, clippedToWorkArea)); | const Rectangle rect (getDisplayMonitorCoordinates (i, clippedToWorkArea)); | ||||
const double distance = juce_hypot ((double) (rect.getCentreX() - cx), | |||||
(double) (rect.getCentreY() - cy)); | |||||
if (rect.contains (cx, cy)) | |||||
return rect; | |||||
if (distance < bestDistance) | |||||
{ | |||||
bestDistance = distance; | |||||
best = rect; | |||||
} | |||||
} | } | ||||
return getMainMonitorArea (clippedToWorkArea); | |||||
return best; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -359,7 +359,8 @@ bool KeyPressMappingSet::keyPressed (const KeyPress& key, | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
PlatformUtilities::beep(); | |||||
if (originatingComponent != 0) | |||||
originatingComponent->getLookAndFeel().playAlertSound(); | |||||
} | } | ||||
} | } | ||||
@@ -2395,6 +2395,13 @@ Image* LookAndFeel::getDefaultDocumentFileImage() | |||||
return ImageCache::getFromMemory (fileicon_png, sizeof (fileicon_png)); | return ImageCache::getFromMemory (fileicon_png, sizeof (fileicon_png)); | ||||
} | } | ||||
//============================================================================== | |||||
void LookAndFeel::playAlertSound() | |||||
{ | |||||
PlatformUtilities::beep(); | |||||
} | |||||
//============================================================================== | //============================================================================== | ||||
static void createRoundedPath (Path& p, | static void createRoundedPath (Path& p, | ||||
const float x, const float y, | const float x, const float y, | ||||
@@ -503,6 +503,10 @@ public: | |||||
virtual const Rectangle getPropertyComponentContentPosition (PropertyComponent& component); | virtual const Rectangle getPropertyComponentContentPosition (PropertyComponent& component); | ||||
//============================================================================== | |||||
/** | |||||
*/ | |||||
virtual void playAlertSound(); | |||||
//============================================================================== | //============================================================================== | ||||
/** Utility function to draw a shiny, glassy circle (for round LED-type buttons). */ | /** Utility function to draw a shiny, glassy circle (for round LED-type buttons). */ | ||||
@@ -112,7 +112,7 @@ public: | |||||
for (int i = 0; i < keyPresses.size(); ++i) | for (int i = 0; i < keyPresses.size(); ++i) | ||||
{ | { | ||||
const String key (keyPresses.getUnchecked(i).getTextDescription()); | |||||
const String key (keyPresses.getReference(i).getTextDescription()); | |||||
if (shortcutKey.isNotEmpty()) | if (shortcutKey.isNotEmpty()) | ||||
shortcutKey << ", "; | shortcutKey << ", "; | ||||
@@ -842,7 +842,7 @@ bool MidiKeyboardComponent::keyStateChanged() | |||||
{ | { | ||||
const int note = 12 * keyMappingOctave + keyPressNotes.getUnchecked (i); | const int note = 12 * keyMappingOctave + keyPressNotes.getUnchecked (i); | ||||
if (keyPresses.getUnchecked (i).isCurrentlyDown()) | |||||
if (keyPresses.getReference(i).isCurrentlyDown()) | |||||
{ | { | ||||
if (! keysPressed [note]) | if (! keysPressed [note]) | ||||
{ | { | ||||
@@ -868,7 +868,7 @@ static void transformedImageRender (Image& destImage, | |||||
const int destClipX, const int destClipY, | const int destClipX, const int destClipY, | ||||
const int destClipW, const int destClipH, | const int destClipW, const int destClipH, | ||||
const int srcClipX, const int srcClipY, | const int srcClipX, const int srcClipY, | ||||
const int srcClipRight, const int srcClipBottom, | |||||
const int srcClipWidth, const int srcClipHeight, | |||||
double srcX, double srcY, | double srcX, double srcY, | ||||
const double lineDX, const double lineDY, | const double lineDX, const double lineDY, | ||||
const double pixelDX, const double pixelDY, | const double pixelDX, const double pixelDY, | ||||
@@ -883,7 +883,7 @@ static void transformedImageRender (Image& destImage, | |||||
uint8* const destPixels = destImage.lockPixelDataReadWrite (destClipX, destClipY, destClipW, destClipH, destStride, destPixelStride); | uint8* const destPixels = destImage.lockPixelDataReadWrite (destClipX, destClipY, destClipW, destClipH, destStride, destPixelStride); | ||||
int srcStride, srcPixelStride; | int srcStride, srcPixelStride; | ||||
const uint8* const srcPixels = sourceImage.lockPixelDataReadOnly (srcClipX, srcClipY, srcClipRight - srcClipX, srcClipBottom - srcClipY, srcStride, srcPixelStride); | |||||
const uint8* const srcPixels = sourceImage.lockPixelDataReadOnly (srcClipX, srcClipY, srcClipWidth, srcClipHeight, srcStride, srcPixelStride); | |||||
if (quality == Graphics::lowResamplingQuality) // nearest-neighbour.. | if (quality == Graphics::lowResamplingQuality) // nearest-neighbour.. | ||||
{ | { | ||||
@@ -896,15 +896,18 @@ static void transformedImageRender (Image& destImage, | |||||
for (int x = 0; x < destClipW; ++x) | for (int x = 0; x < destClipW; ++x) | ||||
{ | { | ||||
const int ix = roundDoubleToInt (floor (sx)); | |||||
const int iy = roundDoubleToInt (floor (sy)); | |||||
const int ix = roundDoubleToInt (floor (sx)) - srcClipX; | |||||
if (ix >= srcClipX && iy >= srcClipY | |||||
&& ix < srcClipRight && iy < srcClipBottom) | |||||
if (((unsigned int) ix) < (unsigned int) srcClipWidth) | |||||
{ | { | ||||
const SrcPixelType* const src = (const SrcPixelType*) (srcPixels + srcStride * (iy - srcClipY) + srcPixelStride * (ix - srcClipX)); | |||||
const int iy = roundDoubleToInt (floor (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->blend (*src, alpha); | |||||
} | |||||
} | } | ||||
++dest; | ++dest; | ||||
@@ -930,42 +933,34 @@ static void transformedImageRender (Image& destImage, | |||||
{ | { | ||||
const double fx = floor (sx); | const double fx = floor (sx); | ||||
const double fy = floor (sy); | const double fy = floor (sy); | ||||
int ix = roundDoubleToInt (fx); | |||||
int iy = roundDoubleToInt (fy); | |||||
const int ix = roundDoubleToInt (fx) - srcClipX; | |||||
const int iy = roundDoubleToInt (fy) - srcClipY; | |||||
if (ix < srcClipRight && iy < srcClipBottom) | |||||
if (ix < srcClipWidth && iy < srcClipHeight) | |||||
{ | { | ||||
const SrcPixelType* src = (const SrcPixelType*) (srcPixels + srcStride * (iy - srcClipY) + srcPixelStride * (ix - srcClipX)); | |||||
const SrcPixelType* src = (const SrcPixelType*) (srcPixels + srcStride * iy + srcPixelStride * ix); | |||||
SrcPixelType p1 (0); | SrcPixelType p1 (0); | ||||
const int dx = roundDoubleToInt ((sx - fx) * 255.0); | const int dx = roundDoubleToInt ((sx - fx) * 255.0); | ||||
if (iy >= srcClipY) | |||||
if (iy >= 0) | |||||
{ | { | ||||
if (ix >= srcClipX) | |||||
if (ix >= 0) | |||||
p1 = src[0]; | p1 = src[0]; | ||||
++ix; | |||||
if (ix >= srcClipX && ix < srcClipRight) | |||||
if (((unsigned int) (ix + 1)) < (unsigned int) srcClipWidth) | |||||
p1.tween (src[1], dx); | p1.tween (src[1], dx); | ||||
--ix; | |||||
} | } | ||||
++iy; | |||||
if (iy >= srcClipY && iy < srcClipBottom) | |||||
if (((unsigned int) (iy + 1)) < (unsigned int) srcClipHeight) | |||||
{ | { | ||||
SrcPixelType p2 (0); | SrcPixelType p2 (0); | ||||
src = (const SrcPixelType*) (((const uint8*) src) + srcStride); | src = (const SrcPixelType*) (((const uint8*) src) + srcStride); | ||||
if (ix >= srcClipX) | |||||
if (ix >= 0) | |||||
p2 = src[0]; | p2 = src[0]; | ||||
++ix; | |||||
if (ix >= srcClipX && ix < srcClipRight) | |||||
if (((unsigned int) (ix + 1)) < (unsigned int) srcClipWidth) | |||||
p2.tween (src[1], dx); | p2.tween (src[1], dx); | ||||
p1.tween (p2, roundDoubleToInt ((sy - fy) * 255.0)); | p1.tween (p2, roundDoubleToInt ((sy - fy) * 255.0)); | ||||
@@ -1808,9 +1803,6 @@ void LowLevelGraphicsSoftwareRenderer::clippedBlendImageWarping (int destClipX, | |||||
1 + roundDoubleToInt (imW), | 1 + roundDoubleToInt (imW), | ||||
1 + roundDoubleToInt (imH))) | 1 + roundDoubleToInt (imH))) | ||||
{ | { | ||||
const int srcClipRight = srcClipX + srcClipW; | |||||
const int srcClipBottom = srcClipY + srcClipH; | |||||
const uint8 alpha = (uint8) jlimit (0, 0xff, roundDoubleToInt (opacity * 256.0f)); | const uint8 alpha = (uint8) jlimit (0, 0xff, roundDoubleToInt (opacity * 256.0f)); | ||||
float srcX1 = (float) destClipX; | float srcX1 = (float) destClipX; | ||||
@@ -1836,7 +1828,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedBlendImageWarping (int destClipX, | |||||
{ | { | ||||
transformedImageRender (image, sourceImage, | transformedImageRender (image, sourceImage, | ||||
destClipX, destClipY, destClipW, destClipH, | destClipX, destClipY, destClipW, destClipH, | ||||
srcClipX, srcClipY, srcClipRight, srcClipBottom, | |||||
srcClipX, srcClipY, srcClipW, srcClipH, | |||||
srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | ||||
alpha, quality, (PixelARGB*)0, (PixelARGB*)0); | alpha, quality, (PixelARGB*)0, (PixelARGB*)0); | ||||
} | } | ||||
@@ -1844,7 +1836,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedBlendImageWarping (int destClipX, | |||||
{ | { | ||||
transformedImageRender (image, sourceImage, | transformedImageRender (image, sourceImage, | ||||
destClipX, destClipY, destClipW, destClipH, | destClipX, destClipY, destClipW, destClipH, | ||||
srcClipX, srcClipY, srcClipRight, srcClipBottom, | |||||
srcClipX, srcClipY, srcClipW, srcClipH, | |||||
srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | ||||
alpha, quality, (PixelARGB*)0, (PixelRGB*)0); | alpha, quality, (PixelARGB*)0, (PixelRGB*)0); | ||||
} | } | ||||
@@ -1859,7 +1851,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedBlendImageWarping (int destClipX, | |||||
{ | { | ||||
transformedImageRender (image, sourceImage, | transformedImageRender (image, sourceImage, | ||||
destClipX, destClipY, destClipW, destClipH, | destClipX, destClipY, destClipW, destClipH, | ||||
srcClipX, srcClipY, srcClipRight, srcClipBottom, | |||||
srcClipX, srcClipY, srcClipW, srcClipH, | |||||
srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | ||||
alpha, quality, (PixelRGB*)0, (PixelARGB*)0); | alpha, quality, (PixelRGB*)0, (PixelARGB*)0); | ||||
} | } | ||||
@@ -1867,7 +1859,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedBlendImageWarping (int destClipX, | |||||
{ | { | ||||
transformedImageRender (image, sourceImage, | transformedImageRender (image, sourceImage, | ||||
destClipX, destClipY, destClipW, destClipH, | destClipX, destClipY, destClipW, destClipH, | ||||
srcClipX, srcClipY, srcClipRight, srcClipBottom, | |||||
srcClipX, srcClipY, srcClipW, srcClipH, | |||||
srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | srcX1, srcY1, lineDX, lineDY, pixelDX, pixelDY, | ||||
alpha, quality, (PixelRGB*)0, (PixelRGB*)0); | alpha, quality, (PixelRGB*)0, (PixelRGB*)0); | ||||
} | } | ||||
@@ -1977,8 +1969,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedDrawVerticalLine (int clipX, int c | |||||
{ | { | ||||
jassert (top <= bottom); | jassert (top <= bottom); | ||||
if (x >= clipX | |||||
&& x < clipX + clipW | |||||
if (((unsigned int) (x - clipX)) < (unsigned int) clipW | |||||
&& top < clipY + clipH | && top < clipY + clipH | ||||
&& bottom > clipY | && bottom > clipY | ||||
&& clipW > 0) | && clipW > 0) | ||||
@@ -2010,8 +2001,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedDrawHorizontalLine (int clipX, int | |||||
{ | { | ||||
jassert (left <= right); | jassert (left <= right); | ||||
if (y >= clipY | |||||
&& y < clipY + clipH | |||||
if (((unsigned int) (y - clipY)) < (unsigned int) clipH | |||||
&& left < clipX + clipW | && left < clipX + clipW | ||||
&& right > clipX | && right > clipX | ||||
&& clipW > 0) | && clipW > 0) | ||||
@@ -37,7 +37,7 @@ | |||||
#define png_error(a, b) png_err(a) | #define png_error(a, b) png_err(a) | ||||
#define png_warning(a, b) | #define png_warning(a, b) | ||||
#define png_chunk_error(a, b) png_err(a) | |||||
#define png_chunk_error(a, b) png_err(a) | |||||
#define png_chunk_warning(a, b) | #define png_chunk_warning(a, b) | ||||
//============================================================================== | //============================================================================== | ||||
@@ -269,8 +269,11 @@ public: | |||||
*/ | */ | ||||
inline ElementType& getReference (const int index) const throw() | inline ElementType& getReference (const int index) const throw() | ||||
{ | { | ||||
lock.enter(); | |||||
jassert (((unsigned int) index) < (unsigned int) numUsed); | jassert (((unsigned int) index) < (unsigned int) numUsed); | ||||
return this->elements [index]; | |||||
ElementType& result = this->elements [index]; | |||||
lock.exit(); | |||||
return result; | |||||
} | } | ||||
/** Returns the first element in the array, or 0 if the array is empty. | /** Returns the first element in the array, or 0 if the array is empty. | ||||
@@ -218,7 +218,7 @@ public: | |||||
lock.enter(); | lock.enter(); | ||||
const ElementType result = (((unsigned int) index) < (unsigned int) numUsed) | const ElementType result = (((unsigned int) index) < (unsigned int) numUsed) | ||||
? this->elements [index] | ? this->elements [index] | ||||
: (ElementType)0; | |||||
: (ElementType) 0; | |||||
lock.exit(); | lock.exit(); | ||||
return result; | return result; | ||||