mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Changed some pass-by-references to pass-by-value to improve compiler optimisation.
This commit is contained in:
parent
51df5143bf
commit
c7506df13f
140 changed files with 757 additions and 756 deletions
|
|
@ -32,7 +32,7 @@ namespace ColourHelpers
|
|||
|
||||
// This is an adjusted brightness value, based on the way the human
|
||||
// eye responds to different colour channels..
|
||||
static float getPerceivedBrightness (const Colour& c) noexcept
|
||||
static float getPerceivedBrightness (Colour c) noexcept
|
||||
{
|
||||
const float r = c.getFloatRed();
|
||||
const float g = c.getFloatGreen();
|
||||
|
|
@ -46,7 +46,7 @@ namespace ColourHelpers
|
|||
//==============================================================================
|
||||
struct HSB
|
||||
{
|
||||
HSB (const Colour& col) noexcept
|
||||
HSB (Colour col) noexcept
|
||||
{
|
||||
const int r = col.getRed();
|
||||
const int g = col.getGreen();
|
||||
|
|
@ -92,7 +92,7 @@ namespace ColourHelpers
|
|||
brightness = hi / 255.0f;
|
||||
}
|
||||
|
||||
Colour toColour (const Colour& original) const noexcept
|
||||
Colour toColour (Colour original) const noexcept
|
||||
{
|
||||
return Colour (hue, saturation, brightness, original.getAlpha());
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ namespace ColourHelpers
|
|||
//==============================================================================
|
||||
struct YIQ
|
||||
{
|
||||
YIQ (const Colour& c) noexcept
|
||||
YIQ (Colour c) noexcept
|
||||
{
|
||||
const float r = c.getFloatRed();
|
||||
const float g = c.getFloatGreen();
|
||||
|
|
@ -275,7 +275,7 @@ Colour Colour::withMultipliedAlpha (const float alphaMultiplier) const noexcept
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
Colour Colour::overlaidWith (const Colour& src) const noexcept
|
||||
Colour Colour::overlaidWith (Colour src) const noexcept
|
||||
{
|
||||
const int destAlpha = getAlpha();
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ Colour Colour::overlaidWith (const Colour& src) const noexcept
|
|||
(uint8) resA);
|
||||
}
|
||||
|
||||
Colour Colour::interpolatedWith (const Colour& other, float proportionOfOther) const noexcept
|
||||
Colour Colour::interpolatedWith (Colour other, float proportionOfOther) const noexcept
|
||||
{
|
||||
if (proportionOfOther <= 0)
|
||||
return *this;
|
||||
|
|
@ -393,7 +393,7 @@ Colour Colour::contrasting (const float amount) const noexcept
|
|||
: Colours::white).withAlpha (amount));
|
||||
}
|
||||
|
||||
Colour Colour::contrasting (const Colour& target, float minContrast) const noexcept
|
||||
Colour Colour::contrasting (Colour target, float minContrast) const noexcept
|
||||
{
|
||||
const ColourHelpers::YIQ bg (*this);
|
||||
ColourHelpers::YIQ fg (target);
|
||||
|
|
@ -408,8 +408,8 @@ Colour Colour::contrasting (const Colour& target, float minContrast) const noexc
|
|||
return fg.toColour();
|
||||
}
|
||||
|
||||
Colour Colour::contrasting (const Colour& colour1,
|
||||
const Colour& colour2) noexcept
|
||||
Colour Colour::contrasting (Colour colour1,
|
||||
Colour colour2) noexcept
|
||||
{
|
||||
const float b1 = ColourHelpers::getPerceivedBrightness (colour1);
|
||||
const float b2 = ColourHelpers::getPerceivedBrightness (colour2);
|
||||
|
|
|
|||
|
|
@ -231,14 +231,14 @@ public:
|
|||
If the foreground colour is semi-transparent, it is blended onto this colour
|
||||
accordingly.
|
||||
*/
|
||||
Colour overlaidWith (const Colour& foregroundColour) const noexcept;
|
||||
Colour overlaidWith (Colour foregroundColour) const noexcept;
|
||||
|
||||
/** Returns a colour that lies somewhere between this one and another.
|
||||
|
||||
If amountOfOther is zero, the result is 100% this colour, if amountOfOther
|
||||
is 1.0, the result is 100% of the other colour.
|
||||
*/
|
||||
Colour interpolatedWith (const Colour& other, float proportionOfOther) const noexcept;
|
||||
Colour interpolatedWith (Colour other, float proportionOfOther) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the colour's hue component.
|
||||
|
|
@ -331,14 +331,14 @@ public:
|
|||
nudged up or down so that it differs from the luminosity of this colour
|
||||
by at least the amount specified by minLuminosityDiff.
|
||||
*/
|
||||
Colour contrasting (const Colour& targetColour, float minLuminosityDiff) const noexcept;
|
||||
Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept;
|
||||
|
||||
/** Returns a colour that contrasts against two colours.
|
||||
Looks for a colour that contrasts with both of the colours passed-in.
|
||||
Handy for things like choosing a highlight colour in text editors, etc.
|
||||
*/
|
||||
static Colour contrasting (const Colour& colour1,
|
||||
const Colour& colour2) noexcept;
|
||||
static Colour contrasting (Colour colour1,
|
||||
Colour colour2) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns an opaque shade of grey.
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ ColourGradient::ColourGradient() noexcept
|
|||
#endif
|
||||
}
|
||||
|
||||
ColourGradient::ColourGradient (const Colour& colour1, const float x1_, const float y1_,
|
||||
const Colour& colour2, const float x2_, const float y2_,
|
||||
ColourGradient::ColourGradient (Colour colour1, const float x1_, const float y1_,
|
||||
Colour colour2, const float x2_, const float y2_,
|
||||
const bool isRadial_)
|
||||
: point1 (x1_, y1_),
|
||||
point2 (x2_, y2_),
|
||||
|
|
@ -66,7 +66,7 @@ void ColourGradient::clearColours()
|
|||
colours.clear();
|
||||
}
|
||||
|
||||
int ColourGradient::addColour (const double proportionAlongGradient, const Colour& colour)
|
||||
int ColourGradient::addColour (const double proportionAlongGradient, Colour colour)
|
||||
{
|
||||
// must be within the two end-points
|
||||
jassert (proportionAlongGradient >= 0 && proportionAlongGradient <= 1.0);
|
||||
|
|
@ -119,7 +119,7 @@ Colour ColourGradient::getColour (const int index) const noexcept
|
|||
return Colour();
|
||||
}
|
||||
|
||||
void ColourGradient::setColour (int index, const Colour& newColour) noexcept
|
||||
void ColourGradient::setColour (int index, Colour newColour) noexcept
|
||||
{
|
||||
if (isPositiveAndBelow (index, colours.size()))
|
||||
colours.getReference (index).colour = newColour;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public:
|
|||
|
||||
@see ColourGradient
|
||||
*/
|
||||
ColourGradient (const Colour& colour1, float x1, float y1,
|
||||
const Colour& colour2, float x2, float y2,
|
||||
ColourGradient (Colour colour1, float x1, float y1,
|
||||
Colour colour2, float x2, float y2,
|
||||
bool isRadial);
|
||||
|
||||
/** Creates an uninitialised gradient.
|
||||
|
|
@ -91,7 +91,7 @@ public:
|
|||
@returns the index at which the new point was added
|
||||
*/
|
||||
int addColour (double proportionAlongGradient,
|
||||
const Colour& colour);
|
||||
Colour colour);
|
||||
|
||||
/** Removes one of the colours from the gradient. */
|
||||
void removeColour (int index);
|
||||
|
|
@ -117,7 +117,7 @@ public:
|
|||
/** Changes the colour at a given index.
|
||||
The index is from 0 to getNumColours() - 1.
|
||||
*/
|
||||
void setColour (int index, const Colour& newColour) noexcept;
|
||||
void setColour (int index, Colour newColour) noexcept;
|
||||
|
||||
/** Returns the an interpolated colour at any position along the gradient.
|
||||
@param position the position along the gradient, between 0 and 1
|
||||
|
|
@ -165,7 +165,7 @@ private:
|
|||
{
|
||||
ColourPoint() noexcept {}
|
||||
|
||||
ColourPoint (const double pos, const Colour& col) noexcept
|
||||
ColourPoint (const double pos, Colour col) noexcept
|
||||
: position (pos), colour (col)
|
||||
{}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ const Colour Colours::yellowgreen (0xff9acd32);
|
|||
|
||||
//==============================================================================
|
||||
Colour Colours::findColourForName (const String& colourName,
|
||||
const Colour& defaultColour)
|
||||
Colour defaultColour)
|
||||
{
|
||||
static const uint32 presets[] =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public:
|
|||
colour passed in as the defaultColour parameter is returned.
|
||||
*/
|
||||
static JUCE_API Colour findColourForName (const String& colourName,
|
||||
const Colour& defaultColour);
|
||||
Colour defaultColour);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ FillType::FillType() noexcept
|
|||
{
|
||||
}
|
||||
|
||||
FillType::FillType (const Colour& colour_) noexcept
|
||||
: colour (colour_)
|
||||
FillType::FillType (Colour c) noexcept
|
||||
: colour (c)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ bool FillType::operator!= (const FillType& other) const
|
|||
return ! operator== (other);
|
||||
}
|
||||
|
||||
void FillType::setColour (const Colour& newColour) noexcept
|
||||
void FillType::setColour (Colour newColour) noexcept
|
||||
{
|
||||
gradient = nullptr;
|
||||
image = Image::null;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public:
|
|||
/** Creates a fill type of a solid colour.
|
||||
@see setColour
|
||||
*/
|
||||
FillType (const Colour& colour) noexcept;
|
||||
FillType (Colour colour) noexcept;
|
||||
|
||||
/** Creates a gradient fill type.
|
||||
@see setGradient
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
/** Turns this object into a solid colour fill.
|
||||
If the object was an image or gradient, those fields will no longer be valid. */
|
||||
void setColour (const Colour& newColour) noexcept;
|
||||
void setColour (Colour newColour) noexcept;
|
||||
|
||||
/** Turns this object into a gradient fill. */
|
||||
void setGradient (const ColourGradient& newGradient);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public:
|
|||
This takes into account the opacity of the pixel being overlaid, and blends
|
||||
it accordingly.
|
||||
*/
|
||||
forcedinline void blend (const PixelRGB& src) noexcept;
|
||||
forcedinline void blend (const PixelRGB src) noexcept;
|
||||
|
||||
|
||||
/** Blends another pixel onto this one, applying an extra multiplier to its opacity.
|
||||
|
|
@ -358,7 +358,7 @@ public:
|
|||
b = (uint8) sargb;
|
||||
}
|
||||
|
||||
forcedinline void blend (const PixelRGB& src) noexcept
|
||||
forcedinline void blend (const PixelRGB src) noexcept
|
||||
{
|
||||
set (src);
|
||||
}
|
||||
|
|
@ -467,7 +467,7 @@ private:
|
|||
#endif
|
||||
;
|
||||
|
||||
forcedinline void PixelARGB::blend (const PixelRGB& src) noexcept
|
||||
forcedinline void PixelARGB::blend (const PixelRGB src) noexcept
|
||||
{
|
||||
set (src);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue