| @@ -166,8 +166,8 @@ private: | |||
| return AffineTransform::rotation ((float) owner.angleSlider->getValue() / (180.0f / float_Pi)) | |||
| .scaled ((float) owner.sizeSlider->getValue(), | |||
| (float) owner.sizeSlider->getValue()) | |||
| .translated (getWidth() * 0.5f + (float) owner.xSlider->getValue(), | |||
| getHeight() * 0.5f + (float) owner.ySlider->getValue()); | |||
| .translated (getWidth() / 2 + (float) owner.xSlider->getValue(), | |||
| getHeight() / 2 + (float) owner.ySlider->getValue()); | |||
| } | |||
| void clipToRectangle (Graphics& g) | |||
| @@ -261,7 +261,7 @@ void BinaryResources::loadFromCpp (const File& cppFileLocation, const String& cp | |||
| break; | |||
| } | |||
| jassert (size < out.getDataSize() && size > out.getDataSize() - 2); | |||
| jassert (size < (int) out.getDataSize() && size > (int) out.getDataSize() - 2); | |||
| MemoryBlock mb (out.getData(), out.getDataSize()); | |||
| mb.setSize (size); | |||
| @@ -5716,7 +5716,7 @@ public: | |||
| }; | |||
| /* | |||
| The following code allows the atomics to be performed as inline functions where possible... | |||
| The following code is in the header so that the atomics can be inlined where possible... | |||
| */ | |||
| #if (JUCE_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ | |||
| || (JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) | |||
| @@ -5773,6 +5773,11 @@ public: | |||
| #endif | |||
| #endif | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4311) // (truncation warning) | |||
| #endif | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::get() const throw() | |||
| { | |||
| @@ -5893,6 +5898,10 @@ inline void Atomic<Type>::memoryBarrier() throw() | |||
| #endif | |||
| } | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| #endif // __JUCE_ATOMIC_JUCEHEADER__ | |||
| /*** End of inlined file: juce_Atomic.h ***/ | |||
| @@ -18756,8 +18765,6 @@ public: | |||
| */ | |||
| float getTranslationY() const throw() { return mat12; } | |||
| juce_UseDebuggingNewOperator | |||
| /* The transform matrix is: | |||
| (mat00 mat01 mat02) | |||
| @@ -18767,6 +18774,8 @@ public: | |||
| float mat00, mat01, mat02; | |||
| float mat10, mat11, mat12; | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| const AffineTransform followedBy (float mat00, float mat01, float mat02, | |||
| @@ -57041,9 +57050,9 @@ public: | |||
| virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles) = 0; | |||
| virtual void drawLine (double x1, double y1, double x2, double y2) = 0; | |||
| virtual void drawVerticalLine (int x, double top, double bottom) = 0; | |||
| virtual void drawHorizontalLine (int y, double left, double right) = 0; | |||
| virtual void drawLine (const Line <float>& line) = 0; | |||
| virtual void drawVerticalLine (int x, float top, float bottom) = 0; | |||
| virtual void drawHorizontalLine (int y, float left, float right) = 0; | |||
| virtual void setFont (const Font& newFont) = 0; | |||
| virtual const Font getFont() = 0; | |||
| @@ -57103,10 +57112,10 @@ public: | |||
| void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles); | |||
| void drawLine (double x1, double y1, double x2, double y2); | |||
| void drawLine (const Line <float>& line); | |||
| void drawVerticalLine (int x, double top, double bottom); | |||
| void drawHorizontalLine (int x, double top, double bottom); | |||
| void drawVerticalLine (int x, float top, float bottom); | |||
| void drawHorizontalLine (int x, float top, float bottom); | |||
| const Font getFont(); | |||
| void setFont (const Font& newFont); | |||
| @@ -57159,8 +57168,6 @@ protected: | |||
| #ifndef __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__ | |||
| #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__ | |||
| class LLGCSavedState; | |||
| /** | |||
| A lowest-common-denominator implementation of LowLevelGraphicsContext that does all | |||
| its rendering in memory. | |||
| @@ -57203,10 +57210,10 @@ public: | |||
| void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles); | |||
| void drawLine (double x1, double y1, double x2, double y2); | |||
| void drawLine (const Line <float>& line); | |||
| void drawVerticalLine (int x, double top, double bottom); | |||
| void drawHorizontalLine (int x, double top, double bottom); | |||
| void drawVerticalLine (int x, float top, float bottom); | |||
| void drawHorizontalLine (int x, float top, float bottom); | |||
| void setFont (const Font& newFont); | |||
| const Font getFont(); | |||
| @@ -57219,8 +57226,14 @@ protected: | |||
| Image& image; | |||
| ScopedPointer <LLGCSavedState> currentState; | |||
| OwnedArray <LLGCSavedState> stateStack; | |||
| class GlyphCache; | |||
| class CachedGlyph; | |||
| class SavedState; | |||
| friend class ScopedPointer <SavedState>; | |||
| friend class OwnedArray <SavedState>; | |||
| friend class OwnedArray <CachedGlyph>; | |||
| ScopedPointer <SavedState> currentState; | |||
| OwnedArray <SavedState> stateStack; | |||
| LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other); | |||
| LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&); | |||
| @@ -57815,14 +57828,10 @@ public: | |||
| */ | |||
| bool next(); | |||
| /** The x position of the start of the current line segment. */ | |||
| float x1; | |||
| /** The y position of the start of the current line segment. */ | |||
| float y1; | |||
| /** The x position of the end of the current line segment. */ | |||
| float x2; | |||
| /** The y position of the end of the current line segment. */ | |||
| float y2; | |||
| float x1; /**< The x position of the start of the current line segment. */ | |||
| float y1; /**< The y position of the start of the current line segment. */ | |||
| float x2; /**< The x position of the end of the current line segment. */ | |||
| float y2; /**< The y position of the end of the current line segment. */ | |||
| /** Indicates whether the current line segment is closing a sub-path. | |||
| @@ -57839,9 +57848,8 @@ public: | |||
| int subPathIndex; | |||
| /** Returns true if the current segment is the last in the current sub-path. */ | |||
| bool isLastInSubpath() const { return stackPos == stackBase.getData() | |||
| && (index >= path.numElements | |||
| || points [index] == Path::moveMarker); } | |||
| bool isLastInSubpath() const throw() { return stackPos == stackBase.getData() | |||
| && (index >= path.numElements || points [index] == Path::moveMarker); } | |||
| juce_UseDebuggingNewOperator | |||
| @@ -34,14 +34,13 @@ | |||
| #include "../../core/juce_StandardHeader.h" | |||
| #ifdef _MSC_VER | |||
| #pragma warning (disable : 4505) | |||
| #pragma warning (push) | |||
| #endif | |||
| namespace FlacNamespace | |||
| { | |||
| #if JUCE_INCLUDE_FLAC_CODE | |||
| #if JUCE_MSVC | |||
| #pragma warning (disable : 4505) // (unreferenced static function removal warning) | |||
| #endif | |||
| #define FLAC__NO_DLL 1 | |||
| #if ! defined (SIZE_MAX) | |||
| @@ -73,10 +72,6 @@ namespace FlacNamespace | |||
| #undef max | |||
| #undef min | |||
| #ifdef _MSC_VER | |||
| #pragma warning (pop) | |||
| #endif | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_FlacAudioFormat.h" | |||
| @@ -84,7 +84,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #undef PRAGMA_ALIGN_SUPPORTED | |||
| #define VST_FORCE_DEPRECATED 0 | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4996) | |||
| #endif | |||
| @@ -97,7 +97,7 @@ BEGIN_JUCE_NAMESPACE | |||
| */ | |||
| #include "pluginterfaces/vst2.x/aeffectx.h" | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -2311,14 +2311,14 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||
| break; | |||
| case audioMasterGetTime: | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4311) | |||
| #endif | |||
| return (VstIntPtr) &vstHostTime; | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| break; | |||
| @@ -150,7 +150,7 @@ public: | |||
| //============================================================================== | |||
| /* | |||
| The following code allows the atomics to be performed as inline functions where possible... | |||
| The following code is in the header so that the atomics can be inlined where possible... | |||
| */ | |||
| #if (JUCE_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2 || ! defined (__IPHONE_3_2))) \ | |||
| || (JUCE_MAC && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2))) | |||
| @@ -208,6 +208,11 @@ public: | |||
| #endif | |||
| #endif | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4311) // (truncation warning) | |||
| #endif | |||
| //============================================================================== | |||
| template <typename Type> | |||
| inline Type Atomic<Type>::get() const throw() | |||
| @@ -329,5 +334,8 @@ inline void Atomic<Type>::memoryBarrier() throw() | |||
| #endif | |||
| } | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| #endif // __JUCE_ATOMIC_JUCEHEADER__ | |||
| @@ -23,13 +23,13 @@ | |||
| ============================================================================== | |||
| */ | |||
| #ifdef _MSC_VER | |||
| #pragma warning (disable: 4514) | |||
| #include "juce_StandardHeader.h" | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514) | |||
| #endif | |||
| #include "juce_StandardHeader.h" | |||
| #ifndef JUCE_WINDOWS | |||
| #include <sys/time.h> | |||
| #else | |||
| @@ -38,15 +38,7 @@ | |||
| #include <sys/timeb.h> | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_Time.h" | |||
| #include "../threads/juce_Thread.h" | |||
| #include "../containers/juce_MemoryBlock.h" | |||
| #include "../text/juce_LocalisedStrings.h" | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #ifdef _INC_TIME_INL | |||
| @@ -54,6 +46,13 @@ BEGIN_JUCE_NAMESPACE | |||
| #endif | |||
| #endif | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_Time.h" | |||
| #include "../threads/juce_Thread.h" | |||
| #include "../containers/juce_MemoryBlock.h" | |||
| #include "../text/juce_LocalisedStrings.h" | |||
| //============================================================================== | |||
| namespace TimeHelpers | |||
| { | |||
| @@ -1,211 +1,211 @@ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| 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. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_EDGETABLE_JUCEHEADER__ | |||
| #define __JUCE_EDGETABLE_JUCEHEADER__ | |||
| #include "../geometry/juce_AffineTransform.h" | |||
| #include "../geometry/juce_Rectangle.h" | |||
| #include "../geometry/juce_RectangleList.h" | |||
| #include "../../../containers/juce_MemoryBlock.h" | |||
| class Path; | |||
| class Image; | |||
| //============================================================================== | |||
| /** | |||
| A table of horizontal scan-line segments - used for rasterising Paths. | |||
| @see Path, Graphics | |||
| */ | |||
| class JUCE_API EdgeTable | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an edge table containing a path. | |||
| A table is created with a fixed vertical range, and only sections of the path | |||
| which lie within this range will be added to the table. | |||
| @param clipLimits only the region of the path that lies within this area will be added | |||
| @param pathToAdd the path to add to the table | |||
| @param transform a transform to apply to the path being added | |||
| */ | |||
| EdgeTable (const Rectangle<int>& clipLimits, | |||
| const Path& pathToAdd, | |||
| const AffineTransform& transform); | |||
| /** Creates an edge table containing a rectangle. | |||
| */ | |||
| EdgeTable (const Rectangle<int>& rectangleToAdd); | |||
| /** Creates an edge table containing a rectangle list. | |||
| */ | |||
| EdgeTable (const RectangleList& rectanglesToAdd); | |||
| /** Creates an edge table containing a rectangle. | |||
| */ | |||
| EdgeTable (const Rectangle<float>& rectangleToAdd); | |||
| /** Creates a copy of another edge table. */ | |||
| EdgeTable (const EdgeTable& other); | |||
| /** Copies from another edge table. */ | |||
| EdgeTable& operator= (const EdgeTable& other); | |||
| /** Destructor. */ | |||
| ~EdgeTable(); | |||
| //============================================================================== | |||
| void clipToRectangle (const Rectangle<int>& r) throw(); | |||
| void excludeRectangle (const Rectangle<int>& r) throw(); | |||
| void clipToEdgeTable (const EdgeTable& other); | |||
| void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw(); | |||
| bool isEmpty() throw(); | |||
| const Rectangle<int>& getMaximumBounds() const throw() { return bounds; } | |||
| void translate (float dx, int dy) throw(); | |||
| /** Reduces the amount of space the table has allocated. | |||
| This will shrink the table down to use as little memory as possible - useful for | |||
| read-only tables that get stored and re-used for rendering. | |||
| */ | |||
| void optimiseTable() throw(); | |||
| //============================================================================== | |||
| /** Iterates the lines in the table, for rendering. | |||
| This function will iterate each line in the table, and call a user-defined class | |||
| to render each pixel or continuous line of pixels that the table contains. | |||
| @param iterationCallback this templated class must contain the following methods: | |||
| @code | |||
| inline void setEdgeTableYPos (int y); | |||
| inline void handleEdgeTablePixel (int x, int alphaLevel) const; | |||
| inline void handleEdgeTableLine (int x, int width, int alphaLevel) const; | |||
| @endcode | |||
| (these don't necessarily have to be 'const', but it might help it go faster) | |||
| */ | |||
| template <class EdgeTableIterationCallback> | |||
| void iterate (EdgeTableIterationCallback& iterationCallback) const throw() | |||
| { | |||
| const int* lineStart = table; | |||
| for (int y = 0; y < bounds.getHeight(); ++y) | |||
| { | |||
| const int* line = lineStart; | |||
| lineStart += lineStrideElements; | |||
| int numPoints = line[0]; | |||
| if (--numPoints > 0) | |||
| { | |||
| int x = *++line; | |||
| jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight()); | |||
| int levelAccumulator = 0; | |||
| iterationCallback.setEdgeTableYPos (bounds.getY() + y); | |||
| while (--numPoints >= 0) | |||
| { | |||
| const int level = *++line; | |||
| jassert (((unsigned int) level) < (unsigned int) 256); | |||
| const int endX = *++line; | |||
| jassert (endX >= x); | |||
| const int endOfRun = (endX >> 8); | |||
| if (endOfRun == (x >> 8)) | |||
| { | |||
| // small segment within the same pixel, so just save it for the next | |||
| // time round.. | |||
| levelAccumulator += (endX - x) * level; | |||
| } | |||
| else | |||
| { | |||
| // plot the fist pixel of this segment, including any accumulated | |||
| // levels from smaller segments that haven't been drawn yet | |||
| levelAccumulator += (0xff - (x & 0xff)) * level; | |||
| levelAccumulator >>= 8; | |||
| x >>= 8; | |||
| if (levelAccumulator > 0) | |||
| { | |||
| if (levelAccumulator >> 8) | |||
| levelAccumulator = 0xff; | |||
| iterationCallback.handleEdgeTablePixel (x, levelAccumulator); | |||
| } | |||
| // if there's a run of similar pixels, do it all in one go.. | |||
| if (level > 0) | |||
| { | |||
| jassert (endOfRun <= bounds.getRight()); | |||
| const int numPix = endOfRun - ++x; | |||
| if (numPix > 0) | |||
| iterationCallback.handleEdgeTableLine (x, numPix, level); | |||
| } | |||
| // save the bit at the end to be drawn next time round the loop. | |||
| levelAccumulator = (endX & 0xff) * level; | |||
| } | |||
| x = endX; | |||
| } | |||
| if (levelAccumulator > 0) | |||
| { | |||
| levelAccumulator >>= 8; | |||
| if (levelAccumulator >> 8) | |||
| levelAccumulator = 0xff; | |||
| x >>= 8; | |||
| jassert (x >= bounds.getX() && x < bounds.getRight()); | |||
| iterationCallback.handleEdgeTablePixel (x, levelAccumulator); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc | |||
| HeapBlock<int> table; | |||
| Rectangle<int> bounds; | |||
| int maxEdgesPerLine, lineStrideElements; | |||
| bool needToCheckEmptinesss; | |||
| void addEdgePoint (int x, int y, int winding) throw(); | |||
| void remapTableForNumEdges (int newNumEdgesPerLine) throw(); | |||
| void intersectWithEdgeTableLine (int y, const int* otherLine) throw(); | |||
| void clipEdgeTableLineToRange (int* line, int x1, int x2) throw(); | |||
| void sanitiseLevels (bool useNonZeroWinding) throw(); | |||
| static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw(); | |||
| }; | |||
| #endif // __JUCE_EDGETABLE_JUCEHEADER__ | |||
| /* | |||
| ============================================================================== | |||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||
| Copyright 2004-10 by Raw Material Software Ltd. | |||
| ------------------------------------------------------------------------------ | |||
| JUCE can be redistributed and/or modified under the terms of the GNU General | |||
| Public License (Version 2), as published by the Free Software Foundation. | |||
| A copy of the license is included in the JUCE distribution, or can be found | |||
| online at www.gnu.org/licenses. | |||
| 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. | |||
| ------------------------------------------------------------------------------ | |||
| To release a closed-source product which uses JUCE, commercial licenses are | |||
| available: visit www.rawmaterialsoftware.com/juce for more information. | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_EDGETABLE_JUCEHEADER__ | |||
| #define __JUCE_EDGETABLE_JUCEHEADER__ | |||
| #include "../geometry/juce_AffineTransform.h" | |||
| #include "../geometry/juce_Rectangle.h" | |||
| #include "../geometry/juce_RectangleList.h" | |||
| #include "../../../containers/juce_MemoryBlock.h" | |||
| class Path; | |||
| class Image; | |||
| //============================================================================== | |||
| /** | |||
| A table of horizontal scan-line segments - used for rasterising Paths. | |||
| @see Path, Graphics | |||
| */ | |||
| class JUCE_API EdgeTable | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| /** Creates an edge table containing a path. | |||
| A table is created with a fixed vertical range, and only sections of the path | |||
| which lie within this range will be added to the table. | |||
| @param clipLimits only the region of the path that lies within this area will be added | |||
| @param pathToAdd the path to add to the table | |||
| @param transform a transform to apply to the path being added | |||
| */ | |||
| EdgeTable (const Rectangle<int>& clipLimits, | |||
| const Path& pathToAdd, | |||
| const AffineTransform& transform); | |||
| /** Creates an edge table containing a rectangle. | |||
| */ | |||
| EdgeTable (const Rectangle<int>& rectangleToAdd); | |||
| /** Creates an edge table containing a rectangle list. | |||
| */ | |||
| EdgeTable (const RectangleList& rectanglesToAdd); | |||
| /** Creates an edge table containing a rectangle. | |||
| */ | |||
| EdgeTable (const Rectangle<float>& rectangleToAdd); | |||
| /** Creates a copy of another edge table. */ | |||
| EdgeTable (const EdgeTable& other); | |||
| /** Copies from another edge table. */ | |||
| EdgeTable& operator= (const EdgeTable& other); | |||
| /** Destructor. */ | |||
| ~EdgeTable(); | |||
| //============================================================================== | |||
| void clipToRectangle (const Rectangle<int>& r) throw(); | |||
| void excludeRectangle (const Rectangle<int>& r) throw(); | |||
| void clipToEdgeTable (const EdgeTable& other); | |||
| void clipLineToMask (int x, int y, const uint8* mask, int maskStride, int numPixels) throw(); | |||
| bool isEmpty() throw(); | |||
| const Rectangle<int>& getMaximumBounds() const throw() { return bounds; } | |||
| void translate (float dx, int dy) throw(); | |||
| /** Reduces the amount of space the table has allocated. | |||
| This will shrink the table down to use as little memory as possible - useful for | |||
| read-only tables that get stored and re-used for rendering. | |||
| */ | |||
| void optimiseTable() throw(); | |||
| //============================================================================== | |||
| /** Iterates the lines in the table, for rendering. | |||
| This function will iterate each line in the table, and call a user-defined class | |||
| to render each pixel or continuous line of pixels that the table contains. | |||
| @param iterationCallback this templated class must contain the following methods: | |||
| @code | |||
| inline void setEdgeTableYPos (int y); | |||
| inline void handleEdgeTablePixel (int x, int alphaLevel) const; | |||
| inline void handleEdgeTableLine (int x, int width, int alphaLevel) const; | |||
| @endcode | |||
| (these don't necessarily have to be 'const', but it might help it go faster) | |||
| */ | |||
| template <class EdgeTableIterationCallback> | |||
| void iterate (EdgeTableIterationCallback& iterationCallback) const throw() | |||
| { | |||
| const int* lineStart = table; | |||
| for (int y = 0; y < bounds.getHeight(); ++y) | |||
| { | |||
| const int* line = lineStart; | |||
| lineStart += lineStrideElements; | |||
| int numPoints = line[0]; | |||
| if (--numPoints > 0) | |||
| { | |||
| int x = *++line; | |||
| jassert ((x >> 8) >= bounds.getX() && (x >> 8) < bounds.getRight()); | |||
| int levelAccumulator = 0; | |||
| iterationCallback.setEdgeTableYPos (bounds.getY() + y); | |||
| while (--numPoints >= 0) | |||
| { | |||
| const int level = *++line; | |||
| jassert (((unsigned int) level) < (unsigned int) 256); | |||
| const int endX = *++line; | |||
| jassert (endX >= x); | |||
| const int endOfRun = (endX >> 8); | |||
| if (endOfRun == (x >> 8)) | |||
| { | |||
| // small segment within the same pixel, so just save it for the next | |||
| // time round.. | |||
| levelAccumulator += (endX - x) * level; | |||
| } | |||
| else | |||
| { | |||
| // plot the fist pixel of this segment, including any accumulated | |||
| // levels from smaller segments that haven't been drawn yet | |||
| levelAccumulator += (0xff - (x & 0xff)) * level; | |||
| levelAccumulator >>= 8; | |||
| x >>= 8; | |||
| if (levelAccumulator > 0) | |||
| { | |||
| if (levelAccumulator >> 8) | |||
| levelAccumulator = 0xff; | |||
| iterationCallback.handleEdgeTablePixel (x, levelAccumulator); | |||
| } | |||
| // if there's a run of similar pixels, do it all in one go.. | |||
| if (level > 0) | |||
| { | |||
| jassert (endOfRun <= bounds.getRight()); | |||
| const int numPix = endOfRun - ++x; | |||
| if (numPix > 0) | |||
| iterationCallback.handleEdgeTableLine (x, numPix, level); | |||
| } | |||
| // save the bit at the end to be drawn next time round the loop. | |||
| levelAccumulator = (endX & 0xff) * level; | |||
| } | |||
| x = endX; | |||
| } | |||
| if (levelAccumulator > 0) | |||
| { | |||
| levelAccumulator >>= 8; | |||
| if (levelAccumulator >> 8) | |||
| levelAccumulator = 0xff; | |||
| x >>= 8; | |||
| jassert (x >= bounds.getX() && x < bounds.getRight()); | |||
| iterationCallback.handleEdgeTablePixel (x, levelAccumulator); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| // table line format: number of points; point0 x, point0 levelDelta, point1 x, point1 levelDelta, etc | |||
| HeapBlock<int> table; | |||
| Rectangle<int> bounds; | |||
| int maxEdgesPerLine, lineStrideElements; | |||
| bool needToCheckEmptinesss; | |||
| void addEdgePoint (int x, int y, int winding) throw(); | |||
| void remapTableForNumEdges (int newNumEdgesPerLine) throw(); | |||
| void intersectWithEdgeTableLine (int y, const int* otherLine) throw(); | |||
| void clipEdgeTableLineToRange (int* line, int x1, int x2) throw(); | |||
| void sanitiseLevels (bool useNonZeroWinding) throw(); | |||
| static void copyEdgeTableData (int* dest, int destLineStride, const int* src, int srcLineStride, int numLines) throw(); | |||
| }; | |||
| #endif // __JUCE_EDGETABLE_JUCEHEADER__ | |||
| @@ -532,7 +532,7 @@ void Graphics::drawHorizontalLine (const int y, float left, float right) const | |||
| void Graphics::drawLine (float x1, float y1, float x2, float y2) const | |||
| { | |||
| context->drawLine (x1, y1, x2, y2); | |||
| context->drawLine (Line<float> (x1, y1, x2, y2)); | |||
| } | |||
| void Graphics::drawLine (const float startX, const float startY, | |||
| @@ -91,9 +91,9 @@ public: | |||
| virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles) = 0; | |||
| virtual void drawLine (double x1, double y1, double x2, double y2) = 0; | |||
| virtual void drawVerticalLine (int x, double top, double bottom) = 0; | |||
| virtual void drawHorizontalLine (int y, double left, double right) = 0; | |||
| virtual void drawLine (const Line <float>& line) = 0; | |||
| virtual void drawVerticalLine (int x, float top, float bottom) = 0; | |||
| virtual void drawHorizontalLine (int y, float left, float right) = 0; | |||
| virtual void setFont (const Font& newFont) = 0; | |||
| virtual const Font getFont() = 0; | |||
| @@ -499,22 +499,21 @@ void LowLevelGraphicsPostScriptRenderer::drawImage (const Image& sourceImage, co | |||
| //============================================================================== | |||
| void LowLevelGraphicsPostScriptRenderer::drawLine (double x1, double y1, double x2, double y2) | |||
| void LowLevelGraphicsPostScriptRenderer::drawLine (const Line <float>& line) | |||
| { | |||
| Path p; | |||
| p.addLineSegment ((float) x1, (float) y1, (float) x2, (float) y2, 1.0f); | |||
| p.addLineSegment (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY(), 1.0f); | |||
| fillPath (p, AffineTransform::identity); | |||
| } | |||
| void LowLevelGraphicsPostScriptRenderer::drawVerticalLine (const int x, double top, double bottom) | |||
| void LowLevelGraphicsPostScriptRenderer::drawVerticalLine (const int x, float top, float bottom) | |||
| { | |||
| drawLine (x, top, x, bottom); | |||
| drawLine (Line<float> ((float) x, top, (float) x, bottom)); | |||
| } | |||
| void LowLevelGraphicsPostScriptRenderer::drawHorizontalLine (const int y, double left, double right) | |||
| void LowLevelGraphicsPostScriptRenderer::drawHorizontalLine (const int y, float left, float right) | |||
| { | |||
| drawLine (left, y, right, y); | |||
| drawLine (Line<float> (left, (float) y, right, (float) y)); | |||
| } | |||
| //============================================================================== | |||
| @@ -75,10 +75,10 @@ public: | |||
| void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles); | |||
| void drawLine (double x1, double y1, double x2, double y2); | |||
| void drawLine (const Line <float>& line); | |||
| void drawVerticalLine (int x, double top, double bottom); | |||
| void drawHorizontalLine (int x, double top, double bottom); | |||
| void drawVerticalLine (int x, float top, float bottom); | |||
| void drawHorizontalLine (int x, float top, float bottom); | |||
| //============================================================================== | |||
| const Font getFont(); | |||
| @@ -42,15 +42,18 @@ BEGIN_JUCE_NAMESPACE | |||
| #endif | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4127) // "expression is constant" warning | |||
| #if JUCE_DEBUG | |||
| #pragma optimize ("t", on) // optimise just this file, to avoid sluggish graphics when debugging | |||
| #pragma warning (disable: 4714) // warning about forcedinline methods not being inlined | |||
| #endif | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4127) // "expression is constant" warning | |||
| #endif | |||
| namespace SoftwareRendererClasses | |||
| { | |||
| //============================================================================== | |||
| template <class PixelType, bool replaceExisting = false> | |||
| class SolidColourEdgeTableRenderer | |||
| @@ -899,7 +902,7 @@ public: | |||
| virtual const Ptr clone() const = 0; | |||
| const Ptr clipTo (ClipRegionBase* other); | |||
| virtual const Ptr applyClipTo (const Ptr& target) const = 0; | |||
| virtual const Ptr clipToRectangle (const Rectangle<int>& r) = 0; | |||
| virtual const Ptr clipToRectangleList (const RectangleList& r) = 0; | |||
| virtual const Ptr excludeClipRectangle (const Rectangle<int>& r) = 0; | |||
| @@ -914,14 +917,14 @@ public: | |||
| virtual void fillRectWithColour (Image::BitmapData& destData, const Rectangle<float>& area, const PixelARGB& colour) const = 0; | |||
| virtual void fillAllWithColour (Image::BitmapData& destData, const PixelARGB& colour, bool replaceContents) const = 0; | |||
| virtual void fillAllWithGradient (Image::BitmapData& destData, ColourGradient& gradient, const AffineTransform& transform, bool isIdentity) const = 0; | |||
| virtual void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, const AffineTransform& t, bool betterQuality, bool tiledFill) const = 0; | |||
| virtual void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, int x, int y, bool tiledFill) const = 0; | |||
| virtual void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, const AffineTransform& t, bool betterQuality, bool tiledFill) const = 0; | |||
| virtual void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, int x, int y, bool tiledFill) const = 0; | |||
| protected: | |||
| //============================================================================== | |||
| template <class Iterator> | |||
| static void renderImageTransformedInternal (Iterator& iter, const Image::BitmapData& destData, const Image::BitmapData& srcData, | |||
| const Rectangle<int>& srcClip, const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) | |||
| const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) | |||
| { | |||
| switch (destData.pixelFormat) | |||
| { | |||
| @@ -982,7 +985,7 @@ protected: | |||
| } | |||
| template <class Iterator> | |||
| static void renderImageUntransformedInternal (Iterator& iter, const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, int x, int y, bool tiledFill) | |||
| static void renderImageUntransformedInternal (Iterator& iter, const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, int x, int y, bool tiledFill) | |||
| { | |||
| switch (destData.pixelFormat) | |||
| { | |||
| @@ -1102,6 +1105,11 @@ public: | |||
| return new ClipRegion_EdgeTable (*this); | |||
| } | |||
| const Ptr applyClipTo (const Ptr& target) const | |||
| { | |||
| return target->clipToEdgeTable (edgeTable); | |||
| } | |||
| const Ptr clipToRectangle (const Rectangle<int>& r) | |||
| { | |||
| edgeTable.clipToRectangle (r); | |||
| @@ -1239,14 +1247,14 @@ public: | |||
| } | |||
| } | |||
| void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) const | |||
| void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) const | |||
| { | |||
| renderImageTransformedInternal (edgeTable, destData, srcData, srcClip, alpha, transform, betterQuality, tiledFill); | |||
| renderImageTransformedInternal (edgeTable, destData, srcData, alpha, transform, betterQuality, tiledFill); | |||
| } | |||
| void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, int x, int y, bool tiledFill) const | |||
| void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, int x, int y, bool tiledFill) const | |||
| { | |||
| renderImageUntransformedInternal (edgeTable, destData, srcData, srcClip, alpha, x, y, tiledFill); | |||
| renderImageUntransformedInternal (edgeTable, destData, srcData, alpha, x, y, tiledFill); | |||
| } | |||
| EdgeTable edgeTable; | |||
| @@ -1293,6 +1301,11 @@ public: | |||
| return new ClipRegion_RectangleList (*this); | |||
| } | |||
| const Ptr applyClipTo (const Ptr& target) const | |||
| { | |||
| return target->clipToRectangleList (clip); | |||
| } | |||
| const Ptr clipToRectangle (const Rectangle<int>& r) | |||
| { | |||
| clip.clipTo (r); | |||
| @@ -1384,14 +1397,14 @@ public: | |||
| } | |||
| } | |||
| void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) const | |||
| void renderImageTransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, const AffineTransform& transform, bool betterQuality, bool tiledFill) const | |||
| { | |||
| renderImageTransformedInternal (*this, destData, srcData, srcClip, alpha, transform, betterQuality, tiledFill); | |||
| renderImageTransformedInternal (*this, destData, srcData, alpha, transform, betterQuality, tiledFill); | |||
| } | |||
| void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const Rectangle<int>& srcClip, const int alpha, int x, int y, bool tiledFill) const | |||
| void renderImageUntransformed (const Image::BitmapData& destData, const Image::BitmapData& srcData, const int alpha, int x, int y, bool tiledFill) const | |||
| { | |||
| renderImageUntransformedInternal (*this, destData, srcData, srcClip, alpha, x, y, tiledFill); | |||
| renderImageUntransformedInternal (*this, destData, srcData, alpha, x, y, tiledFill); | |||
| } | |||
| RectangleList clip; | |||
| @@ -1455,6 +1468,9 @@ private: | |||
| private: | |||
| const RectangleList& clip; | |||
| const Rectangle<int> area; | |||
| SubRectangleIterator (const SubRectangleIterator&); | |||
| SubRectangleIterator& operator= (const SubRectangleIterator&); | |||
| }; | |||
| //============================================================================== | |||
| @@ -1618,55 +1634,39 @@ private: | |||
| private: | |||
| const RectangleList& clip; | |||
| const Rectangle<float>& area; | |||
| SubRectangleIteratorFloat (const SubRectangleIteratorFloat&); | |||
| SubRectangleIteratorFloat& operator= (const SubRectangleIteratorFloat&); | |||
| }; | |||
| ClipRegion_RectangleList& operator= (const ClipRegion_RectangleList&); | |||
| }; | |||
| //============================================================================== | |||
| const ClipRegionBase::Ptr ClipRegionBase::clipTo (ClipRegionBase* const other) | |||
| { | |||
| ClipRegion_EdgeTable* et = dynamic_cast <ClipRegion_EdgeTable*> (other); | |||
| if (et != 0) | |||
| return clipToEdgeTable (et->edgeTable); | |||
| ClipRegion_RectangleList* rl = dynamic_cast <ClipRegion_RectangleList*> (other); | |||
| if (rl != 0) | |||
| return clipToRectangleList (rl->clip); | |||
| jassertfalse | |||
| return 0; | |||
| } | |||
| //============================================================================== | |||
| class LLGCSavedState | |||
| class LowLevelGraphicsSoftwareRenderer::SavedState | |||
| { | |||
| public: | |||
| LLGCSavedState (const Rectangle<int>& clip_, const int xOffset_, const int yOffset_) | |||
| : clip (new ClipRegion_RectangleList (clip_)), | |||
| xOffset (xOffset_), yOffset (yOffset_), | |||
| interpolationQuality (Graphics::mediumResamplingQuality) | |||
| SavedState (const Rectangle<int>& clip_, const int xOffset_, const int yOffset_) | |||
| : clip (new SoftwareRendererClasses::ClipRegion_RectangleList (clip_)), | |||
| xOffset (xOffset_), yOffset (yOffset_), interpolationQuality (Graphics::mediumResamplingQuality) | |||
| { | |||
| } | |||
| LLGCSavedState (const RectangleList& clip_, const int xOffset_, const int yOffset_) | |||
| : clip (new ClipRegion_RectangleList (clip_)), | |||
| xOffset (xOffset_), yOffset (yOffset_), | |||
| interpolationQuality (Graphics::mediumResamplingQuality) | |||
| SavedState (const RectangleList& clip_, const int xOffset_, const int yOffset_) | |||
| : clip (new SoftwareRendererClasses::ClipRegion_RectangleList (clip_)), | |||
| xOffset (xOffset_), yOffset (yOffset_), interpolationQuality (Graphics::mediumResamplingQuality) | |||
| { | |||
| } | |||
| LLGCSavedState (const LLGCSavedState& other) | |||
| : clip (other.clip), xOffset (other.xOffset), | |||
| yOffset (other.yOffset), font (other.font), | |||
| SavedState (const SavedState& other) | |||
| : clip (other.clip), xOffset (other.xOffset), yOffset (other.yOffset), font (other.font), | |||
| fillType (other.fillType), interpolationQuality (other.interpolationQuality) | |||
| { | |||
| } | |||
| ~LLGCSavedState() | |||
| ~SavedState() | |||
| { | |||
| } | |||
| @@ -1766,7 +1766,7 @@ public: | |||
| const Rectangle<int> clipped (totalClip.getIntersection (r.translated (xOffset, yOffset))); | |||
| if (! clipped.isEmpty()) | |||
| fillShape (image, new ClipRegion_RectangleList (clipped), false); | |||
| fillShape (image, new SoftwareRendererClasses::ClipRegion_RectangleList (clipped), false); | |||
| } | |||
| } | |||
| } | |||
| @@ -1786,7 +1786,7 @@ public: | |||
| const Rectangle<float> clipped (totalClip.getIntersection (r.translated ((float) xOffset, (float) yOffset))); | |||
| if (! clipped.isEmpty()) | |||
| fillShape (image, new ClipRegion_EdgeTable (clipped), false); | |||
| fillShape (image, new SoftwareRendererClasses::ClipRegion_EdgeTable (clipped), false); | |||
| } | |||
| } | |||
| } | |||
| @@ -1794,31 +1794,31 @@ public: | |||
| void fillPath (Image& image, const Path& path, const AffineTransform& transform) | |||
| { | |||
| if (clip != 0) | |||
| fillShape (image, new ClipRegion_EdgeTable (clip->getClipBounds(), path, transform.translated ((float) xOffset, (float) yOffset)), false); | |||
| fillShape (image, new SoftwareRendererClasses::ClipRegion_EdgeTable (clip->getClipBounds(), path, transform.translated ((float) xOffset, (float) yOffset)), false); | |||
| } | |||
| void fillEdgeTable (Image& image, const EdgeTable& edgeTable, const float x, const int y) | |||
| { | |||
| if (clip != 0) | |||
| { | |||
| ClipRegion_EdgeTable* edgeTableClip = new ClipRegion_EdgeTable (edgeTable); | |||
| ClipRegionBase::Ptr shapeToFill (edgeTableClip); | |||
| SoftwareRendererClasses::ClipRegion_EdgeTable* edgeTableClip = new SoftwareRendererClasses::ClipRegion_EdgeTable (edgeTable); | |||
| SoftwareRendererClasses::ClipRegionBase::Ptr shapeToFill (edgeTableClip); | |||
| edgeTableClip->edgeTable.translate (x + xOffset, y + yOffset); | |||
| fillShape (image, shapeToFill, false); | |||
| } | |||
| } | |||
| void fillShape (Image& image, ClipRegionBase::Ptr shapeToFill, const bool replaceContents) | |||
| void fillShape (Image& image, SoftwareRendererClasses::ClipRegionBase::Ptr shapeToFill, const bool replaceContents) | |||
| { | |||
| jassert (clip != 0); | |||
| shapeToFill = shapeToFill->clipTo (clip); | |||
| shapeToFill = clip->applyClipTo (shapeToFill); | |||
| if (shapeToFill != 0) | |||
| fillShapeWithoutClipping (image, shapeToFill, replaceContents); | |||
| } | |||
| void fillShapeWithoutClipping (Image& image, const ClipRegionBase::Ptr& shapeToFill, const bool replaceContents) | |||
| void fillShapeWithoutClipping (Image& image, const SoftwareRendererClasses::ClipRegionBase::Ptr& shapeToFill, const bool replaceContents) | |||
| { | |||
| Image::BitmapData destData (image, 0, 0, image.getWidth(), image.getHeight(), true); | |||
| @@ -1855,7 +1855,7 @@ public: | |||
| //============================================================================== | |||
| void renderImage (Image& destImage, const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& t, const ClipRegionBase* const tiledFillClipRegion) | |||
| const AffineTransform& t, const SoftwareRendererClasses::ClipRegionBase* const tiledFillClipRegion) | |||
| { | |||
| const AffineTransform transform (t.translated ((float) xOffset, (float) yOffset)); | |||
| @@ -1877,15 +1877,15 @@ public: | |||
| if (tiledFillClipRegion != 0) | |||
| { | |||
| tiledFillClipRegion->renderImageUntransformed (destData, srcData, srcClip, alpha, tx, ty, true); | |||
| tiledFillClipRegion->renderImageUntransformed (destData, srcData, alpha, tx, ty, true); | |||
| } | |||
| else | |||
| { | |||
| ClipRegionBase::Ptr c (new ClipRegion_EdgeTable (Rectangle<int> (tx, ty, srcClip.getWidth(), srcClip.getHeight()).getIntersection (destImage.getBounds()))); | |||
| c = c->clipTo (clip); | |||
| SoftwareRendererClasses::ClipRegionBase::Ptr c (new SoftwareRendererClasses::ClipRegion_EdgeTable (Rectangle<int> (tx, ty, srcClip.getWidth(), srcClip.getHeight()).getIntersection (destImage.getBounds()))); | |||
| c = clip->applyClipTo (c); | |||
| if (c != 0) | |||
| c->renderImageUntransformed (destData, srcData, srcClip, alpha, tx, ty, false); | |||
| c->renderImageUntransformed (destData, srcData, alpha, tx, ty, false); | |||
| } | |||
| return; | |||
| @@ -1897,23 +1897,23 @@ public: | |||
| if (tiledFillClipRegion != 0) | |||
| { | |||
| tiledFillClipRegion->renderImageTransformed (destData, srcData, srcClip, alpha, transform, betterQuality, true); | |||
| tiledFillClipRegion->renderImageTransformed (destData, srcData, alpha, transform, betterQuality, true); | |||
| } | |||
| else | |||
| { | |||
| Path p; | |||
| p.addRectangle (0.0f, 0.0f, (float) srcClip.getWidth(), (float) srcClip.getHeight()); | |||
| ClipRegionBase::Ptr c (clip->clone()); | |||
| SoftwareRendererClasses::ClipRegionBase::Ptr c (clip->clone()); | |||
| c = c->clipToPath (p, transform); | |||
| if (c != 0) | |||
| c->renderImageTransformed (destData, srcData, srcClip, alpha, transform, betterQuality, true); | |||
| c->renderImageTransformed (destData, srcData, alpha, transform, betterQuality, true); | |||
| } | |||
| } | |||
| //============================================================================== | |||
| ClipRegionBase::Ptr clip; | |||
| SoftwareRendererClasses::ClipRegionBase::Ptr clip; | |||
| int xOffset, yOffset; | |||
| Font font; | |||
| FillType fillType; | |||
| @@ -1926,7 +1926,7 @@ private: | |||
| clip = clip->clone(); | |||
| } | |||
| LLGCSavedState& operator= (const LLGCSavedState&); | |||
| SavedState& operator= (const SavedState&); | |||
| }; | |||
| @@ -1934,14 +1934,14 @@ private: | |||
| LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (Image& image_) | |||
| : image (image_) | |||
| { | |||
| currentState = new LLGCSavedState (image_.getBounds(), 0, 0); | |||
| currentState = new SavedState (image_.getBounds(), 0, 0); | |||
| } | |||
| LowLevelGraphicsSoftwareRenderer::LowLevelGraphicsSoftwareRenderer (Image& image_, const int xOffset, const int yOffset, | |||
| const RectangleList& initialClip) | |||
| : image (image_) | |||
| { | |||
| currentState = new LLGCSavedState (initialClip, xOffset, yOffset); | |||
| currentState = new SavedState (initialClip, xOffset, yOffset); | |||
| } | |||
| LowLevelGraphicsSoftwareRenderer::~LowLevelGraphicsSoftwareRenderer() | |||
| @@ -2002,12 +2002,12 @@ bool LowLevelGraphicsSoftwareRenderer::isClipEmpty() const | |||
| //============================================================================== | |||
| void LowLevelGraphicsSoftwareRenderer::saveState() | |||
| { | |||
| stateStack.add (new LLGCSavedState (*currentState)); | |||
| stateStack.add (new SavedState (*currentState)); | |||
| } | |||
| void LowLevelGraphicsSoftwareRenderer::restoreState() | |||
| { | |||
| LLGCSavedState* const top = stateStack.getLast(); | |||
| SavedState* const top = stateStack.getLast(); | |||
| if (top != 0) | |||
| { | |||
| @@ -2056,28 +2056,73 @@ void LowLevelGraphicsSoftwareRenderer::drawImage (const Image& sourceImage, cons | |||
| fillEntireClipAsTiles ? currentState->clip : 0); | |||
| } | |||
| //============================================================================== | |||
| void LowLevelGraphicsSoftwareRenderer::drawLine (double x1, double y1, double x2, double y2) | |||
| void LowLevelGraphicsSoftwareRenderer::drawLine (const Line <float>& line) | |||
| { | |||
| Path p; | |||
| p.addLineSegment ((float) x1, (float) y1, (float) x2, (float) y2, 1.0f); | |||
| p.addLineSegment (line.getStartX(), line.getStartY(), line.getEndX(), line.getEndY(), 1.0f); | |||
| fillPath (p, AffineTransform::identity); | |||
| } | |||
| void LowLevelGraphicsSoftwareRenderer::drawVerticalLine (const int x, double top, double bottom) | |||
| void LowLevelGraphicsSoftwareRenderer::drawVerticalLine (const int x, float top, float bottom) | |||
| { | |||
| if (bottom > top) | |||
| currentState->fillRect (image, Rectangle<float> ((float) x, (float) top, 1.0f, (float) (bottom - top))); | |||
| currentState->fillRect (image, Rectangle<float> ((float) x, top, 1.0f, bottom - top)); | |||
| } | |||
| void LowLevelGraphicsSoftwareRenderer::drawHorizontalLine (const int y, double left, double right) | |||
| void LowLevelGraphicsSoftwareRenderer::drawHorizontalLine (const int y, float left, float right) | |||
| { | |||
| if (right > left) | |||
| currentState->fillRect (image, Rectangle<float> ((float) left, (float) y, (float) (right - left), 1.0f)); | |||
| currentState->fillRect (image, Rectangle<float> (left, (float) y, right - left, 1.0f)); | |||
| } | |||
| //============================================================================== | |||
| class GlyphCache : private DeletedAtShutdown | |||
| class LowLevelGraphicsSoftwareRenderer::CachedGlyph | |||
| { | |||
| public: | |||
| CachedGlyph() : glyph (0), lastAccessCount (0) {} | |||
| ~CachedGlyph() {} | |||
| void draw (SavedState& state, Image& image, const float x, const float y) const | |||
| { | |||
| if (edgeTable != 0) | |||
| state.fillEdgeTable (image, *edgeTable, x, roundToInt (y)); | |||
| } | |||
| void generate (const Font& newFont, const int glyphNumber) | |||
| { | |||
| font = newFont; | |||
| glyph = glyphNumber; | |||
| edgeTable = 0; | |||
| Path glyphPath; | |||
| font.getTypeface()->getOutlineForGlyph (glyphNumber, glyphPath); | |||
| if (! glyphPath.isEmpty()) | |||
| { | |||
| const float fontHeight = font.getHeight(); | |||
| const AffineTransform transform (AffineTransform::scale (fontHeight * font.getHorizontalScale(), fontHeight) | |||
| .translated (0.0f, -0.5f)); | |||
| edgeTable = new EdgeTable (glyphPath.getBoundsTransformed (transform).getSmallestIntegerContainer().expanded (1, 0), | |||
| glyphPath, transform); | |||
| } | |||
| } | |||
| int glyph, lastAccessCount; | |||
| Font font; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| ScopedPointer <EdgeTable> edgeTable; | |||
| CachedGlyph (const CachedGlyph&); | |||
| CachedGlyph& operator= (const CachedGlyph&); | |||
| }; | |||
| //============================================================================== | |||
| class LowLevelGraphicsSoftwareRenderer::GlyphCache : private DeletedAtShutdown | |||
| { | |||
| public: | |||
| GlyphCache() | |||
| @@ -2095,7 +2140,7 @@ public: | |||
| juce_DeclareSingleton_SingleThreaded_Minimal (GlyphCache); | |||
| //============================================================================== | |||
| void drawGlyph (LLGCSavedState& state, Image& image, const Font& font, const int glyphNumber, float x, float y) | |||
| void drawGlyph (SavedState& state, Image& image, const Font& font, const int glyphNumber, float x, float y) | |||
| { | |||
| ++accessCounter; | |||
| int oldestCounter = std::numeric_limits<int>::max(); | |||
| @@ -2138,56 +2183,11 @@ public: | |||
| oldest->draw (state, image, x, y); | |||
| } | |||
| //============================================================================== | |||
| class CachedGlyph | |||
| { | |||
| public: | |||
| CachedGlyph() : glyph (0), lastAccessCount (0) {} | |||
| ~CachedGlyph() {} | |||
| void draw (LLGCSavedState& state, Image& image, const float x, const float y) const | |||
| { | |||
| if (edgeTable != 0) | |||
| state.fillEdgeTable (image, *edgeTable, x, roundToInt (y)); | |||
| } | |||
| void generate (const Font& newFont, const int glyphNumber) | |||
| { | |||
| font = newFont; | |||
| glyph = glyphNumber; | |||
| edgeTable = 0; | |||
| Path glyphPath; | |||
| font.getTypeface()->getOutlineForGlyph (glyphNumber, glyphPath); | |||
| if (! glyphPath.isEmpty()) | |||
| { | |||
| const float fontHeight = font.getHeight(); | |||
| const AffineTransform transform (AffineTransform::scale (fontHeight * font.getHorizontalScale(), fontHeight) | |||
| .translated (0.0f, -0.5f)); | |||
| edgeTable = new EdgeTable (glyphPath.getBoundsTransformed (transform).getSmallestIntegerContainer().expanded (1, 0), | |||
| glyphPath, transform); | |||
| } | |||
| } | |||
| int glyph, lastAccessCount; | |||
| Font font; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| ScopedPointer <EdgeTable> edgeTable; | |||
| CachedGlyph (const CachedGlyph&); | |||
| CachedGlyph& operator= (const CachedGlyph&); | |||
| }; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| friend class OwnedArray <CachedGlyph>; | |||
| OwnedArray <CachedGlyph> glyphs; | |||
| int accessCounter, hits, misses; | |||
| @@ -2195,7 +2195,7 @@ private: | |||
| GlyphCache& operator= (const GlyphCache&); | |||
| }; | |||
| juce_ImplementSingleton_SingleThreaded (GlyphCache); | |||
| juce_ImplementSingleton_SingleThreaded (LowLevelGraphicsSoftwareRenderer::GlyphCache); | |||
| void LowLevelGraphicsSoftwareRenderer::setFont (const Font& newFont) | |||
| @@ -27,7 +27,7 @@ | |||
| #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__ | |||
| #include "juce_LowLevelGraphicsContext.h" | |||
| class LLGCSavedState; | |||
| //============================================================================== | |||
| /** | |||
| @@ -75,10 +75,10 @@ public: | |||
| void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip, | |||
| const AffineTransform& transform, bool fillEntireClipAsTiles); | |||
| void drawLine (double x1, double y1, double x2, double y2); | |||
| void drawLine (const Line <float>& line); | |||
| void drawVerticalLine (int x, double top, double bottom); | |||
| void drawHorizontalLine (int x, double top, double bottom); | |||
| void drawVerticalLine (int x, float top, float bottom); | |||
| void drawHorizontalLine (int x, float top, float bottom); | |||
| //============================================================================== | |||
| void setFont (const Font& newFont); | |||
| @@ -93,8 +93,14 @@ protected: | |||
| //============================================================================== | |||
| Image& image; | |||
| ScopedPointer <LLGCSavedState> currentState; | |||
| OwnedArray <LLGCSavedState> stateStack; | |||
| class GlyphCache; | |||
| class CachedGlyph; | |||
| class SavedState; | |||
| friend class ScopedPointer <SavedState>; | |||
| friend class OwnedArray <SavedState>; | |||
| friend class OwnedArray <CachedGlyph>; | |||
| ScopedPointer <SavedState> currentState; | |||
| OwnedArray <SavedState> stateStack; | |||
| LowLevelGraphicsSoftwareRenderer (const LowLevelGraphicsSoftwareRenderer& other); | |||
| LowLevelGraphicsSoftwareRenderer& operator= (const LowLevelGraphicsSoftwareRenderer&); | |||
| @@ -31,11 +31,10 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../imaging/juce_Image.h" | |||
| #include "../colour/juce_PixelFormats.h" | |||
| #if JUCE_MSVC | |||
| #pragma optimize ("t", on) // try to avoid slowing everything down in debug builds | |||
| #if JUCE_MSVC && JUCE_DEBUG | |||
| #pragma optimize ("t", on) | |||
| #endif | |||
| //============================================================================== | |||
| DropShadowEffect::DropShadowEffect() | |||
| : offsetX (0), | |||
| @@ -109,4 +108,8 @@ void DropShadowEffect::applyEffect (Image& image, Graphics& g) | |||
| g.drawImageAt (&image, 0, 0); | |||
| } | |||
| #if JUCE_MSVC && JUCE_DEBUG | |||
| #pragma optimize ("", on) // resets optimisations to the project defaults | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| @@ -170,9 +170,6 @@ public: | |||
| */ | |||
| float getTranslationY() const throw() { return mat12; } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| //============================================================================== | |||
| /* The transform matrix is: | |||
| @@ -183,6 +180,10 @@ public: | |||
| float mat00, mat01, mat02; | |||
| float mat10, mat11, mat12; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| //============================================================================== | |||
| const AffineTransform followedBy (float mat00, float mat01, float mat02, | |||
| @@ -30,7 +30,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_PathIterator.h" | |||
| #if JUCE_MSVC | |||
| #if JUCE_MSVC && JUCE_DEBUG | |||
| #pragma optimize ("t", on) | |||
| #endif | |||
| @@ -288,4 +288,8 @@ bool PathFlatteningIterator::next() | |||
| } | |||
| } | |||
| #if JUCE_MSVC && JUCE_DEBUG | |||
| #pragma optimize ("", on) // resets optimisations to the project defaults | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| @@ -71,14 +71,10 @@ public: | |||
| */ | |||
| bool next(); | |||
| /** The x position of the start of the current line segment. */ | |||
| float x1; | |||
| /** The y position of the start of the current line segment. */ | |||
| float y1; | |||
| /** The x position of the end of the current line segment. */ | |||
| float x2; | |||
| /** The y position of the end of the current line segment. */ | |||
| float y2; | |||
| float x1; /**< The x position of the start of the current line segment. */ | |||
| float y1; /**< The y position of the start of the current line segment. */ | |||
| float x2; /**< The x position of the end of the current line segment. */ | |||
| float y2; /**< The y position of the end of the current line segment. */ | |||
| /** Indicates whether the current line segment is closing a sub-path. | |||
| @@ -95,10 +91,8 @@ public: | |||
| int subPathIndex; | |||
| /** Returns true if the current segment is the last in the current sub-path. */ | |||
| bool isLastInSubpath() const { return stackPos == stackBase.getData() | |||
| && (index >= path.numElements | |||
| || points [index] == Path::moveMarker); } | |||
| bool isLastInSubpath() const throw() { return stackPos == stackBase.getData() | |||
| && (index >= path.numElements || points [index] == Path::moveMarker); } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -25,7 +25,7 @@ | |||
| #include "../../../../core/juce_StandardHeader.h" | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4390 4611) | |||
| #endif | |||
| @@ -93,7 +93,7 @@ namespace pnglibNamespace | |||
| #undef max | |||
| #undef min | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -28,7 +28,8 @@ | |||
| #if JUCE_WINDOWS | |||
| #include <winsock2.h> | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable : 4127 4389 4018) | |||
| #endif | |||
| @@ -631,5 +632,8 @@ bool DatagramSocket::isLocal() const throw() | |||
| return hostName == "127.0.0.1"; | |||
| } | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| @@ -84,7 +84,6 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../audio/devices/juce_MidiOutput.h" | |||
| #include "../audio/devices/juce_MidiInput.h" | |||
| //============================================================================== | |||
| #define JUCE_INCLUDED_FILE 1 | |||
| @@ -449,7 +449,7 @@ public: | |||
| } | |||
| //============================================================================== | |||
| void drawLine (double x1, double y1, double x2, double y2) | |||
| void drawLine (const Line<float>& line) | |||
| { | |||
| CGContextSetLineCap (context, kCGLineCapSquare); | |||
| CGContextSetLineWidth (context, 1.0f); | |||
| @@ -457,31 +457,31 @@ public: | |||
| state->fillType.colour.getFloatRed(), state->fillType.colour.getFloatGreen(), | |||
| state->fillType.colour.getFloatBlue(), state->fillType.colour.getFloatAlpha()); | |||
| CGPoint line[] = { { (CGFloat) x1, flipHeight - (CGFloat) y1 }, | |||
| { (CGFloat) x2, flipHeight - (CGFloat) y2 } }; | |||
| CGPoint cgLine[] = { { (CGFloat) line.getStartX(), flipHeight - (CGFloat) line.getStartY() }, | |||
| { (CGFloat) line.getEndX(), flipHeight - (CGFloat) line.getEndY() } }; | |||
| CGContextStrokeLineSegments (context, line, 1); | |||
| CGContextStrokeLineSegments (context, cgLine, 1); | |||
| } | |||
| void drawVerticalLine (const int x, double top, double bottom) | |||
| void drawVerticalLine (const int x, float top, float bottom) | |||
| { | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 | |||
| CGContextFillRect (context, CGRectMake (x, flipHeight - (float) bottom, 1.0f, (float) (bottom - top))); | |||
| CGContextFillRect (context, CGRectMake (x, flipHeight - bottom, 1.0f, bottom - top)); | |||
| #else | |||
| // On Leopard, unless both co-ordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x co-ord slightly to trick it.. | |||
| CGContextFillRect (context, CGRectMake (x + 1.0f / 256.0f, flipHeight - (float) bottom, 1.0f + 1.0f / 256.0f, (float) (bottom - top))); | |||
| CGContextFillRect (context, CGRectMake (x + 1.0f / 256.0f, flipHeight - bottom, 1.0f + 1.0f / 256.0f, bottom - top)); | |||
| #endif | |||
| } | |||
| void drawHorizontalLine (const int y, double left, double right) | |||
| void drawHorizontalLine (const int y, float left, float right) | |||
| { | |||
| #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5 | |||
| CGContextFillRect (context, CGRectMake ((float) left, flipHeight - (y + 1.0f), (float) (right - left), 1.0f)); | |||
| CGContextFillRect (context, CGRectMake (left, flipHeight - (y + 1.0f), right - left, 1.0f)); | |||
| #else | |||
| // On Leopard, unless both co-ordinates are non-integer, it disables anti-aliasing, so nudge | |||
| // the x co-ord slightly to trick it.. | |||
| CGContextFillRect (context, CGRectMake ((float) left, flipHeight - (y + (1.0f + 1.0f / 256.0f)), (float) (right - left), 1.0f + 1.0f / 256.0f)); | |||
| CGContextFillRect (context, CGRectMake (left, flipHeight - (y + (1.0f + 1.0f / 256.0f)), right - left, 1.0f + 1.0f / 256.0f)); | |||
| #endif | |||
| } | |||
| @@ -646,23 +646,12 @@ private: | |||
| { | |||
| switch (i.elementType) | |||
| { | |||
| case Path::Iterator::startNewSubPath: | |||
| CGContextMoveToPoint (context, i.x1, i.y1); | |||
| break; | |||
| case Path::Iterator::lineTo: | |||
| CGContextAddLineToPoint (context, i.x1, i.y1); | |||
| break; | |||
| case Path::Iterator::quadraticTo: | |||
| CGContextAddQuadCurveToPoint (context, i.x1, i.y1, i.x2, i.y2); | |||
| break; | |||
| case Path::Iterator::cubicTo: | |||
| CGContextAddCurveToPoint (context, i.x1, i.y1, i.x2, i.y2, i.x3, i.y3); | |||
| break; | |||
| case Path::Iterator::closePath: | |||
| CGContextClosePath (context); break; | |||
| default: | |||
| jassertfalse | |||
| break; | |||
| case Path::Iterator::startNewSubPath: CGContextMoveToPoint (context, i.x1, i.y1); break; | |||
| case Path::Iterator::lineTo: CGContextAddLineToPoint (context, i.x1, i.y1); break; | |||
| case Path::Iterator::quadraticTo: CGContextAddQuadCurveToPoint (context, i.x1, i.y1, i.x2, i.y2); break; | |||
| case Path::Iterator::cubicTo: CGContextAddCurveToPoint (context, i.x1, i.y1, i.x2, i.y2, i.x3, i.y3); break; | |||
| case Path::Iterator::closePath: CGContextClosePath (context); break; | |||
| default: jassertfalse; break; | |||
| } | |||
| } | |||
| } | |||
| @@ -38,7 +38,7 @@ | |||
| #undef WIN32_LEAN_AND_MEAN | |||
| #define WIN32_LEAN_AND_MEAN 1 | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable : 4100 4201 4514 4312 4995) | |||
| #endif | |||
| @@ -179,7 +179,7 @@ | |||
| #endif | |||
| //============================================================================== | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -940,7 +940,6 @@ private: | |||
| if (hasTitleBar()) | |||
| { | |||
| type |= WS_OVERLAPPED; | |||
| exstyle |= WS_EX_APPWINDOW; | |||
| if ((styleFlags & windowHasCloseButton) != 0) | |||
| { | |||
| @@ -958,13 +957,13 @@ private: | |||
| else | |||
| { | |||
| type |= WS_POPUP | WS_SYSMENU; | |||
| if ((styleFlags & windowAppearsOnTaskbar) == 0) | |||
| exstyle |= WS_EX_TOOLWINDOW; | |||
| else | |||
| exstyle |= WS_EX_APPWINDOW; | |||
| } | |||
| if ((styleFlags & windowAppearsOnTaskbar) == 0) | |||
| exstyle |= WS_EX_TOOLWINDOW; | |||
| else | |||
| exstyle |= WS_EX_APPWINDOW; | |||
| if ((styleFlags & windowHasMinimiseButton) != 0) | |||
| type |= WS_MINIMIZEBOX; | |||
| @@ -23,20 +23,17 @@ | |||
| ============================================================================== | |||
| */ | |||
| #ifdef _MSC_VER | |||
| #pragma warning (disable: 4514 4996) | |||
| #include "../core/juce_StandardHeader.h" | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514 4996) | |||
| #endif | |||
| #include "../core/juce_StandardHeader.h" | |||
| #include <cwctype> | |||
| #include <cctype> | |||
| #include <ctime> | |||
| #ifdef _MSC_VER | |||
| #pragma warning (pop) | |||
| #endif | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_CharacterFunctions.h" | |||
| @@ -794,5 +791,8 @@ int CharacterFunctions::getHexDigitValue (const juce_wchar digit) throw() | |||
| return -1; | |||
| } | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| @@ -23,25 +23,22 @@ | |||
| ============================================================================== | |||
| */ | |||
| #ifdef _MSC_VER | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514) | |||
| #endif | |||
| #include <locale> | |||
| #include "../core/juce_StandardHeader.h" | |||
| #if JUCE_MSVC | |||
| #include <float.h> | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514) | |||
| #endif | |||
| #include <locale> | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_String.h" | |||
| #include "../core/juce_Atomic.h" | |||
| #include "../io/streams/juce_OutputStream.h" | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -1689,12 +1686,12 @@ const String String::formatted (const juce_wchar* const pf, ... ) | |||
| const int num = (int) vswprintf (result.text, bufferSize - 1, pf, tempArgs); | |||
| va_end (tempArgs); | |||
| #elif JUCE_WINDOWS | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4996) | |||
| #endif | |||
| const int num = (int) _vsnwprintf (result.text, bufferSize - 1, pf, args); | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| #else | |||
| @@ -2133,9 +2130,9 @@ const char* String::toCString() const | |||
| } | |||
| } | |||
| #ifdef _MSC_VER | |||
| #pragma warning (disable: 4514 4996) | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4514 4996) | |||
| #endif | |||
| int String::getNumBytesAsCString() const throw() | |||
| @@ -2153,7 +2150,7 @@ int String::copyToCString (char* destBuffer, const int maxBufferSizeBytes) const | |||
| return numBytes; | |||
| } | |||
| #ifdef _MSC_VER | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||