diff --git a/examples/Audio/AudioAppDemo.h b/examples/Audio/AudioAppDemo.h index b7e3595ab7..17dfcb2206 100644 --- a/examples/Audio/AudioAppDemo.h +++ b/examples/Audio/AudioAppDemo.h @@ -114,7 +114,7 @@ public: // (Our component is opaque, so we must completely fill the background with a solid colour) g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); - auto centreY = getHeight() / 2.0f; + auto centreY = (float) getHeight() / 2.0f; auto radius = amplitude * 200.0f; if (radius >= 0.0f) @@ -131,8 +131,8 @@ public: Path wavePath; wavePath.startNewSubPath (0, centreY); - for (auto x = 1.0f; x < getWidth(); ++x) - wavePath.lineTo (x, centreY + amplitude * getHeight() * 2.0f + for (auto x = 1.0f; x < (float) getWidth(); ++x) + wavePath.lineTo (x, centreY + amplitude * (float) getHeight() * 2.0f * std::sin (x * frequency * 0.0001f)); g.setColour (getLookAndFeel().findColour (Slider::thumbColourId)); @@ -149,8 +149,8 @@ public: { lastMousePosition = e.position; - frequency = (getHeight() - e.y) * 10.0f; - amplitude = jmin (0.9f, 0.2f * e.position.x / getWidth()); + frequency = (float) (getHeight() - e.y) * 10.0f; + amplitude = jmin (0.9f, 0.2f * e.position.x / (float) getWidth()); phaseDelta = (float) (MathConstants::twoPi * frequency / sampleRate); diff --git a/examples/Audio/AudioPlaybackDemo.h b/examples/Audio/AudioPlaybackDemo.h index 46f27b2e88..8837cea53e 100644 --- a/examples/Audio/AudioPlaybackDemo.h +++ b/examples/Audio/AudioPlaybackDemo.h @@ -116,7 +116,7 @@ public: if (thumbnail.getTotalLength() > 0) { auto newScale = jmax (0.001, thumbnail.getTotalLength() * (1.0 - jlimit (0.0, 0.99, amount))); - auto timeAtCentre = xToTime (getWidth() / 2.0f); + auto timeAtCentre = xToTime ((float) getWidth() / 2.0f); setRange ({ timeAtCentre - newScale * 0.5, timeAtCentre + newScale * 0.5 }); } @@ -229,12 +229,12 @@ private: if (visibleRange.getLength() <= 0) return 0; - return getWidth() * (float) ((time - visibleRange.getStart()) / visibleRange.getLength()); + return (float) getWidth() * (float) ((time - visibleRange.getStart()) / visibleRange.getLength()); } double xToTime (const float x) const { - return (x / getWidth()) * (visibleRange.getLength()) + visibleRange.getStart(); + return (x / (float) getWidth()) * (visibleRange.getLength()) + visibleRange.getStart(); } bool canMoveTransport() const noexcept diff --git a/examples/Audio/MPEDemo.h b/examples/Audio/MPEDemo.h index 0ce9f25147..1962e56b0e 100644 --- a/examples/Audio/MPEDemo.h +++ b/examples/Audio/MPEDemo.h @@ -209,7 +209,7 @@ public: auto noteDistance = float (getWidth()) / 128; for (auto i = 0; i < 128; ++i) { - auto x = noteDistance * i; + auto x = noteDistance * (float) i; auto noteHeight = int (MidiMessage::isMidiNoteBlack (i) ? 0.7 * getHeight() : getHeight()); g.setColour (MidiMessage::isMidiNoteBlack (i) ? Colours::white : Colours::grey); @@ -302,8 +302,8 @@ private: Point getCentrePositionForNote (MPENote note) const { auto n = float (note.initialNote) + float (note.totalPitchbendInSemitones); - auto x = getWidth() * n / 128; - auto y = getHeight() * (1 - note.timbre.asUnsignedFloat()); + auto x = (float) getWidth() * n / 128; + auto y = (float) getHeight() * (1 - note.timbre.asUnsignedFloat()); return { x, y }; } @@ -656,8 +656,8 @@ private: auto xPos = zone.isLowerZone() ? 0 : zone.getLastMemberChannel() - 1; - Rectangle zoneRect { int (channelWidth * (xPos)), 20, - int (channelWidth * (zone.numMemberChannels + 1)), getHeight() - 20 }; + Rectangle zoneRect { int (channelWidth * (float) xPos), 20, + int (channelWidth * (float) (zone.numMemberChannels + 1)), getHeight() - 20 }; g.setColour (zoneColour); g.drawRect (zoneRect, 3); @@ -680,8 +680,8 @@ private: auto numChannels = legacyModeChannelRange.getEnd() - startChannel - 1; - Rectangle zoneRect (int (getChannelRectangleWidth() * startChannel), 0, - int (getChannelRectangleWidth() * numChannels), getHeight()); + Rectangle zoneRect (int (getChannelRectangleWidth() * (float) startChannel), 0, + int (getChannelRectangleWidth() * (float) numChannels), getHeight()); zoneRect.removeFromTop (20); @@ -694,7 +694,7 @@ private: //============================================================================== float getChannelRectangleWidth() const noexcept { - return float (getWidth()) / numMidiChannels; + return (float) getWidth() / (float) numMidiChannels; } //============================================================================== diff --git a/examples/Audio/MidiDemo.h b/examples/Audio/MidiDemo.h index 94ac1446f1..5581d1f2d4 100644 --- a/examples/Audio/MidiDemo.h +++ b/examples/Audio/MidiDemo.h @@ -273,7 +273,7 @@ private: g.setColour (textColour); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); if (isInput) { diff --git a/examples/Audio/PluckedStringsDemo.h b/examples/Audio/PluckedStringsDemo.h index 9e7121e007..11ec4c1f9c 100644 --- a/examples/Audio/PluckedStringsDemo.h +++ b/examples/Audio/PluckedStringsDemo.h @@ -201,11 +201,11 @@ public: Path generateStringPath() const { - auto y = height / 2.0f; + auto y = (float) height / 2.0f; Path stringPath; stringPath.startNewSubPath (0, y); - stringPath.quadraticTo (length / 2.0f, y + (std::sin (phase) * amplitude), (float) length, y); + stringPath.quadraticTo ((float) length / 2.0f, y + (std::sin (phase) * amplitude), (float) length, y); return stringPath; } @@ -227,7 +227,7 @@ public: { // this determines the visible vibration frequency. // just an arbitrary number chosen to look OK: - auto phaseStep = 400.0f / length; + auto phaseStep = 400.0f / (float) length; phase += phaseStep; @@ -337,7 +337,7 @@ private: if (stringLine->getBounds().contains (e.getPosition())) { - auto position = (e.position.x - stringLine->getX()) / stringLine->getWidth(); + auto position = (e.position.x - (float) stringLine->getX()) / (float) stringLine->getWidth(); stringLine->stringPlucked (position); stringSynths.getUnchecked (i)->stringPlucked (position); diff --git a/examples/Audio/SimpleFFTDemo.h b/examples/Audio/SimpleFFTDemo.h index 644a6d9af3..fdc4c25653 100644 --- a/examples/Audio/SimpleFFTDemo.h +++ b/examples/Audio/SimpleFFTDemo.h @@ -162,7 +162,7 @@ public: for (auto y = 1; y < imageHeight; ++y) { - auto skewedProportionY = 1.0f - std::exp (std::log (y / (float) imageHeight) * 0.2f); + auto skewedProportionY = 1.0f - std::exp (std::log ((float) y / (float) imageHeight) * 0.2f); auto fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionY * (int) fftSize / 2)); auto level = jmap (fftData[fftDataIndex], 0.0f, jmax (maxLevel.getEnd(), 1e-5f), 0.0f, 1.0f); diff --git a/examples/BLOCKS/BlocksDrawingDemo.h b/examples/BLOCKS/BlocksDrawingDemo.h index f47868d3bb..c072c9bbd0 100644 --- a/examples/BLOCKS/BlocksDrawingDemo.h +++ b/examples/BLOCKS/BlocksDrawingDemo.h @@ -403,8 +403,8 @@ public: if (auto grid = activeBlock->getLEDGrid()) { // Work out scale factors to translate X and Y touches to LED indexes - scaleX = (float) (grid->getNumColumns() - 1) / activeBlock->getWidth(); - scaleY = (float) (grid->getNumRows() - 1) / activeBlock->getHeight(); + scaleX = (float) (grid->getNumColumns() - 1) / (float) activeBlock->getWidth(); + scaleY = (float) (grid->getNumRows() - 1) / (float) activeBlock->getHeight(); setLEDProgram (*activeBlock); } diff --git a/examples/BLOCKS/BlocksMonitorDemo.h b/examples/BLOCKS/BlocksMonitorDemo.h index 796327d9f4..c1ca368e3a 100644 --- a/examples/BLOCKS/BlocksMonitorDemo.h +++ b/examples/BLOCKS/BlocksMonitorDemo.h @@ -188,11 +188,11 @@ public: case e::north: return { 0.0f, static_cast (port.index) }; case e::east: - return { static_cast (-1.0f - port.index), static_cast (block->getWidth()) }; + return { static_cast (-1.0f - (float) port.index), static_cast (block->getWidth()) }; case e::south: - return { static_cast (0.0f - block->getHeight()), static_cast (port.index) }; + return { static_cast (0.0f - (float) block->getHeight()), static_cast (port.index) }; case e::west: - return { static_cast (-1.0f - port.index), 0.0f }; + return { static_cast (-1.0f - (float) port.index), 0.0f }; default: break; } @@ -204,13 +204,13 @@ public: switch (port.edge) { case e::north: - return { static_cast (-1.0f - port.index), 0.0f }; + return { static_cast (-1.0f - (float) port.index), 0.0f }; case e::east: - return { static_cast (0.0f - block->getWidth()), static_cast (-1.0f - port.index) }; + return { static_cast (0.0f - (float) block->getWidth()), static_cast (-1.0f - (float) port.index) }; case e::south: - return { static_cast (-1.0f - port.index), static_cast (0.0f - block->getHeight()) }; + return { static_cast (-1.0f - (float) port.index), static_cast (0.0f - (float) block->getHeight()) }; case e::west: - return { 0.0f, static_cast (-1.0f - port.index) }; + return { 0.0f, static_cast (-1.0f - (float) port.index) }; default: break; } @@ -222,11 +222,11 @@ public: switch (port.edge) { case e::north: - return { 0.0f, static_cast (-1.0f - port.index) }; + return { 0.0f, static_cast (-1.0f - (float) port.index) }; case e::east: - return { static_cast (port.index), static_cast (0 - block->getWidth()) }; + return { static_cast (port.index), static_cast (0 - (float) block->getWidth()) }; case e::south: - return { static_cast (block->getHeight()), static_cast (-1.0f - port.index) }; + return { static_cast (block->getHeight()), static_cast (-1.0f - (float) port.index) }; case e::west: return { static_cast (port.index), 0.0f }; default: @@ -309,10 +309,10 @@ public: g.fillAll (Colours::black); // size ration between physical and on-screen blocks - Point ratio (r.getWidth() / block->getWidth(), - r.getHeight() / block->getHeight()); + Point ratio (r.getWidth() / (float) block->getWidth(), + r.getHeight() / (float) block->getHeight()); - auto maxCircleSize = block->getWidth() / 3.0f; + auto maxCircleSize = (float) block->getWidth() / 3.0f; // iterate over the list of current touches and draw them on the onscreen Block for (auto touch : touches) @@ -367,7 +367,7 @@ public: addAndMakeVisible (roundedRectangleButton); // Display the battery level on the LEDRow - auto numLedsToTurnOn = static_cast (numLeds * block->getBatteryLevel()); + auto numLedsToTurnOn = static_cast ((float) numLeds * block->getBatteryLevel()); // add LEDs for (auto i = 0; i < numLeds; ++i) @@ -442,7 +442,7 @@ public: void handleBatteryLevelUpdate (float batteryLevel) override { // Update the number of LEDs that are on to represent the battery level - auto numLedsOn = static_cast (numLeds * batteryLevel); + auto numLedsOn = static_cast ((float) numLeds * batteryLevel); if (numLedsOn != previousNumLedsOn) for (auto i = 0; i < numLeds; ++i) @@ -600,11 +600,11 @@ public: noBlocksLabel.setJustificationType (Justification::centred); zoomOutButton.setButtonText ("+"); - zoomOutButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 1.05f); resized(); }; + zoomOutButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 1.05f); resized(); }; zoomOutButton.setAlwaysOnTop (true); zoomInButton.setButtonText ("-"); - zoomInButton.onClick = [this] { blockUnitInPixels = (int) (blockUnitInPixels * 0.95f); resized(); }; + zoomInButton.onClick = [this] { blockUnitInPixels = (int) ((float) blockUnitInPixels * 0.95f); resized(); }; zoomInButton.setAlwaysOnTop (true); // Register BlocksMonitorDemo as a listener to the PhysicalTopologySource object @@ -670,8 +670,8 @@ public: else if (rotation == 90) blockSize = blockComponent->block->getHeight(); - if (topLeft.x - blockSize < maxArea.getX()) - maxArea.setX (topLeft.x - blockSize); + if (topLeft.x - (float) blockSize < maxArea.getX()) + maxArea.setX (topLeft.x - (float) blockSize); blockSize = 0; if (rotation == 0) @@ -679,8 +679,8 @@ public: else if (rotation == 270) blockSize = blockComponent->block->getHeight(); - if (topLeft.x + blockSize > maxArea.getRight()) - maxArea.setWidth (topLeft.x + blockSize); + if (topLeft.x + (float) blockSize > maxArea.getRight()) + maxArea.setWidth (topLeft.x + (float) blockSize); blockSize = 0; if (rotation == 180) @@ -688,8 +688,8 @@ public: else if (rotation == 270) blockSize = blockComponent->block->getWidth(); - if (topLeft.y - blockSize < maxArea.getY()) - maxArea.setY (topLeft.y - blockSize); + if (topLeft.y - (float) blockSize < maxArea.getY()) + maxArea.setY (topLeft.y - (float) blockSize); blockSize = 0; if (rotation == 0) @@ -697,14 +697,14 @@ public: else if (rotation == 90) blockSize = blockComponent->block->getWidth(); - if (topLeft.y + blockSize > maxArea.getBottom()) - maxArea.setHeight (topLeft.y + blockSize); + if (topLeft.y + (float) blockSize > maxArea.getBottom()) + maxArea.setHeight (topLeft.y + (float) blockSize); } auto totalWidth = std::abs (maxArea.getX()) + maxArea.getWidth(); auto totalHeight = std::abs (maxArea.getY()) + maxArea.getHeight(); - blockUnitInPixels = static_cast (jmin ((getHeight() / totalHeight) - 50, (getWidth() / totalWidth) - 50)); + blockUnitInPixels = static_cast (jmin (((float) getHeight() / totalHeight) - 50, ((float) getWidth() / totalWidth) - 50)); masterBlockComponent->centreWithSize (masterBlockComponent->block->getWidth() * blockUnitInPixels, masterBlockComponent->block->getHeight() * blockUnitInPixels); @@ -721,8 +721,8 @@ public: if (blockComponent == masterBlockComponent) continue; - blockComponent->setBounds (masterBlockComponent->getX() + static_cast (blockComponent->topLeft.x * blockUnitInPixels), - masterBlockComponent->getY() + static_cast (blockComponent->topLeft.y * blockUnitInPixels), + blockComponent->setBounds (masterBlockComponent->getX() + static_cast (blockComponent->topLeft.x * (float) blockUnitInPixels), + masterBlockComponent->getY() + static_cast (blockComponent->topLeft.y * (float) blockUnitInPixels), blockComponent->block->getWidth() * blockUnitInPixels, blockComponent->block->getHeight() * blockUnitInPixels); diff --git a/examples/BLOCKS/BlocksSynthDemo.h b/examples/BLOCKS/BlocksSynthDemo.h index df3fadeac6..995410381e 100644 --- a/examples/BLOCKS/BlocksSynthDemo.h +++ b/examples/BLOCKS/BlocksSynthDemo.h @@ -665,8 +665,8 @@ public: if (auto grid = activeBlock->getLEDGrid()) { // Work out scale factors to translate X and Y touches to LED indexes - scaleX = static_cast (grid->getNumColumns() - 1) / activeBlock->getWidth(); - scaleY = static_cast (grid->getNumRows() - 1) / activeBlock->getHeight(); + scaleX = static_cast (grid->getNumColumns() - 1) / (float) activeBlock->getWidth(); + scaleY = static_cast (grid->getNumRows() - 1) / (float) activeBlock->getHeight(); setLEDProgram (*activeBlock); } @@ -731,7 +731,7 @@ private: layout.touchColour); // Send pitch change and pressure values to the Audio class - audio.pitchChange (midiChannel, (touch.x - touch.startX) / activeBlock->getWidth()); + audio.pitchChange (midiChannel, (touch.x - touch.startX) / (float) activeBlock->getWidth()); audio.pressureChange (midiChannel, touch.z); } diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d770e411cc..f2e6edeb7e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -31,23 +31,19 @@ function(_juce_add_pips) CONFIGURE_DEPENDS LIST_DIRECTORIES false "${CMAKE_CURRENT_SOURCE_DIR}/*.h") + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(REMOVE_ITEM headers + "${CMAKE_CURRENT_SOURCE_DIR}/CameraDemo.h" + "${CMAKE_CURRENT_SOURCE_DIR}/PushNotificationsDemo.h" + "${CMAKE_CURRENT_SOURCE_DIR}/VideoDemo.h") + endif() + foreach(header IN ITEMS ${headers}) juce_add_pip(${header} added_target) - target_link_libraries(${added_target} PRIVATE + target_link_libraries(${added_target} PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags juce::juce_recommended_warning_flags) - - get_target_property(active_targets ${added_target} JUCE_ACTIVE_PLUGIN_TARGETS) - - if(active_targets) - foreach(plugin_target IN LISTS active_targets) - target_link_libraries(${plugin_target} PRIVATE - juce::juce_recommended_config_flags - juce::juce_recommended_lto_flags - juce::juce_recommended_warning_flags) - endforeach() - endif() endforeach() endfunction() diff --git a/examples/DemoRunner/Source/Demos/IntroScreen.h b/examples/DemoRunner/Source/Demos/IntroScreen.h index 0c5a24c54f..270e2c1585 100644 --- a/examples/DemoRunner/Source/Demos/IntroScreen.h +++ b/examples/DemoRunner/Source/Demos/IntroScreen.h @@ -80,13 +80,13 @@ private: Path wavePath; auto waveStep = 10.0f; - auto waveY = getHeight() * 0.44f; + auto waveY = (float) getHeight() * 0.44f; int i = 0; - for (auto x = waveStep * 0.5f; x < getWidth(); x += waveStep) + for (auto x = waveStep * 0.5f; x < (float) getWidth(); x += waveStep) { - auto y1 = waveY + getHeight() * 0.05f * std::sin (i * 0.38f + elapsed); - auto y2 = waveY + getHeight() * 0.10f * std::sin (i * 0.20f + elapsed * 2.0f); + auto y1 = waveY + (float) getHeight() * 0.05f * std::sin ((float) i * 0.38f + elapsed); + auto y2 = waveY + (float) getHeight() * 0.10f * std::sin ((float) i * 0.20f + elapsed * 2.0f); wavePath.addLineSegment ({ x, y1, x, y2 }, 2.0f); wavePath.addEllipse (x - waveStep * 0.3f, y1 - waveStep * 0.3f, waveStep * 0.6f, waveStep * 0.6f); diff --git a/examples/DemoRunner/Source/Main.cpp b/examples/DemoRunner/Source/Main.cpp index d4857100de..b0fafe31ad 100644 --- a/examples/DemoRunner/Source/Main.cpp +++ b/examples/DemoRunner/Source/Main.cpp @@ -131,10 +131,10 @@ private: setFullScreen (true); Desktop::getInstance().setOrientationsEnabled (Desktop::rotatedClockwise | Desktop::rotatedAntiClockwise); #else - setBounds ((int) (0.1f * getParentWidth()), - (int) (0.1f * getParentHeight()), - jmax (850, (int) (0.5f * getParentWidth())), - jmax (600, (int) (0.7f * getParentHeight()))); + setBounds ((int) (0.1f * (float) getParentWidth()), + (int) (0.1f * (float) getParentHeight()), + jmax (850, (int) (0.5f * (float) getParentWidth())), + jmax (600, (int) (0.7f * (float) getParentHeight()))); #endif setContentOwned (new MainComponent(), false); diff --git a/examples/DemoRunner/Source/UI/SettingsContent.h b/examples/DemoRunner/Source/UI/SettingsContent.h index 196bd67533..c02cf5af4b 100644 --- a/examples/DemoRunner/Source/UI/SettingsContent.h +++ b/examples/DemoRunner/Source/UI/SettingsContent.h @@ -119,8 +119,8 @@ private: graphicsTitleLabel.setBounds (bounds.removeFromTop (30)); bounds.removeFromTop (space); - auto xPos = bounds.getX() + (bounds.getWidth() * 0.35f); - auto width = bounds.getWidth() * 0.6f; + auto xPos = (float) bounds.getX() + ((float) bounds.getWidth() * 0.35f); + auto width = (float) bounds.getWidth() * 0.6f; lookAndFeelSelector.setBounds (bounds.removeFromTop (itemHeight).withWidth ((int) width).withX ((int) xPos)); diff --git a/examples/GUI/AnimationAppDemo.h b/examples/GUI/AnimationAppDemo.h index b275dfc271..67a76efc72 100644 --- a/examples/GUI/AnimationAppDemo.h +++ b/examples/GUI/AnimationAppDemo.h @@ -80,13 +80,13 @@ public: for (auto i = 0; i < fishLength; ++i) { - auto radius = 100 + 10 * std::sin (getFrameCounter() * 0.1f + i * 0.5f); + auto radius = 100 + 10 * std::sin ((float) getFrameCounter() * 0.1f + (float) i * 0.5f); - Point p (getWidth() / 2.0f + 1.5f * radius * std::sin (getFrameCounter() * 0.02f + i * 0.12f), - getHeight() / 2.0f + 1.0f * radius * std::cos (getFrameCounter() * 0.04f + i * 0.12f)); + Point p ((float) getWidth() / 2.0f + 1.5f * radius * std::sin ((float) getFrameCounter() * 0.02f + (float) i * 0.12f), + (float) getHeight() / 2.0f + 1.0f * radius * std::cos ((float) getFrameCounter() * 0.04f + (float) i * 0.12f)); // draw the circles along the fish - g.fillEllipse (p.x - i, p.y - i, 2.0f + 2.0f * i, 2.0f + 2.0f * i); + g.fillEllipse (p.x - (float) i, p.y - (float) i, 2.0f + 2.0f * (float) i, 2.0f + 2.0f * (float) i); if (i == 0) spinePath.startNewSubPath (p); // if this is the first point, start a new path.. diff --git a/examples/GUI/AnimationDemo.h b/examples/GUI/AnimationDemo.h index 12b70736cb..29b24518cc 100644 --- a/examples/GUI/AnimationDemo.h +++ b/examples/GUI/AnimationDemo.h @@ -123,10 +123,10 @@ struct BallComponent : public Component void paint (Graphics& g) override { g.setColour (colour); - g.fillEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f); + g.fillEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f); g.setColour (Colours::darkgrey); - g.drawEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f, 1.0f); + g.drawEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f, 1.0f); } Point position, speed; @@ -262,10 +262,10 @@ private: auto newIndex = (componentsToAnimate.indexOf (component) + 3 * cycleCount) % componentsToAnimate.size(); - auto angle = newIndex * MathConstants::twoPi / componentsToAnimate.size(); + auto angle = (float) newIndex * MathConstants::twoPi / (float) componentsToAnimate.size(); - auto radius = useWidth ? width * 0.35f - : height * 0.35f; + auto radius = useWidth ? (float) width * 0.35f + : (float) height * 0.35f; Rectangle r (getWidth() / 2 + (int) (radius * std::sin (angle)) - 50, getHeight() / 2 + (int) (radius * std::cos (angle)) - 50, diff --git a/examples/GUI/BouncingBallWavetableDemo.h b/examples/GUI/BouncingBallWavetableDemo.h index 7f59e1ed0e..f8319edf25 100644 --- a/examples/GUI/BouncingBallWavetableDemo.h +++ b/examples/GUI/BouncingBallWavetableDemo.h @@ -125,13 +125,13 @@ public: auto nextPos = pos + delta; - if (nextPos.x < 10 || nextPos.x + 10 > getWidth()) + if (nextPos.x < 10 || nextPos.x + 10 > (float) getWidth()) { delta.x = -delta.x; nextPos.x = pos.x + delta.x; } - if (nextPos.y < 50 || nextPos.y + 10 > getHeight()) + if (nextPos.y < 50 || nextPos.y + 10 > (float) getHeight()) { delta.y = -delta.y; nextPos.y = pos.y + delta.y; @@ -234,17 +234,17 @@ public: float amplitudeToY (float amp) const noexcept { - return getHeight() - (amp + 1.0f) * getHeight() / 2.0f; + return (float) getHeight() - (amp + 1.0f) * (float) getHeight() / 2.0f; } float xToAmplitude (float x) const noexcept { - return jlimit (-1.0f, 1.0f, 2.0f * (getWidth() - x) / getWidth() - 1.0f); + return jlimit (-1.0f, 1.0f, 2.0f * ((float) getWidth() - x) / (float) getWidth() - 1.0f); } float yToAmplitude (float y) const noexcept { - return jlimit (-1.0f, 1.0f, 2.0f * (getHeight() - y) / getHeight() - 1.0f); + return jlimit (-1.0f, 1.0f, 2.0f * ((float) getHeight() - y) / (float) getHeight() - 1.0f); } void timerCallback() override diff --git a/examples/GUI/FontsDemo.h b/examples/GUI/FontsDemo.h index 8b800ee472..a2bb5b3bcc 100644 --- a/examples/GUI/FontsDemo.h +++ b/examples/GUI/FontsDemo.h @@ -197,8 +197,8 @@ public: AttributedString s; s.setWordWrap (AttributedString::none); s.setJustification (Justification::centredLeft); - s.append (font.getTypefaceName(), font.withHeight (height * 0.7f), Colours::black); - s.append (" " + font.getTypefaceName(), Font (height * 0.5f, Font::italic), Colours::grey); + s.append (font.getTypefaceName(), font.withHeight ((float) height * 0.7f), Colours::black); + s.append (" " + font.getTypefaceName(), Font ((float) height * 0.5f, Font::italic), Colours::grey); s.draw (g, Rectangle (width, height).expanded (-4, 50).toFloat()); } diff --git a/examples/GUI/GraphicsDemo.h b/examples/GUI/GraphicsDemo.h index 858b9b6633..4ad4468253 100644 --- a/examples/GUI/GraphicsDemo.h +++ b/examples/GUI/GraphicsDemo.h @@ -125,8 +125,8 @@ public: AffineTransform getTransform() { - auto hw = 0.5f * getWidth(); - auto hh = 0.5f * getHeight(); + auto hw = 0.5f * (float) getWidth(); + auto hh = 0.5f * (float) getHeight(); AffineTransform t; @@ -197,7 +197,7 @@ public: "Time: " + String (averageTimeMs, 2) + " ms\nEffective FPS: " + String (effectiveFPS, 1) + "\nActual FPS: " + String (averageActualFPS, 1), - 0, 10.0f, getWidth() - 10.0f, (float) getHeight(), Justification::topRight, 3); + 0, 10.0f, (float) getWidth() - 10.0f, (float) getHeight(), Justification::topRight, 3); g.setColour (Colours::white.withAlpha (0.5f)); g.fillRect (ga.getBoundingBox (0, ga.getNumGlyphs(), true).getSmallestIntegerContainer().expanded (4)); @@ -213,8 +213,8 @@ public: auto w = getWidth() / 2; auto h = getHeight() / 2; - auto x = (int) (w * clipRectX.getValue()); - auto y = (int) (h * clipRectY.getValue()); + auto x = (int) ((float) w * clipRectX.getValue()); + auto y = (int) ((float) h * clipRectY.getValue()); g.reduceClipRegion (x, y, w, h); } @@ -239,12 +239,12 @@ public: if (! clipImage.isValid()) createClipImage(); - AffineTransform transform (AffineTransform::translation (clipImage.getWidth() / -2.0f, - clipImage.getHeight() / -2.0f) + AffineTransform transform (AffineTransform::translation ((float) clipImage.getWidth() / -2.0f, + (float) clipImage.getHeight() / -2.0f) .rotated (clipImageAngle.getValue() * MathConstants::twoPi) .scaled (2.0f + clipImageSize.getValue() * 3.0f) - .translated (getWidth() * 0.5f, - getHeight() * 0.5f)); + .translated ((float) getWidth() * 0.5f, + (float) getHeight() * 0.5f)); g.reduceClipRegion (clipImage, transform); } @@ -297,17 +297,17 @@ public: g.fillRect (-rectSize, -rectSize, rectSize, rectSize); g.setGradientFill (ColourGradient (colour1, 10.0f, (float) -rectSize, - colour2, 10.0f + rectSize, 0.0f, false)); + colour2, 10.0f + (float) rectSize, 0.0f, false)); g.setOpacity (getAlpha()); g.fillRect (10, -rectSize, rectSize, rectSize); - g.setGradientFill (ColourGradient (colour1, rectSize * -0.5f, 10.0f + rectSize * 0.5f, - colour2, 0, 10.0f + rectSize, true)); + g.setGradientFill (ColourGradient (colour1, (float) rectSize * -0.5f, 10.0f + (float) rectSize * 0.5f, + colour2, 0, 10.0f + (float) rectSize, true)); g.setOpacity (getAlpha()); g.fillRect (-rectSize, 10, rectSize, rectSize); g.setGradientFill (ColourGradient (colour1, 10.0f, 10.0f, - colour2, 10.0f + rectSize, 10.0f + rectSize, false)); + colour2, 10.0f + (float) rectSize, 10.0f + (float) rectSize, false)); g.setOpacity (getAlpha()); g.drawRect (10, 10, rectSize, rectSize, 5); } @@ -349,10 +349,10 @@ public: Colour c2 (gradientColours[3].getValue(), gradientColours[4].getValue(), gradientColours[5].getValue(), 1.0f); Colour c3 (gradientColours[6].getValue(), gradientColours[7].getValue(), gradientColours[8].getValue(), 1.0f); - auto x1 = gradientPositions[0].getValue() * getWidth() * 0.25f; - auto y1 = gradientPositions[1].getValue() * getHeight() * 0.25f; - auto x2 = gradientPositions[2].getValue() * getWidth() * 0.75f; - auto y2 = gradientPositions[3].getValue() * getHeight() * 0.75f; + auto x1 = gradientPositions[0].getValue() * (float) getWidth() * 0.25f; + auto y1 = gradientPositions[1].getValue() * (float) getHeight() * 0.25f; + auto x2 = gradientPositions[2].getValue() * (float) getWidth() * 0.75f; + auto y2 = gradientPositions[3].getValue() * (float) getHeight() * 0.75f; ColourGradient gradient (c1, x1, y1, c2, x2, y2, @@ -530,8 +530,8 @@ public: for (int x = 0; x < getWidth(); ++x) { - auto y = getHeight() * 0.3f; - auto length = y * std::abs (std::sin (x / 100.0f + 2.0f * pos)); + auto y = (float) getHeight() * 0.3f; + auto length = y * std::abs (std::sin ((float) x / 100.0f + 2.0f * pos)); verticalLines.addWithoutMerging (Rectangle ((float) x, y - length * 0.5f, 1.0f, length)); } @@ -547,8 +547,8 @@ public: for (int y = 0; y < getHeight(); ++y) { - auto x = getWidth() * 0.3f; - auto length = x * std::abs (std::sin (y / 100.0f + 2.0f * pos)); + auto x = (float) getWidth() * 0.3f; + auto length = x * std::abs (std::sin ((float) y / 100.0f + 2.0f * pos)); horizontalLines.addWithoutMerging (Rectangle (x - length * 0.5f, (float) y, length, 1.0f)); } diff --git a/examples/GUI/LookAndFeelDemo.h b/examples/GUI/LookAndFeelDemo.h index c716af1ab6..99ce15c04d 100644 --- a/examples/GUI/LookAndFeelDemo.h +++ b/examples/GUI/LookAndFeelDemo.h @@ -90,8 +90,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4 auto flatOnTop = button.isConnectedOnTop(); auto flatOnBottom = button.isConnectedOnBottom(); - auto width = button.getWidth() - 1.0f; - auto height = button.getHeight() - 1.0f; + auto width = (float) button.getWidth() - 1.0f; + auto height = (float) button.getHeight() - 1.0f; if (width > 0 && height > 0) { @@ -168,13 +168,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4 if (style == Slider::LinearVertical) { - kx = x + width * 0.5f; + kx = (float) x + (float) width * 0.5f; ky = sliderPos; } else { kx = sliderPos; - ky = y + height * 0.5f; + ky = (float) y + (float) height * 0.5f; } auto outlineThickness = slider.isEnabled() ? 0.8f : 0.3f; @@ -203,9 +203,9 @@ struct CustomLookAndFeel : public LookAndFeel_V4 Path p; if (style == Slider::LinearBarVertical) - p.addRectangle ((float) x, sliderPos, (float) width, 1.0f + height - sliderPos); + p.addRectangle ((float) x, sliderPos, (float) width, 1.0f + (float) height - sliderPos); else - p.addRectangle ((float) x, (float) y, sliderPos - x, (float) height); + p.addRectangle ((float) x, (float) y, sliderPos - (float) x, (float) height); auto baseColour = slider.findColour (Slider::rotarySliderFillColourId) .withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f) @@ -214,7 +214,7 @@ struct CustomLookAndFeel : public LookAndFeel_V4 g.setColour (baseColour); g.fillPath (p); - auto lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f; + auto lineThickness = jmin (15.0f, (float) jmin (width, height) * 0.45f) * 0.1f; g.drawRect (slider.getLocalBounds().toFloat(), lineThickness); } else @@ -230,13 +230,13 @@ struct CustomLookAndFeel : public LookAndFeel_V4 float /*maxSliderPos*/, const Slider::SliderStyle /*style*/, Slider& slider) override { - auto sliderRadius = getSliderThumbRadius (slider) - 5.0f; + auto sliderRadius = (float) getSliderThumbRadius (slider) - 5.0f; Path on, off; if (slider.isHorizontal()) { - auto iy = y + height * 0.5f - sliderRadius * 0.5f; - Rectangle r (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius); + auto iy = (float) y + (float) height * 0.5f - sliderRadius * 0.5f; + Rectangle r ((float) x - sliderRadius * 0.5f, iy, (float) width + sliderRadius, sliderRadius); auto onW = r.getWidth() * ((float) slider.valueToProportionOfLength (slider.getValue())); on.addRectangle (r.removeFromLeft (onW)); @@ -244,8 +244,8 @@ struct CustomLookAndFeel : public LookAndFeel_V4 } else { - auto ix = x + width * 0.5f - sliderRadius * 0.5f; - Rectangle r (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius); + auto ix = (float) x + (float) width * 0.5f - sliderRadius * 0.5f; + Rectangle r (ix, (float) y - sliderRadius * 0.5f, sliderRadius, (float) height + sliderRadius); auto onH = r.getHeight() * ((float) slider.valueToProportionOfLength (slider.getValue())); on.addRectangle (r.removeFromBottom (onH)); @@ -262,9 +262,9 @@ struct CustomLookAndFeel : public LookAndFeel_V4 void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos, float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override { - auto radius = jmin (width / 2, height / 2) - 2.0f; - auto centreX = x + width * 0.5f; - auto centreY = y + height * 0.5f; + auto radius = (float) jmin (width / 2, height / 2) - 2.0f; + auto centreX = (float) x + (float) width * 0.5f; + auto centreY = (float) y + (float) height * 0.5f; auto rx = centreX - radius; auto ry = centreY - radius; auto rw = radius * 2.0f; @@ -283,7 +283,7 @@ struct CustomLookAndFeel : public LookAndFeel_V4 } { - auto lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f; + auto lineThickness = jmin (15.0f, (float) jmin (width, height) * 0.45f) * 0.1f; Path outlineArc; outlineArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.0); g.strokePath (outlineArc, PathStrokeType (lineThickness)); @@ -307,8 +307,8 @@ struct SquareLookAndFeel : public CustomLookAndFeel if (isButtonDown || isMouseOverButton) baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f); - auto width = button.getWidth() - 1.0f; - auto height = button.getHeight() - 1.0f; + auto width = (float) button.getWidth() - 1.0f; + auto height = (float) button.getHeight() - 1.0f; if (width > 0 && height > 0) { @@ -372,14 +372,14 @@ struct SquareLookAndFeel : public CustomLookAndFeel if (style == Slider::LinearVertical) { - kx = x + width * 0.5f; + kx = (float) x + (float) width * 0.5f; ky = sliderPos; g.fillRect (Rectangle (kx - sliderRadius, ky - 2.5f, sliderRadius * 2.0f, 5.0f)); } else { kx = sliderPos; - ky = y + height * 0.5f; + ky = (float) y + (float) height * 0.5f; g.fillRect (Rectangle (kx - 2.5f, ky - sliderRadius, 5.0f, sliderRadius * 2.0f)); } } @@ -393,10 +393,10 @@ struct SquareLookAndFeel : public CustomLookAndFeel void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos, float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override { - auto diameter = jmin (width, height) - 4.0f; + auto diameter = (float) jmin (width, height) - 4.0f; auto radius = (diameter / 2.0f) * std::cos (MathConstants::pi / 4.0f); - auto centreX = x + width * 0.5f; - auto centreY = y + height * 0.5f; + auto centreX = (float) x + (float) width * 0.5f; + auto centreY = (float) y + (float) height * 0.5f; auto rx = centreX - radius; auto ry = centreY - radius; auto rw = radius * 2.0f; diff --git a/examples/GUI/MenusDemo.h b/examples/GUI/MenusDemo.h index 12bcc8da5c..aa905b96a1 100644 --- a/examples/GUI/MenusDemo.h +++ b/examples/GUI/MenusDemo.h @@ -102,7 +102,7 @@ private: burgerButton.setBounds (r.removeFromRight (40).withSizeKeepingCentre (20, 20)); - titleLabel.setFont (Font (getHeight() * 0.5f, Font::plain)); + titleLabel.setFont (Font ((float) getHeight() * 0.5f, Font::plain)); titleLabel.setBounds (r); } diff --git a/examples/GUI/OpenGLAppDemo.h b/examples/GUI/OpenGLAppDemo.h index daaf26e686..f32029e542 100644 --- a/examples/GUI/OpenGLAppDemo.h +++ b/examples/GUI/OpenGLAppDemo.h @@ -92,7 +92,7 @@ public: Matrix3D getViewMatrix() const { Matrix3D viewMatrix ({ 0.0f, 0.0f, -10.0f }); - Matrix3D rotationMatrix = viewMatrix.rotation ({ -0.3f, 5.0f * std::sin (getFrameCounter() * 0.01f), 0.0f }); + Matrix3D rotationMatrix = viewMatrix.rotation ({ -0.3f, 5.0f * std::sin ((float) getFrameCounter() * 0.01f), 0.0f }); return rotationMatrix * viewMatrix; } @@ -107,7 +107,7 @@ public: glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glViewport (0, 0, roundToInt (desktopScale * getWidth()), roundToInt (desktopScale * getHeight())); + glViewport (0, 0, roundToInt (desktopScale * (float) getWidth()), roundToInt (desktopScale * (float) getHeight())); shader->use(); diff --git a/examples/GUI/OpenGLDemo.h b/examples/GUI/OpenGLDemo.h index 59484e413f..639131f35d 100644 --- a/examples/GUI/OpenGLDemo.h +++ b/examples/GUI/OpenGLDemo.h @@ -655,7 +655,10 @@ struct OpenGLUtils g.drawRect (0, 0, size, size, 2); g.setColour (Colours::green); - g.fillEllipse (x.getValue() * size * 0.9f, y.getValue() * size * 0.9f, size * 0.1f, size * 0.1f); + g.fillEllipse (x.getValue() * (float) size * 0.9f, + y.getValue() * (float) size * 0.9f, + (float) size * 0.1f, + (float) size * 0.1f); g.setColour (Colours::black); g.setFont (40); @@ -827,7 +830,7 @@ public: openGLContext.extensions.glActiveTexture (GL_TEXTURE0); glEnable (GL_TEXTURE_2D); - glViewport (0, 0, roundToInt (desktopScale * getWidth()), roundToInt (desktopScale * getHeight())); + glViewport (0, 0, roundToInt (desktopScale * (float) getWidth()), roundToInt (desktopScale * (float) getHeight())); texture.bind(); @@ -913,8 +916,8 @@ private: { // Create an OpenGLGraphicsContext that will draw into this GL window.. std::unique_ptr glRenderer (createOpenGLGraphicsContext (openGLContext, - roundToInt (desktopScale * getWidth()), - roundToInt (desktopScale * getHeight()))); + roundToInt (desktopScale * (float) getWidth()), + roundToInt (desktopScale * (float) getHeight()))); if (glRenderer.get() != nullptr) { @@ -927,11 +930,11 @@ private: // This stuff just creates a spinning star shape and fills it.. Path p; - p.addStar ({ getWidth() * s.x.getValue(), - getHeight() * s.y.getValue() }, + p.addStar ({ (float) getWidth() * s.x.getValue(), + (float) getHeight() * s.y.getValue() }, 7, - getHeight() * size * 0.5f, - getHeight() * size, + (float) getHeight() * size * 0.5f, + (float) getHeight() * size, s.angle.getValue()); auto hue = s.hue.getValue(); diff --git a/examples/GUI/WidgetsDemo.h b/examples/GUI/WidgetsDemo.h index f039b9f9b0..9c8bca98b9 100644 --- a/examples/GUI/WidgetsDemo.h +++ b/examples/GUI/WidgetsDemo.h @@ -1106,7 +1106,7 @@ private: g.fillAll (Colours::lightblue); g.setColour (LookAndFeel::getDefaultLookAndFeel().findColour (Label::textColourId)); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); g.drawText ("Draggable Thing #" + String (rowNumber + 1), 5, 0, width, height, diff --git a/examples/GUI/WindowsDemo.h b/examples/GUI/WindowsDemo.h index 50a121b730..7b4504bc5d 100644 --- a/examples/GUI/WindowsDemo.h +++ b/examples/GUI/WindowsDemo.h @@ -116,7 +116,7 @@ public: Random random; - auto size = 10.0f + random.nextInt (30); + auto size = 10.0f + (float) random.nextInt (30); ballBounds.setBounds (random.nextFloat() * 100.0f, random.nextFloat() * 100.0f, @@ -142,10 +142,10 @@ public: { ballBounds += direction; - if (ballBounds.getX() < 0) direction.x = std::abs (direction.x); - if (ballBounds.getY() < 0) direction.y = std::abs (direction.y); - if (ballBounds.getRight() > getParentWidth()) direction.x = -std::abs (direction.x); - if (ballBounds.getBottom() > getParentHeight()) direction.y = -std::abs (direction.y); + if (ballBounds.getX() < 0) direction.x = std::abs (direction.x); + if (ballBounds.getY() < 0) direction.y = std::abs (direction.y); + if (ballBounds.getRight() > (float) getParentWidth()) direction.x = -std::abs (direction.x); + if (ballBounds.getBottom() > (float) getParentHeight()) direction.y = -std::abs (direction.y); setBounds (ballBounds.getSmallestIntegerContainer()); } diff --git a/examples/Plugins/AUv3SynthPluginDemo.h b/examples/Plugins/AUv3SynthPluginDemo.h index db503651bc..c890bcf032 100644 --- a/examples/Plugins/AUv3SynthPluginDemo.h +++ b/examples/Plugins/AUv3SynthPluginDemo.h @@ -115,7 +115,7 @@ public: sliderPos = (sliderPos - minSliderPos) / static_cast (width); - auto knobPos = static_cast (sliderPos * r.getWidth()); + auto knobPos = static_cast (sliderPos * (float) r.getWidth()); g.setColour (sliderActivePart); g.fillRect (backgroundBar.removeFromLeft (knobPos)); diff --git a/examples/Plugins/InterAppAudioEffectPluginDemo.h b/examples/Plugins/InterAppAudioEffectPluginDemo.h index 4aa7e11a86..a75980f05e 100644 --- a/examples/Plugins/InterAppAudioEffectPluginDemo.h +++ b/examples/Plugins/InterAppAudioEffectPluginDemo.h @@ -303,7 +303,7 @@ private: Path rewindShape; rewindShape.addRectangle (0.0, 0.0, 5.0, buttonSize); - rewindShape.addTriangle (0.0, buttonSize / 2, buttonSize, 0.0, buttonSize, buttonSize); + rewindShape.addTriangle (0.0, buttonSize * 0.5f, buttonSize, 0.0, buttonSize, buttonSize); rewindButton.setShape (rewindShape, true, true, false); rewindButton.onClick = [this] { @@ -383,19 +383,19 @@ private: area.removeFromLeft (20); transportText.setBounds (area.removeFromTop (120)); - auto navigationArea = area.removeFromTop (buttonSize); + auto navigationArea = area.removeFromTop ((int) buttonSize); rewindButton.setTopLeftPosition (navigationArea.getPosition()); - navigationArea.removeFromLeft (buttonSize + 10); + navigationArea.removeFromLeft ((int) buttonSize + 10); playButton.setTopLeftPosition (navigationArea.getPosition()); - navigationArea.removeFromLeft (buttonSize + 10); + navigationArea.removeFromLeft ((int) buttonSize + 10); recordButton.setTopLeftPosition (navigationArea.getPosition()); area.removeFromTop (30); - auto appSwitchArea = area.removeFromTop (buttonSize); + auto appSwitchArea = area.removeFromTop ((int) buttonSize); switchToHostButtonLabel.setBounds (appSwitchArea.removeFromLeft (100)); appSwitchArea.removeFromLeft (5); - switchToHostButton.setBounds (appSwitchArea.removeFromLeft (buttonSize)); + switchToHostButton.setBounds (appSwitchArea.removeFromLeft ((int) buttonSize)); } private: @@ -513,7 +513,7 @@ private: if (visible) { - auto icon = hostType.getHostIcon (buttonSize); + auto icon = hostType.getHostIcon ((int) buttonSize); switchToHostButton.setImages(false, true, true, icon, 1.0, Colours::transparentBlack, icon, 1.0, Colours::transparentBlack, @@ -525,7 +525,7 @@ private: IAAEffectProcessor& iaaEffectProcessor; AudioProcessorValueTreeState& parameters; - const int buttonSize = 30; + const float buttonSize = 30.0f; const Colour defaultButtonColour = Colours::darkgrey; ShapeButton rewindButton {"Rewind", defaultButtonColour, defaultButtonColour, defaultButtonColour}; ShapeButton playButton {"Play", defaultButtonColour, defaultButtonColour, defaultButtonColour}; diff --git a/examples/Plugins/SamplerPluginDemo.h b/examples/Plugins/SamplerPluginDemo.h index dc794ec8e2..5e672773b5 100644 --- a/examples/Plugins/SamplerPluginDemo.h +++ b/examples/Plugins/SamplerPluginDemo.h @@ -1005,7 +1005,7 @@ public: double getSampleLengthSeconds() const { if (auto r = getSampleReader()) - return r->lengthInSamples / r->sampleRate; + return (double) r->lengthInSamples / r->sampleRate; return 1.0; } @@ -1538,7 +1538,7 @@ private: void paint (Graphics& g) override { auto minDivisionWidth = 50.0f; - auto maxDivisions = getWidth() / minDivisionWidth; + auto maxDivisions = (float) getWidth() / minDivisionWidth; auto lookFeel = dynamic_cast (&getLookAndFeel()); auto bg = lookFeel->getCurrentColourScheme() @@ -1593,7 +1593,7 @@ private: { // Work out the scale of the new range auto unitDistance = 100.0f; - auto scaleFactor = 1.0 / std::pow (2, e.getDistanceFromDragStartY() / unitDistance); + auto scaleFactor = 1.0 / std::pow (2, (float) e.getDistanceFromDragStartY() / unitDistance); // Now position it so that the mouse continues to point at the same // place on the ruler. diff --git a/examples/Utilities/Box2DDemo.h b/examples/Utilities/Box2DDemo.h index d2ae62f654..991730f4a8 100644 --- a/examples/Utilities/Box2DDemo.h +++ b/examples/Utilities/Box2DDemo.h @@ -88,11 +88,15 @@ struct Test std::unique_ptr m_world { new b2World (b2Vec2 (0.0f, -10.0f)) }; }; +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wimplicit-int-float-conversion") + #include "../Assets/Box2DTests/AddPair.h" #include "../Assets/Box2DTests/ApplyForce.h" #include "../Assets/Box2DTests/Dominos.h" #include "../Assets/Box2DTests/Chain.h" +JUCE_END_IGNORE_WARNINGS_GCC_LIKE + //============================================================================== /** This list box just displays a StringArray and broadcasts a change message when the selected row changes. @@ -118,7 +122,7 @@ public: lf.findColour (ListBox::backgroundColourId))); g.setColour (lf.findColour (ListBox::textColourId)); - g.setFont (h * 0.7f); + g.setFont ((float) h * 0.7f); g.drawText (tests[row], Rectangle (0, 0, w, h).reduced (2), Justification::centredLeft, true); } diff --git a/examples/Utilities/InAppPurchasesDemo.h b/examples/Utilities/InAppPurchasesDemo.h index d4b1753fbb..c70fbf9018 100644 --- a/examples/Utilities/InAppPurchasesDemo.h +++ b/examples/Utilities/InAppPurchasesDemo.h @@ -275,7 +275,7 @@ public: Rectangle r (0, 0, w, h); auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); - g.setColour (lf.findColour (isSelected ? TextEditor::highlightColourId : ListBox::backgroundColourId)); + g.setColour (lf.findColour (isSelected ? (int) TextEditor::highlightColourId : (int) ListBox::backgroundColourId)); g.fillRect (r); g.setColour (lf.findColour (ListBox::textColourId)); @@ -461,7 +461,7 @@ public: auto r = Rectangle (0, 0, w, h).reduced (4); auto& lf = Desktop::getInstance().getDefaultLookAndFeel(); - g.setColour (lf.findColour (isSelected ? TextEditor::highlightColourId : ListBox::backgroundColourId)); + g.setColour (lf.findColour (isSelected ? (int) TextEditor::highlightColourId : (int) ListBox::backgroundColourId)); g.fillRect (r); } diff --git a/examples/Utilities/MultithreadingDemo.h b/examples/Utilities/MultithreadingDemo.h index 81cfb638c5..e682f1f767 100644 --- a/examples/Utilities/MultithreadingDemo.h +++ b/examples/Utilities/MultithreadingDemo.h @@ -121,8 +121,8 @@ private: { const ScopedLock lock (drawing); - parentWidth = comp.getWidth() - size; - parentHeight = comp.getHeight() - size; + parentWidth = (float) comp.getWidth() - size; + parentHeight = (float) comp.getHeight() - size; } float x = 0.0f, y = 0.0f, diff --git a/examples/Utilities/XMLandJSONDemo.h b/examples/Utilities/XMLandJSONDemo.h index dceae32790..76528267b6 100644 --- a/examples/Utilities/XMLandJSONDemo.h +++ b/examples/Utilities/XMLandJSONDemo.h @@ -75,7 +75,7 @@ public: // use a "colour" attribute in the xml tag for this node to set the text colour.. g.setColour (Colour::fromString (xml.getStringAttribute ("colour", "ff000000"))); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); // draw the xml element's tag name.. g.drawText (xml.getTagName(), @@ -145,7 +145,7 @@ public: g.fillAll (Colours::blue.withAlpha (0.3f)); g.setColour (Colours::black); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); // draw the element's tag name.. g.drawText (getText(), diff --git a/extras/AudioPerformanceTest/Source/MainComponent.h b/extras/AudioPerformanceTest/Source/MainComponent.h index 3a5337116e..542ccab63f 100644 --- a/extras/AudioPerformanceTest/Source/MainComponent.h +++ b/extras/AudioPerformanceTest/Source/MainComponent.h @@ -245,13 +245,13 @@ private: //============================================================================== static double getPreciseTimeMs() noexcept { - return 1000.0 * Time::getHighResolutionTicks() / (double) Time::getHighResolutionTicksPerSecond(); + return 1000.0 * (double) Time::getHighResolutionTicks() / (double) Time::getHighResolutionTicksPerSecond(); } //============================================================================== double getPhysicalTimeLimitMs() const noexcept { - return 1000.0 * a.size() / currentSampleRate; + return 1000.0 * (double) a.size() / currentSampleRate; } //============================================================================== diff --git a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp index ee0c071057..b8bdc95e0e 100644 --- a/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp +++ b/extras/AudioPluginHost/Source/UI/GraphEditorPanel.cpp @@ -139,7 +139,7 @@ struct GraphEditorPanel::PinComponent : public Component, auto colour = (pin.isMIDI() ? Colours::red : Colours::green); - g.setColour (colour.withRotatedHue (busIdx / 5.0f)); + g.setColour (colour.withRotatedHue ((float) busIdx / 5.0f)); g.fillPath (p); } @@ -963,7 +963,7 @@ struct GraphDocumentComponent::TooltipBar : public Component, void paint (Graphics& g) override { - g.setFont (Font (getHeight() * 0.7f, Font::bold)); + g.setFont (Font ((float) getHeight() * 0.7f, Font::bold)); g.setColour (Colours::black); g.drawFittedText (tip, 10, 0, getWidth() - 12, getHeight(), Justification::centredLeft, 1); } diff --git a/extras/NetworkGraphicsDemo/Source/MasterComponent.h b/extras/NetworkGraphicsDemo/Source/MasterComponent.h index 5cabfc137c..12cad9ed76 100644 --- a/extras/NetworkGraphicsDemo/Source/MasterComponent.h +++ b/extras/NetworkGraphicsDemo/Source/MasterComponent.h @@ -256,8 +256,8 @@ private: { auto total = currentCanvas.getLimits(); - return { getWidth() * (p.x - total.getX()) / total.getWidth(), - getHeight() * (p.y - total.getY()) / total.getHeight() }; + return { (float) getWidth() * (p.x - total.getX()) / total.getWidth(), + (float) getHeight() * (p.y - total.getY()) / total.getHeight() }; } Rectangle virtualSpaceToLocal (Rectangle p) const @@ -270,8 +270,8 @@ private: { auto total = currentCanvas.getLimits(); - return { total.getX() + total.getWidth() * (p.x / getWidth()), - total.getY() + total.getHeight() * (p.y / getHeight()) }; + return { total.getX() + total.getWidth() * (p.x / (float) getWidth()), + total.getY() + total.getHeight() * (p.y / (float) getHeight()) }; } //============================================================================== diff --git a/extras/NetworkGraphicsDemo/Source/SlaveComponent.h b/extras/NetworkGraphicsDemo/Source/SlaveComponent.h index deee26f5b2..b50a6b6289 100644 --- a/extras/NetworkGraphicsDemo/Source/SlaveComponent.h +++ b/extras/NetworkGraphicsDemo/Source/SlaveComponent.h @@ -80,8 +80,8 @@ private: OSCMessage message (userInputOSCAddress); message.addString (clientName); - message.addFloat32 (e.position.x * clientArea.getWidth() / getWidth() + clientArea.getX()); - message.addFloat32 (e.position.y * clientArea.getHeight() / getHeight() + clientArea.getY()); + message.addFloat32 (e.position.x * clientArea.getWidth() / (float) getWidth() + clientArea.getX()); + message.addFloat32 (e.position.y * clientArea.getHeight() / (float) getHeight() + clientArea.getY()); send (message); } diff --git a/extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h b/extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h index 10bbc089e8..9d43feb13c 100644 --- a/extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h +++ b/extras/Projucer/Source/Application/UserAccount/jucer_LoginFormComponent.h @@ -104,8 +104,8 @@ public: passwordBox.setBounds (bounds.removeFromTop (textEditorHeight)); bounds.removeFromTop (spacing * 2); - emailBox.setFont (Font (textEditorHeight / 2.5f)); - passwordBox.setFont (Font (textEditorHeight / 2.5f)); + emailBox.setFont (Font ((float) textEditorHeight / 2.5f)); + passwordBox.setFont (Font ((float) textEditorHeight / 2.5f)); logInButton.setBounds (bounds.removeFromTop (textEditorHeight)); diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index 6efb9fd978..337dde39a9 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -97,7 +97,8 @@ private: auto parentBounds = mainWindow.getBounds(); componentImage = mainWindow.createComponentSnapshot (mainWindow.getLocalBounds()) - .rescaled (roundToInt (parentBounds.getWidth() / 1.75f), roundToInt (parentBounds.getHeight() / 1.75f)); + .rescaled (roundToInt ((float) parentBounds.getWidth() / 1.75f), + roundToInt ((float) parentBounds.getHeight() / 1.75f)); kernel.applyToImage (componentImage, componentImage, getLocalBounds()); diff --git a/extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h b/extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h index c140ea32f2..a2f9f35ae5 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h +++ b/extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h @@ -53,7 +53,7 @@ public: } auto area = RectanglePlacement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize) - .appliedTo (contentBounds, Rectangle (4.0f, 22.0f, getWidth() - 8.0f, getHeight() - 26.0f)); + .appliedTo (contentBounds, Rectangle (4.0f, 22.0f, (float) getWidth() - 8.0f, (float) getHeight() - 26.0f)); Path p; p.addRectangle (area); diff --git a/extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h b/extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h index 7234484206..c87b3e81c2 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h +++ b/extras/Projucer/Source/CodeEditor/jucer_LiveBuildCodeEditor.h @@ -150,7 +150,7 @@ private: const auto charArea = codeEditor->getCharacterBounds (startPosition); const int height = charArea.getHeight() + 8; - Font f (height * 0.7f); + Font f ((float) height * 0.7f); const int width = jmin (height * 2 + f.getStringWidth (launchButton.getName()), jmax (120, codeEditor->proportionOfWidth (0.2f))); @@ -191,7 +191,7 @@ private: .draw (g, r.removeFromLeft (getHeight()).toFloat(), false); g.setColour (Colours::white); - g.setFont (getHeight() * 0.7f); + g.setFont ((float) getHeight() * 0.7f); g.drawFittedText (getName(), r, Justification::centredLeft, 1); } @@ -324,9 +324,9 @@ private: g.fillRect (getLocalBounds().withTrimmedBottom (lineOffset)); Path path; - const float bottomY = getHeight() - (lineOffset / 2.0f); + const float bottomY = (float) getHeight() - ((float) lineOffset / 2.0f); path.addTriangle ((float) arrowXMin, bottomY, - (arrowXMax + arrowXMin) / 2.0f, (float) lineOffset, + (float) (arrowXMax + arrowXMin) / 2.0f, (float) lineOffset, (float) arrowXMax, bottomY); g.setColour (diagColour.withAlpha (0.8f)); diff --git a/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp b/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp index 88fee0975e..665d037891 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp +++ b/extras/Projucer/Source/CodeEditor/jucer_SourceCodeEditor.cpp @@ -403,7 +403,7 @@ public: void paint (Graphics& g) override { Path outline; - outline.addRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 8.0f); + outline.addRoundedRectangle (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 8.0f); g.setColour (Colours::black.withAlpha (0.6f)); g.fillPath (outline); diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h index bbc4fc54ed..18c481408e 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_TreeViewHandler.h @@ -146,7 +146,7 @@ private: g.fillAll (Colours::lightblue); g.setColour (Colours::black); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); g.drawText (name, 4, 0, width - 4, height, Justification::centredLeft, true); } diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h index c97df44b18..6eafb5864c 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_FillType.h @@ -407,7 +407,7 @@ private: Graphics g (image); g.fillCheckerBoard (image.getBounds().toFloat(), - image.getWidth() * 0.5f, image.getHeight() * 0.5f, + (float) image.getWidth() * 0.5f, (float) image.getHeight() * 0.5f, Colours::white, Colours::lightgrey); g.setFont (12.0f); diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h index 9bdd4083cf..7deb19d60f 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementUndoableAction.h @@ -83,7 +83,7 @@ protected: void changed() const { - jassert (routine.getDocument() != 0); + jassert (routine.getDocument() != nullptr); routine.getDocument()->changed(); } diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h index 0b07534ac8..f3c80d546f 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PointComponent.h @@ -57,10 +57,10 @@ public: void paint (Graphics& g) override { g.setColour (Colours::white); - g.drawEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f, 2.0f); + g.drawEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f, 2.0f); g.setColour (Colours::black); - g.drawEllipse (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 2.0f); + g.drawEllipse (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 2.0f); } //============================================================================== diff --git a/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h b/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h index 8b490cefcb..0b236a0653 100644 --- a/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h +++ b/extras/Projucer/Source/ComponentEditor/Properties/jucer_ColourPropertyComponent.h @@ -66,7 +66,7 @@ public: Colour (0xffffffff).overlaidWith (colour)); g.setColour (Colours::white.overlaidWith (colour).contrasting()); - g.setFont (Font (getHeight() * 0.6f, Font::bold)); + g.setFont (Font ((float) getHeight() * 0.6f, Font::bold)); g.drawFittedText (colour.toDisplayString (true), 2, 1, getWidth() - 4, getHeight() - 1, Justification::centred, 1); diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp index 42b7ddfee4..29a918ecfd 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_JucerDocumentEditor.cpp @@ -78,7 +78,7 @@ public: g.setColour (findColour (defaultTextColourId)); } - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawText (returnValues [row] + " " + baseClasses [row] + "::" + methods [row], 30, 0, width - 32, height, Justification::centredLeft, true); @@ -1037,7 +1037,7 @@ bool JucerDocumentEditor::perform (const InvocationInfo& info) else if (info.commandID == JucerCommandIDs::compOverlay100) amount = 100; - document->setComponentOverlayOpacity (amount * 0.01f); + document->setComponentOverlayOpacity ((float) amount * 0.01f); } break; diff --git a/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h b/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h index c46b39122d..176d94674c 100644 --- a/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h +++ b/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h @@ -74,8 +74,8 @@ public: */ PositionedRectangle() noexcept : x (0.0), y (0.0), w (0.0), h (0.0), - xMode (anchorAtLeftOrTop | absoluteFromParentTopLeft), - yMode (anchorAtLeftOrTop | absoluteFromParentTopLeft), + xMode ((int) anchorAtLeftOrTop | (int) absoluteFromParentTopLeft), + yMode ((int) anchorAtLeftOrTop | (int) absoluteFromParentTopLeft), wMode (absoluteSize), hMode (absoluteSize) { } @@ -283,23 +283,23 @@ public: const SizeMode widthMode, const SizeMode heightMode, const Rectangle& target) noexcept { - if (xMode != (xAnchor | xMode_) || wMode != widthMode) + if (xMode != ((int) xAnchor | (int) xMode_) || wMode != widthMode) { double tx, tw; applyPosAndSize (tx, tw, x, w, xMode, wMode, target.getX(), target.getWidth()); - xMode = (uint8) (xAnchor | xMode_); + xMode = (uint8) ((int) xAnchor | (int) xMode_); wMode = (uint8) widthMode; updatePosAndSize (x, w, tx, tw, xMode, wMode, target.getX(), target.getWidth()); } - if (yMode != (yAnchor | yMode_) || hMode != heightMode) + if (yMode != ((int) yAnchor | (int) yMode_) || hMode != heightMode) { double ty, th; applyPosAndSize (ty, th, y, h, yMode, hMode, target.getY(), target.getHeight()); - yMode = (uint8) (yAnchor | yMode_); + yMode = (uint8) ((int) yAnchor | (int) yMode_); hMode = (uint8) heightMode; updatePosAndSize (y, h, ty, th, yMode, hMode, target.getY(), target.getHeight()); diff --git a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h b/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h index c9fe79f8a1..839e8c9575 100644 --- a/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h +++ b/extras/Projucer/Source/LiveBuildEngine/UI/jucer_ActivityListComponent.h @@ -65,7 +65,7 @@ public: { g.setColour (findColour (defaultTextColourId)); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); g.drawText (activities [rowNumber], 4, 0, width - 5, height, Justification::centredLeft, true); } diff --git a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h index 43fd50b95c..631dbc719a 100644 --- a/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h +++ b/extras/Projucer/Source/Project/UI/Sidebar/jucer_ProjectTab.h @@ -206,14 +206,14 @@ public: jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels())); concertinaPanel.setPanelSize (concertinaPanel.getPanel (panelIndex), - roundToInt (prop * (concertinaPanel.getHeight() - 90)), false); + roundToInt (prop * (float) (concertinaPanel.getHeight() - 90)), false); } float getPanelHeightProportion (int panelIndex) { jassert (isPositiveAndBelow (panelIndex, concertinaPanel.getNumPanels())); - return ((float) (concertinaPanel.getPanel (panelIndex)->getHeight()) / (concertinaPanel.getHeight() - 90)); + return ((float) (concertinaPanel.getPanel (panelIndex)->getHeight()) / (float) (concertinaPanel.getHeight() - 90)); } private: diff --git a/extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h b/extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h index 104aefa271..ae4f80ae48 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h +++ b/extras/Projucer/Source/Project/UI/jucer_ContentViewComponents.h @@ -60,7 +60,7 @@ public: for (auto s : columnHeaders) { addAndMakeVisible (headers.add (new Label (s, s))); - widths.add (1.0f / columnHeaders.size()); + widths.add (1.0f / (float) columnHeaders.size()); } setSize (200, 40); @@ -90,7 +90,7 @@ public: auto index = 0; for (auto h : headers) { - auto headerWidth = roundToInt (width * widths.getUnchecked (index)); + auto headerWidth = roundToInt ((float) width * widths.getUnchecked (index)); h->setBounds (bounds.removeFromLeft (headerWidth)); ++index; } @@ -114,7 +114,7 @@ public: for (int i = 0; i < index; ++i) prop += widths.getUnchecked (i); - return roundToInt (prop * getWidth()); + return roundToInt (prop * (float) getWidth()); } float getProportionAtIndex (int index) @@ -372,7 +372,7 @@ private: if (availableTextWidth == 0) return 0; - return static_cast (nameWidth / availableTextWidth); + return static_cast (nameWidth / (float) availableTextWidth); } //============================================================================== diff --git a/extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h b/extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h index fa7671894a..1b5eb58072 100644 --- a/extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h +++ b/extras/Projucer/Source/Project/UI/jucer_FileGroupInformationComponent.h @@ -155,7 +155,7 @@ private: { if (header != nullptr) { - auto textBounds = getLocalBounds().removeFromLeft (roundToInt (header->getProportionAtIndex (0) * getWidth())); + auto textBounds = getLocalBounds().removeFromLeft (roundToInt (header->getProportionAtIndex (0) * (float) getWidth())); auto iconBounds = textBounds.removeFromLeft (25); @@ -175,7 +175,7 @@ private: if (header != nullptr) { auto bounds = getLocalBounds(); - auto width = getWidth(); + auto width = (float) getWidth(); bounds.removeFromLeft (roundToInt (header->getProportionAtIndex (0) * width)); diff --git a/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp b/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp index fe80800db4..0f3f3ce590 100644 --- a/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp +++ b/extras/Projucer/Source/Project/UI/jucer_HeaderComponent.cpp @@ -70,7 +70,7 @@ HeaderComponent::~HeaderComponent() void HeaderComponent::resized() { auto bounds = getLocalBounds(); - configLabel.setFont ({ bounds.getHeight() / 3.0f }); + configLabel.setFont ({ (float) bounds.getHeight() / 3.0f }); { auto headerBounds = bounds.removeFromLeft (tabsWidth); @@ -96,11 +96,11 @@ void HeaderComponent::resized() saveAndOpenInIDEButton.setBounds (exporterBounds.removeFromRight (exporterBounds.getHeight()).reduced (2)); exporterBounds.removeFromRight (5); - exporterBox.setBounds (exporterBounds.removeFromBottom (roundToInt (exporterBounds.getHeight() / 1.8f))); + exporterBox.setBounds (exporterBounds.removeFromBottom (roundToInt ((float) exporterBounds.getHeight() / 1.8f))); configLabel.setBounds (exporterBounds); } - userAvatar.setBounds (bounds.removeFromRight (userAvatar.isDisplaingGPLLogo() ? roundToInt (bounds.getHeight() * 1.9f) + userAvatar.setBounds (bounds.removeFromRight (userAvatar.isDisplaingGPLLogo() ? roundToInt ((float) bounds.getHeight() * 1.9f) : bounds.getHeight()).reduced (2)); } diff --git a/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h b/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h index 36ca258dc5..6cf4b9a8cc 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h +++ b/extras/Projucer/Source/Project/UI/jucer_ModulesInformationComponent.h @@ -125,18 +125,18 @@ public: //============================================================================== auto moduleID = project.getEnabledModules().getModuleID (rowNumber); - g.drawFittedText (moduleID, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (0) * width)), Justification::centredLeft, 1); + g.drawFittedText (moduleID, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (0) * (float) width)), Justification::centredLeft, 1); //============================================================================== auto version = project.getEnabledModules().getModuleInfo (moduleID).getVersion(); if (version.isEmpty()) version = "?"; - g.drawFittedText (version, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (1) * width)), Justification::centredLeft, 1); + g.drawFittedText (version, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (1) * (float) width)), Justification::centredLeft, 1); //============================================================================== g.drawFittedText (String (project.getEnabledModules().shouldCopyModuleFilesLocally (moduleID) ? "Yes" : "No"), - bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (2) * width)), Justification::centredLeft, 1); + bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (2) * (float) width)), Justification::centredLeft, 1); //============================================================================== String pathText; @@ -155,7 +155,7 @@ public: pathText = paths.joinIntoString (", "); } - g.drawFittedText (pathText, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (3) * width)), Justification::centredLeft, 1); + g.drawFittedText (pathText, bounds.removeFromLeft (roundToInt (listHeader->getProportionAtIndex (3) * (float) width)), Justification::centredLeft, 1); } void listBoxItemDoubleClicked (int row, const MouseEvent&) override diff --git a/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h b/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h index 7fd94a6e4b..6af198166d 100644 --- a/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h +++ b/extras/Projucer/Source/Project/UI/jucer_ProjectMessagesComponent.h @@ -218,7 +218,7 @@ private: { auto buttonBounds = bounds.removeFromBottom (buttonHeight); - auto buttonWidth = roundToInt (buttonBounds.getWidth() / 3.5f); + auto buttonWidth = roundToInt ((float) buttonBounds.getWidth() / 3.5f); auto requiredWidth = (numButtons * buttonWidth) + ((numButtons - 1) * buttonSpacing); buttonBounds.reduce ((buttonBounds.getWidth() - requiredWidth) / 2, 0); diff --git a/extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h b/extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h index 4217b8e5d0..5a5f70a363 100644 --- a/extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h +++ b/extras/Projucer/Source/Utility/Helpers/jucer_VersionInfo.h @@ -47,7 +47,7 @@ public: const std::vector assets; private: - VersionInfo() = default; + VersionInfo() = delete; static std::unique_ptr fetch (const String&); }; diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h index a3162ef6d1..0636ae159c 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h @@ -71,7 +71,7 @@ private: Colour (0xffffffff).overlaidWith (colour)); g.setColour (Colours::white.overlaidWith (colour).contrasting()); - g.setFont (Font (getHeight() * 0.6f, Font::bold)); + g.setFont (Font ((float) getHeight() * 0.6f, Font::bold)); g.drawFittedText (colour.toDisplayString (true), getLocalBounds().reduced (2, 1), Justification::centred, 1); } diff --git a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp index 43529429db..cfb3107477 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp +++ b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.cpp @@ -80,7 +80,7 @@ void JucerTreeViewBase::refreshSubItems() Font JucerTreeViewBase::getFont() const { - return Font (getItemHeight() * 0.6f); + return Font ((float) getItemHeight() * 0.6f); } void JucerTreeViewBase::paintOpenCloseButton (Graphics& g, const Rectangle& area, Colour /*backgroundColour*/, bool isMouseOver) diff --git a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h index 0ff725c5cd..f20c08c159 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h +++ b/extras/Projucer/Source/Utility/UI/jucer_JucerTreeViewBase.h @@ -214,7 +214,7 @@ public: auto bounds = getLocalBounds().toFloat(); auto iconBounds = bounds.removeFromLeft ((float) iconWidth).reduced (7, 5); - bounds.removeFromRight (buttons.size() * bounds.getHeight()); + bounds.removeFromRight ((float) buttons.size() * bounds.getHeight()); item.paintIcon (g, iconBounds); item.paintContent (g, bounds.toNearestInt()); diff --git a/extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp b/extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp index b5e14f72b9..24ef85dc9b 100644 --- a/extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp +++ b/extras/Projucer/Source/Utility/UI/jucer_ProjucerLookAndFeel.cpp @@ -206,7 +206,7 @@ void ProjucerLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, b { bounds.removeFromLeft (5); - const auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); + const auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f); g.setFont (fontSize); g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId) @@ -475,7 +475,7 @@ Path ProjucerLookAndFeel::getArrowPath (Rectangle arrowZone, const int di if (filled) path.closeSubPath(); - path.applyTransform (AffineTransform::rotation (direction * MathConstants::halfPi, + path.applyTransform (AffineTransform::rotation ((float) direction * MathConstants::halfPi, arrowZone.getCentreX(), arrowZone.getCentreY())); return path; diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp index 40dad699d6..2f751c5c19 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.cpp @@ -319,7 +319,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest { for (int i = 0; i < numSamples; ++i) { - dest[i] = scale * (int) ByteOrder::swapIfBigEndian (*reinterpret_cast (intData)); + dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast (intData)); intData += srcBytesPerSample; } } @@ -330,7 +330,7 @@ void AudioDataConverters::convertInt32LEToFloat (const void* source, float* dest for (int i = numSamples; --i >= 0;) { intData -= srcBytesPerSample; - dest[i] = scale * (int) ByteOrder::swapIfBigEndian (*reinterpret_cast (intData)); + dest[i] = scale * (float) ByteOrder::swapIfBigEndian (*reinterpret_cast (intData)); } } } @@ -344,7 +344,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest { for (int i = 0; i < numSamples; ++i) { - dest[i] = scale * (int) ByteOrder::swapIfLittleEndian (*reinterpret_cast (intData)); + dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast (intData)); intData += srcBytesPerSample; } } @@ -355,7 +355,7 @@ void AudioDataConverters::convertInt32BEToFloat (const void* source, float* dest for (int i = numSamples; --i >= 0;) { intData -= srcBytesPerSample; - dest[i] = scale * (int) ByteOrder::swapIfLittleEndian (*reinterpret_cast (intData)); + dest[i] = scale * (float) ByteOrder::swapIfLittleEndian (*reinterpret_cast (intData)); } } } diff --git a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h index af8198c617..64ad8ec47e 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h +++ b/modules/juce_audio_basics/buffers/juce_AudioDataConverters.h @@ -528,8 +528,8 @@ public: if (v < mn) mn = v; } - return Range (mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)), - mx * (float) (1.0 / (1.0 + (double) Int32::maxValue))); + return Range ((float) mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)), + (float) mx * (float) (1.0 / (1.0 + (double) Int32::maxValue))); } /** Scans a block of data, returning the lowest and highest levels as floats */ diff --git a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp index 606eca2675..aa155bcfc6 100644 --- a/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPEInstrument.cpp @@ -491,7 +491,7 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note) { if (legacyMode.isEnabled) { - note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * legacyMode.pitchbendRange; + note.totalPitchbendInSemitones = note.pitchbend.asSignedFloat() * (float) legacyMode.pitchbendRange; } else { @@ -516,11 +516,11 @@ void MPEInstrument::updateNoteTotalPitchbend (MPENote& note) auto notePitchbendInSemitones = 0.0f; if (zone.isUsingChannelAsMemberChannel (note.midiChannel)) - notePitchbendInSemitones = note.pitchbend.asSignedFloat() * zone.perNotePitchbendRange; + notePitchbendInSemitones = note.pitchbend.asSignedFloat() * (float) zone.perNotePitchbendRange; auto masterPitchbendInSemitones = pitchbendDimension.lastValueReceivedOnChannel[zone.getMasterChannel() - 1] .asSignedFloat() - * zone.masterPitchbendRange; + * (float) zone.masterPitchbendRange; note.totalPitchbendInSemitones = notePitchbendInSemitones + masterPitchbendInSemitones; } diff --git a/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp b/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp index d9c98c6d64..acd03984b0 100644 --- a/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp +++ b/modules/juce_audio_basics/mpe/juce_MPESynthesiserBase.cpp @@ -345,7 +345,7 @@ namespace const auto& e = synth.events; expectWithinAbsoluteError (float (e.blocks.size()), - std::ceil (float (blockSize) / subblockSize), + std::ceil ((float) blockSize / (float) subblockSize), 1.0f); expect (e.messages.size() == blockSize); expect (std::is_sorted (e.blocks.begin(), e.blocks.end())); diff --git a/modules/juce_audio_basics/utilities/juce_Interpolators.cpp b/modules/juce_audio_basics/utilities/juce_Interpolators.cpp index 397b954fc6..b42e0c0b3d 100644 --- a/modules/juce_audio_basics/utilities/juce_Interpolators.cpp +++ b/modules/juce_audio_basics/utilities/juce_Interpolators.cpp @@ -167,7 +167,7 @@ private: (int) input.size(), (int) input.size()); std::vector secondGaussian (doubleLengthOutput.size()); - createGaussian (secondGaussian, 1.0f, expectedGaussianMidpoint + outputBufferSize, expectedGaussianWidth); + createGaussian (secondGaussian, 1.0f, expectedGaussianMidpoint + (float) outputBufferSize, expectedGaussianWidth); FloatVectorOperations::add (expectedDoubleLengthOutput.data(), secondGaussian.data(), (int) expectedDoubleLengthOutput.size()); expectAllElementsWithin (doubleLengthOutput, expectedDoubleLengthOutput, 0.02f); diff --git a/modules/juce_audio_basics/utilities/juce_Interpolators.h b/modules/juce_audio_basics/utilities/juce_Interpolators.h index 0160a86bcd..cdd2c875b7 100644 --- a/modules/juce_audio_basics/utilities/juce_Interpolators.h +++ b/modules/juce_audio_basics/utilities/juce_Interpolators.h @@ -54,7 +54,8 @@ private: static forcedinline float valueAtOffset (const float* const inputs, const float offset, int indexBuffer) noexcept { - int numCrossings = 100; + const int numCrossings = 100; + const float floatCrossings = (float) numCrossings; float result = 0.0f; auto samplePosition = indexBuffer; @@ -69,14 +70,15 @@ private: if (i == -numCrossings || (sincPosition >= 0 && lastSincPosition < 0)) { auto indexFloat = (sincPosition >= 0.f ? sincPosition : -sincPosition) * 100.0f; - index = (int) std::floor (indexFloat); - firstFrac = indexFloat - index; + auto indexFloored = std::floor (indexFloat); + index = (int) indexFloored; + firstFrac = indexFloat - indexFloored; sign = (sincPosition < 0 ? -1 : 1); } if (sincPosition == 0.0f) result += inputs[samplePosition]; - else if (sincPosition < numCrossings && sincPosition > -numCrossings) + else if (sincPosition < floatCrossings && sincPosition > -floatCrossings) result += inputs[samplePosition] * windowedSinc (firstFrac, index); if (++samplePosition == numCrossings * 2) diff --git a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h index d7d4a5db00..7bcd5a1803 100644 --- a/modules/juce_audio_basics/utilities/juce_SmoothedValue.h +++ b/modules/juce_audio_basics/utilities/juce_SmoothedValue.h @@ -369,7 +369,7 @@ private: template MultiplicativeVoid setStepSize() { - step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / this->countdown); + step = std::exp ((std::log (std::abs (this->target)) - std::log (std::abs (this->currentValue))) / (FloatType) this->countdown); } //============================================================================== diff --git a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp index 744c23312b..44bec28e3f 100644 --- a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp @@ -1968,8 +1968,8 @@ private: { const uint8 n0 = si.allocation[i][0]; const uint8 n1 = si.allocation[i][1]; - fraction[0][i] = n0 > 0 ? (float) ((-(1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0; - fraction[1][i] = n1 > 0 ? (float) ((-(1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0; + fraction[0][i] = n0 > 0 ? ((float) (-(1 << n0) + getBitsUint16 (n0 + 1) + 1) * constants.muls[n0 + 1][si.scaleFactor[i][0]]) : 0.0f; + fraction[1][i] = n1 > 0 ? ((float) (-(1 << n1) + getBitsUint16 (n1 + 1) + 1) * constants.muls[n1 + 1][si.scaleFactor[i][1]]) : 0.0f; } for (i = jsbound; i < 32; ++i) @@ -1979,8 +1979,8 @@ private: if (n > 0) { const uint32 w = ((uint32) -(1 << n) + getBitsUint16 (n + 1) + 1); - fraction[0][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][0]]); - fraction[1][i] = (float) (w * constants.muls[n + 1][si.scaleFactor[i][1]]); + fraction[0][i] = ((float) w * constants.muls[n + 1][si.scaleFactor[i][0]]); + fraction[1][i] = ((float) w * constants.muls[n + 1][si.scaleFactor[i][1]]); } else fraction[0][i] = fraction[1][i] = 0; @@ -1994,7 +1994,7 @@ private: const uint8 j = si.scaleFactor[i][0]; if (n > 0) - fraction[0][i] = (float) ((-(1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]); + fraction[0][i] = ((float) (-(1 << n) + getBitsUint16 (n + 1) + 1) * constants.muls[n + 1][j]); else fraction[0][i] = 0; } @@ -3113,7 +3113,7 @@ private: const int bytesPerFrame = stream.frame.frameSize + 4; if (bytesPerFrame == 417 || bytesPerFrame == 418) - numFrames = roundToInt ((streamSize - streamStartPos) / 417.95918); // more accurate for 128k + numFrames = roundToInt ((double) (streamSize - streamStartPos) / 417.95918); // more accurate for 128k else numFrames = (streamSize - streamStartPos) / bytesPerFrame; } diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp index 22a44c2a7b..b87b1bc405 100644 --- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp @@ -135,7 +135,7 @@ public: lengthInSamples = (uint32) ov_pcm_total (&ovFile, -1); numChannels = (unsigned int) info->channels; bitsPerSample = 16; - sampleRate = info->rate; + sampleRate = (double) info->rate; reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096)); } @@ -276,7 +276,7 @@ public: vorbis_info_init (&vi); if (vorbis_encode_init_vbr (&vi, (int) numChans, (int) rate, - jlimit (0.0f, 1.0f, qualityIndex * 0.1f)) == 0) + jlimit (0.0f, 1.0f, (float) qualityIndex * 0.1f)) == 0) { vorbis_comment_init (&vc); @@ -483,8 +483,8 @@ int OggVorbisAudioFormat::estimateOggFileQuality (const File& source) { if (auto r = std::unique_ptr (createReaderFor (in.release(), true))) { - auto lengthSecs = r->lengthInSamples / r->sampleRate; - auto approxBitsPerSecond = (int) (source.getSize() * 8 / lengthSecs); + auto lengthSecs = (double) r->lengthInSamples / r->sampleRate; + auto approxBitsPerSecond = (int) ((double) source.getSize() * 8 / lengthSecs); auto qualities = getQualityOptions(); int bestIndex = 0; diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index d881d737ab..f25261c2ec 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -1474,7 +1474,7 @@ private: output->writeShort ((short) numChannels); output->writeInt ((int) sampleRate); - output->writeInt ((int) (bytesPerFrame * sampleRate)); // nAvgBytesPerSec + output->writeInt ((int) ((double) bytesPerFrame * sampleRate)); // nAvgBytesPerSec output->writeShort ((short) bytesPerFrame); // nBlockAlign output->writeShort ((short) bitsPerSample); // wBitsPerSample diff --git a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp index 6e381bfecd..3b667f0f33 100644 --- a/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp +++ b/modules/juce_audio_formats/format/juce_AudioFormatReader.cpp @@ -235,8 +235,8 @@ void AudioFormatReader::readMaxLevels (int64 startSampleInFile, int64 numSamples { auto intRange = Range::findMinAndMax (intBuffer[i], numToDo); - r = Range (intRange.getStart() / (float) std::numeric_limits::max(), - intRange.getEnd() / (float) std::numeric_limits::max()); + r = Range ((float) intRange.getStart() / (float) std::numeric_limits::max(), + (float) intRange.getEnd() / (float) std::numeric_limits::max()); } results[i] = isFirstBlock ? r : results[i].getUnionWith (r); diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 7a3ed96e02..5740f20612 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -1262,10 +1262,10 @@ private: auto transformScale = std::sqrt (std::abs (editor->getTransform().getDeterminant())); - auto minW = (double) (constrainer->getMinimumWidth() * transformScale); - auto maxW = (double) (constrainer->getMaximumWidth() * transformScale); - auto minH = (double) (constrainer->getMinimumHeight() * transformScale); - auto maxH = (double) (constrainer->getMaximumHeight() * transformScale); + auto minW = (double) ((float) constrainer->getMinimumWidth() * transformScale); + auto maxW = (double) ((float) constrainer->getMaximumWidth() * transformScale); + auto minH = (double) ((float) constrainer->getMinimumHeight() * transformScale); + auto maxH = (double) ((float) constrainer->getMaximumHeight() * transformScale); auto width = (double) (rectToCheck->right - rectToCheck->left); auto height = (double) (rectToCheck->bottom - rectToCheck->top); @@ -1381,10 +1381,10 @@ private: if (approximatelyEqual (desktopScale, 1.0f)) return pluginRect; - return { roundToInt (pluginRect.left * desktopScale), - roundToInt (pluginRect.top * desktopScale), - roundToInt (pluginRect.right * desktopScale), - roundToInt (pluginRect.bottom * desktopScale) }; + return { roundToInt ((float) pluginRect.left * desktopScale), + roundToInt ((float) pluginRect.top * desktopScale), + roundToInt ((float) pluginRect.right * desktopScale), + roundToInt ((float) pluginRect.bottom * desktopScale) }; } static ViewRect convertFromHostBounds (ViewRect hostRect) @@ -1394,10 +1394,10 @@ private: if (approximatelyEqual (desktopScale, 1.0f)) return hostRect; - return { roundToInt (hostRect.left / desktopScale), - roundToInt (hostRect.top / desktopScale), - roundToInt (hostRect.right / desktopScale), - roundToInt (hostRect.bottom / desktopScale) }; + return { roundToInt ((float) hostRect.left / desktopScale), + roundToInt ((float) hostRect.top / desktopScale), + roundToInt ((float) hostRect.right / desktopScale), + roundToInt ((float) hostRect.bottom / desktopScale) }; } //============================================================================== diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index b7411e9a7a..068eff2000 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -1359,13 +1359,13 @@ struct VST3PluginWindow : public AudioProcessorEditor, if (wasResized && view->canResize() == kResultTrue) { - rect.right = (Steinberg::int32) roundToInt (getWidth() * nativeScaleFactor); - rect.bottom = (Steinberg::int32) roundToInt (getHeight() * nativeScaleFactor); + rect.right = (Steinberg::int32) roundToInt ((float) getWidth() * nativeScaleFactor); + rect.bottom = (Steinberg::int32) roundToInt ((float) getHeight() * nativeScaleFactor); view->checkSizeConstraint (&rect); - auto w = roundToInt (rect.getWidth() / nativeScaleFactor); - auto h = roundToInt (rect.getHeight() / nativeScaleFactor); + auto w = roundToInt ((float) rect.getWidth() / nativeScaleFactor); + auto h = roundToInt ((float) rect.getHeight() / nativeScaleFactor); setSize (w, h); @@ -1459,10 +1459,10 @@ private: //============================================================================== static void resizeWithRect (Component& comp, const ViewRect& rect, float scaleFactor) { - comp.setBounds (roundToInt (rect.left / scaleFactor), - roundToInt (rect.top / scaleFactor), - jmax (10, std::abs (roundToInt (rect.getWidth() / scaleFactor))), - jmax (10, std::abs (roundToInt (rect.getHeight() / scaleFactor)))); + comp.setBounds (roundToInt ((float) rect.left / scaleFactor), + roundToInt ((float) rect.top / scaleFactor), + jmax (10, std::abs (roundToInt ((float) rect.getWidth() / scaleFactor))), + jmax (10, std::abs (roundToInt ((float) rect.getHeight() / scaleFactor)))); } void attachPluginWindow() diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index daea2e7751..caa55b6180 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -1545,7 +1545,7 @@ StringArray AudioProcessorParameter::getAllValueStrings() const auto maxIndex = getNumSteps() - 1; for (int i = 0; i < getNumSteps(); ++i) - valueStrings.add (getText ((float) i / maxIndex, 1024)); + valueStrings.add (getText ((float) i / (float) maxIndex, 1024)); } return valueStrings; diff --git a/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp b/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp index 605ef3526b..1d1c0df1ce 100644 --- a/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp +++ b/modules/juce_audio_processors/processors/juce_GenericAudioProcessorEditor.cpp @@ -284,7 +284,7 @@ private: { // The parameter is producing some unexpected text, so we'll do // some linear interpolation. - index = roundToInt (getParameter().getValue() * (parameterValues.size() - 1)); + index = roundToInt (getParameter().getValue() * (float) (parameterValues.size() - 1)); } box.setSelectedItemIndex (index); diff --git a/modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp b/modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp index 6b6dc374f7..9eab44c260 100644 --- a/modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp +++ b/modules/juce_audio_processors/scanning/juce_PluginDirectoryScanner.cpp @@ -77,7 +77,7 @@ String PluginDirectoryScanner::getNextPluginFileThatWillBeScanned() const void PluginDirectoryScanner::updateProgress() { - progress = (1.0f - nextIndex.get() / (float) filesOrIdentifiersToScan.size()); + progress = (1.0f - (float) nextIndex.get() / (float) filesOrIdentifiersToScan.size()); } bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList, diff --git a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp index 4ec95a167e..28e06a0936 100644 --- a/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp +++ b/modules/juce_audio_processors/scanning/juce_PluginListComponent.cpp @@ -88,7 +88,7 @@ public: g.setColour (isBlacklisted ? Colours::red : columnId == nameCol ? defaultTextColour : defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f)); - g.setFont (Font (height * 0.7f, Font::bold)); + g.setFont (Font ((float) height * 0.7f, Font::bold)); g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f); } } diff --git a/modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp b/modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp index 89eeff0a5d..05ae5856dc 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioParameterChoice.cpp @@ -33,7 +33,7 @@ AudioParameterChoice::AudioParameterChoice (const String& idToUse, const String& : RangedAudioParameter (idToUse, nameToUse, labelToUse), choices (c), range ([this] { - NormalisableRange rangeWithInterval { 0.0f, choices.size() - 1.0f, + NormalisableRange rangeWithInterval { 0.0f, (float) choices.size() - 1.0f, [] (float, float end, float v) { return jlimit (0.0f, end, v * end); }, [] (float, float end, float v) { return jlimit (0.0f, 1.0f, v / end); }, [] (float start, float end, float v) { return (float) roundToInt (juce::jlimit (start, end, v)); } }; diff --git a/modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp b/modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp index ce8dfbaab7..ccd31f5d06 100644 --- a/modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp +++ b/modules/juce_audio_processors/utilities/juce_AudioParameterFloat.cpp @@ -44,7 +44,7 @@ AudioParameterFloat::AudioParameterFloat (const String& idToUse, const String& n if (range.interval != 0.0f) { - if (approximatelyEqual (std::abs (range.interval - (int) range.interval), 0.0f)) + if (approximatelyEqual (std::abs (range.interval - std::floor (range.interval)), 0.0f)) return 0; auto v = std::abs (roundToInt (range.interval * pow (10, numDecimalPlaces))); diff --git a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp index 86097b1b2d..50cae68ed0 100644 --- a/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp @@ -109,12 +109,12 @@ public: bool enabled = deviceManager.isMidiInputDeviceEnabled (item.identifier); auto x = getTickX(); - auto tickW = height * 0.75f; + auto tickW = (float) height * 0.75f; - getLookAndFeel().drawTickBox (g, *this, x - tickW, (height - tickW) / 2, tickW, tickW, + getLookAndFeel().drawTickBox (g, *this, (float) x - tickW, ((float) height - tickW) * 0.5f, tickW, tickW, enabled, true, true, false); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.setColour (findColour (ListBox::textColourId, true).withMultipliedAlpha (enabled ? 1.0f : 0.6f)); g.drawText (item.name, x + 5, 0, width - x - 5, height, Justification::centredLeft, true); } @@ -145,7 +145,7 @@ public: if (items.isEmpty()) { g.setColour (Colours::grey); - g.setFont (0.5f * getRowHeight()); + g.setFont (0.5f * (float) getRowHeight()); g.drawText (noItemsMessage, 0, 0, getWidth(), getHeight() / 2, Justification::centred, true); @@ -800,12 +800,12 @@ public: } auto x = getTickX(); - auto tickW = height * 0.75f; + auto tickW = (float) height * 0.75f; - getLookAndFeel().drawTickBox (g, *this, x - tickW, (height - tickW) / 2, tickW, tickW, + getLookAndFeel().drawTickBox (g, *this, (float) x - tickW, ((float) height - tickW) * 0.5f, tickW, tickW, enabled, true, true, false); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.setColour (findColour (ListBox::textColourId, true).withMultipliedAlpha (enabled ? 1.0f : 0.6f)); g.drawText (item, x + 5, 0, width - x - 5, height, Justification::centredLeft, true); } @@ -836,7 +836,7 @@ public: if (items.isEmpty()) { g.setColour (Colours::grey); - g.setFont (0.5f * getRowHeight()); + g.setFont (0.5f * (float) getRowHeight()); g.drawText (noItemsMessage, 0, 0, getWidth(), getHeight() / 2, Justification::centred, true); diff --git a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp index 58a4edca4f..a02d92ec25 100644 --- a/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp @@ -753,7 +753,7 @@ int AudioThumbnail::getNumChannels() const noexcept double AudioThumbnail::getTotalLength() const noexcept { - return sampleRate > 0 ? (totalSamples / sampleRate) : 0; + return sampleRate > 0 ? ((double) totalSamples / sampleRate) : 0.0; } bool AudioThumbnail::isFullyLoaded() const noexcept @@ -763,7 +763,7 @@ bool AudioThumbnail::isFullyLoaded() const noexcept double AudioThumbnail::getProportionComplete() const noexcept { - return jlimit (0.0, 1.0, numSamplesFinished / (double) jmax ((int64) 1, totalSamples.load())); + return jlimit (0.0, 1.0, (double) numSamplesFinished / (double) jmax ((int64) 1, totalSamples.load())); } int64 AudioThumbnail::getNumSamplesFinished() const noexcept @@ -779,7 +779,7 @@ float AudioThumbnail::getApproximatePeak() const for (auto* c : channels) peak = jmax (peak, c->getPeak()); - return jlimit (0, 127, peak) / 127.0f; + return (float) jlimit (0, 127, peak) / 127.0f; } void AudioThumbnail::getApproximateMinMax (double startTime, double endTime, int channelIndex, diff --git a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp index e6e5d6e74c..5bf3af77f6 100644 --- a/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_AudioVisualiserComponent.cpp @@ -178,7 +178,7 @@ void AudioVisualiserComponent::paint (Graphics& g) g.fillAll (backgroundColour); auto r = getLocalBounds().toFloat(); - auto channelHeight = r.getHeight() / channels.size(); + auto channelHeight = r.getHeight() / (float) channels.size(); g.setColour (waveformColour); diff --git a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp index 696aca5fd1..5bbe5b2c2c 100644 --- a/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp +++ b/modules/juce_audio_utils/gui/juce_MidiKeyboardComponent.cpp @@ -220,7 +220,7 @@ Range MidiKeyboardComponent::getKeyPosition (int midiNoteNumber, float ta auto octave = midiNoteNumber / 12; auto note = midiNoteNumber % 12; - auto start = octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth; + auto start = (float) octave * 7.0f * targetKeyWidth + notePos[note] * targetKeyWidth; auto width = MidiMessage::isMidiNoteBlack (note) ? blackNoteWidthRatio * targetKeyWidth : targetKeyWidth; return { start, start + width }; @@ -248,8 +248,8 @@ Rectangle MidiKeyboardComponent::getRectangleForKey (int note) const switch (orientation) { case horizontalKeyboard: return { x, 0, w, blackNoteLength }; - case verticalKeyboardFacingLeft: return { getWidth() - blackNoteLength, x, blackNoteLength, w }; - case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, blackNoteLength, w }; + case verticalKeyboardFacingLeft: return { (float) getWidth() - blackNoteLength, x, blackNoteLength, w }; + case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, blackNoteLength, w }; default: jassertfalse; break; } } @@ -259,7 +259,7 @@ Rectangle MidiKeyboardComponent::getRectangleForKey (int note) const { case horizontalKeyboard: return { x, 0, w, (float) getHeight() }; case verticalKeyboardFacingLeft: return { 0, x, (float) getWidth(), w }; - case verticalKeyboardFacingRight: return { 0, getHeight() - x - w, (float) getWidth(), w }; + case verticalKeyboardFacingRight: return { 0, (float) getHeight() - x - w, (float) getWidth(), w }; default: jassertfalse; break; } } @@ -295,9 +295,9 @@ int MidiKeyboardComponent::xyToNote (Point pos, float& mousePositionVeloc p = { p.y, p.x }; if (orientation == verticalKeyboardFacingLeft) - p = { p.x, getWidth() - p.y }; + p = { p.x, (float) getWidth() - p.y }; else - p = { getHeight() - p.x, p.y }; + p = { (float) getHeight() - p.x, p.y }; } return remappedXYToNote (p + Point (xOffset, 0), mousePositionVelocity); @@ -382,8 +382,8 @@ void MidiKeyboardComponent::paint (Graphics& g) if (orientation == verticalKeyboardFacingLeft) { - x1 = width - 1.0f; - x2 = width - 5.0f; + x1 = (float) width - 1.0f; + x2 = (float) width - 5.0f; } else if (orientation == verticalKeyboardFacingRight) x2 = 5.0f; @@ -400,7 +400,7 @@ void MidiKeyboardComponent::paint (Graphics& g) switch (orientation) { case horizontalKeyboard: g.fillRect (0.0f, 0.0f, x, 5.0f); break; - case verticalKeyboardFacingLeft: g.fillRect (width - 5.0f, 0.0f, 5.0f, x); break; + case verticalKeyboardFacingLeft: g.fillRect ((float) width - 5.0f, 0.0f, 5.0f, x); break; case verticalKeyboardFacingRight: g.fillRect (0.0f, 0.0f, 5.0f, x); break; default: break; } @@ -412,9 +412,9 @@ void MidiKeyboardComponent::paint (Graphics& g) switch (orientation) { - case horizontalKeyboard: g.fillRect (0.0f, height - 1.0f, x, 1.0f); break; + case horizontalKeyboard: g.fillRect (0.0f, (float) height - 1.0f, x, 1.0f); break; case verticalKeyboardFacingLeft: g.fillRect (0.0f, 0.0f, 1.0f, x); break; - case verticalKeyboardFacingRight: g.fillRect (width - 1.0f, 0.0f, 1.0f, x); break; + case verticalKeyboardFacingRight: g.fillRect ((float) width - 1.0f, 0.0f, 1.0f, x); break; default: break; } } @@ -561,7 +561,7 @@ void MidiKeyboardComponent::drawUpDownButton (Graphics& g, int w, int h, g.setColour (findColour (upDownButtonArrowColourId) .withAlpha (buttonDown ? 1.0f : (mouseOver ? 0.6f : 0.4f))); - g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, w - 2.0f, h - 2.0f, true)); + g.fillPath (path, path.getTransformToScaleToFit (1.0f, 1.0f, (float) w - 2.0f, (float) h - 2.0f, true)); } void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept @@ -578,7 +578,7 @@ void MidiKeyboardComponent::setBlackNoteLengthProportion (float ratio) noexcept float MidiKeyboardComponent::getBlackNoteLength() const noexcept { auto whiteNoteLength = orientation == horizontalKeyboard ? getHeight() : getWidth(); - return whiteNoteLength * blackNoteLengthRatio; + return (float) whiteNoteLength * blackNoteLengthRatio; } void MidiKeyboardComponent::setBlackNoteWidthProportion (float ratio) noexcept @@ -608,7 +608,7 @@ void MidiKeyboardComponent::resized() { auto kx1 = getKeyPos (rangeStart).getStart(); - if (kx2 - kx1 <= w) + if (kx2 - kx1 <= (float) w) { firstKey = (float) rangeStart; sendChangeMessage(); @@ -645,7 +645,7 @@ void MidiKeyboardComponent::resized() float mousePositionVelocity; auto spaceAvailable = w; - auto lastStartKey = remappedXYToNote ({ endOfLastKey - spaceAvailable, 0 }, mousePositionVelocity) + 1; + auto lastStartKey = remappedXYToNote ({ endOfLastKey - (float) spaceAvailable, 0 }, mousePositionVelocity) + 1; if (lastStartKey >= 0 && ((int) firstKey) > lastStartKey) { @@ -660,7 +660,7 @@ void MidiKeyboardComponent::resized() firstKey = (float) rangeStart; } - scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > w); + scrollUp->setVisible (canScroll && getKeyPos (rangeEnd).getStart() > (float) w); repaint(); } } diff --git a/modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h b/modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h index 3548248b66..baad6b684c 100644 --- a/modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h +++ b/modules/juce_blocks_basics/protocol/juce_BitPackingUtilities.h @@ -79,8 +79,8 @@ struct IntegerWithBitSize : (uint32) (value >> (numBits - 8))); } - float toUnipolarFloat() const noexcept { return value / (float) maxValue; } - float toBipolarFloat() const noexcept { return static_cast (value << (32 - numBits)) / (float) 0x80000000u; } + float toUnipolarFloat() const noexcept { return (float) value / (float) maxValue; } + float toBipolarFloat() const noexcept { return (float) static_cast (value << (32 - numBits)) / (float) 0x80000000u; } static IntegerWithBitSize fromUnipolarFloat (float value) noexcept { diff --git a/modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp b/modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp index c000b6e9cb..d8419d0411 100644 --- a/modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp +++ b/modules/juce_blocks_basics/topology/internal/juce_ConnectedDeviceGroup.cpp @@ -167,9 +167,9 @@ struct ConnectedDeviceGroup : private AsyncUpdater, TouchSurface::Touch touch; touch.index = (int) touchIndex.get(); - touch.x = position.x.toUnipolarFloat(); - touch.y = position.y.toUnipolarFloat(); - touch.z = position.z.toUnipolarFloat(); + touch.x = (float) position.x.toUnipolarFloat(); + touch.y = (float) position.y.toUnipolarFloat(); + touch.z = (float) position.z.toUnipolarFloat(); touch.xVelocity = velocity.vx.toBipolarFloat(); touch.yVelocity = velocity.vy.toBipolarFloat(); touch.zVelocity = velocity.vz.toBipolarFloat(); diff --git a/modules/juce_blocks_basics/topology/internal/juce_Detector.cpp b/modules/juce_blocks_basics/topology/internal/juce_Detector.cpp index b0857a36d3..00129e80c2 100644 --- a/modules/juce_blocks_basics/topology/internal/juce_Detector.cpp +++ b/modules/juce_blocks_basics/topology/internal/juce_Detector.cpp @@ -350,10 +350,10 @@ struct Detector : public ReferenceCountedObject, { TouchSurface::Touch scaledEvent (touchEvent); - scaledEvent.x *= block->getWidth(); - scaledEvent.y *= block->getHeight(); - scaledEvent.startX *= block->getWidth(); - scaledEvent.startY *= block->getHeight(); + scaledEvent.x *= (float) block->getWidth(); + scaledEvent.y *= (float) block->getHeight(); + scaledEvent.startX *= (float) block->getWidth(); + scaledEvent.startY *= (float) block->getHeight(); surface->broadcastTouchChange (scaledEvent); } diff --git a/modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp b/modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp index 6459c76d20..444d77343a 100644 --- a/modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp +++ b/modules/juce_blocks_basics/visualisers/juce_DrumPadLEDProgram.cpp @@ -27,14 +27,14 @@ DrumPadGridProgram::DrumPadGridProgram (Block& b) : Program (b) {} int DrumPadGridProgram::getPadIndex (float posX, float posY) const { - posX = jmin (0.99f, posX / block.getWidth()); - posY = jmin (0.99f, posY / block.getHeight()); + posX = jmin (0.99f, posX / (float) block.getWidth()); + posY = jmin (0.99f, posY / (float) block.getHeight()); const uint32 offset = block.getDataByte (visiblePads_byte) ? numColumns1_byte : numColumns0_byte; const int numColumns = block.getDataByte (offset + numColumns0_byte); const int numRows = block.getDataByte (offset + numRows0_byte); - return int (posX * numColumns) + int (posY * numRows) * numColumns; + return int (posX * (float) numColumns) + int (posY * (float) numRows) * numColumns; } void DrumPadGridProgram::startTouch (float startX, float startY) @@ -65,8 +65,8 @@ void DrumPadGridProgram::sendTouch (float x, float y, float z, LEDColour colour) Block::ProgramEventMessage e; e.values[0] = 0x20000000 - + (jlimit (0, 255, roundToInt (x * (255.0f / block.getWidth()))) << 16) - + (jlimit (0, 255, roundToInt (y * (255.0f / block.getHeight()))) << 8) + + (jlimit (0, 255, roundToInt (x * (255.0f / (float) block.getWidth()))) << 16) + + (jlimit (0, 255, roundToInt (y * (255.0f / (float) block.getHeight()))) << 8) + jlimit (0, 255, roundToInt (z * 255.0f)); e.values[1] = (int32) colour.getARGB(); diff --git a/modules/juce_core/files/juce_DirectoryIterator.cpp b/modules/juce_core/files/juce_DirectoryIterator.cpp index 7f538ee6a3..37452e8c76 100644 --- a/modules/juce_core/files/juce_DirectoryIterator.cpp +++ b/modules/juce_core/files/juce_DirectoryIterator.cpp @@ -159,10 +159,10 @@ float DirectoryIterator::getEstimatedProgress() const if (totalNumFiles <= 0) return 0.0f; - auto detailedIndex = (subIterator != nullptr) ? index + subIterator->getEstimatedProgress() + auto detailedIndex = (subIterator != nullptr) ? (float) index + subIterator->getEstimatedProgress() : (float) index; - return jlimit (0.0f, 1.0f, detailedIndex / totalNumFiles); + return jlimit (0.0f, 1.0f, detailedIndex / (float) totalNumFiles); } } // namespace juce diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 4e378a4910..79d9d8e553 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -485,7 +485,7 @@ String File::descriptionOfSizeInBytes (const int64 bytes) else if (bytes < 1024 * 1024 * 1024) { suffix = " MB"; divisor = 1024.0 * 1024.0; } else { suffix = " GB"; divisor = 1024.0 * 1024.0 * 1024.0; } - return (divisor > 0 ? String (bytes / divisor, 1) : String (bytes)) + suffix; + return (divisor > 0 ? String ((double) bytes / divisor, 1) : String (bytes)) + suffix; } //============================================================================== diff --git a/modules/juce_core/javascript/juce_Javascript.cpp b/modules/juce_core/javascript/juce_Javascript.cpp index 77cb2d9811..9fe380c468 100644 --- a/modules/juce_core/javascript/juce_Javascript.cpp +++ b/modules/juce_core/javascript/juce_Javascript.cpp @@ -594,7 +594,7 @@ struct JavascriptEngine::RootObject : public DynamicObject { DivideOp (const CodeLocation& l, ExpPtr& a, ExpPtr& b) noexcept : BinaryOperator (l, a, b, TokenTypes::divide) {} var getWithDoubles (double a, double b) const override { return b != 0 ? a / b : std::numeric_limits::infinity(); } - var getWithInts (int64 a, int64 b) const override { return b != 0 ? var (a / (double) b) : var (std::numeric_limits::infinity()); } + var getWithInts (int64 a, int64 b) const override { return b != 0 ? var ((double) a / (double) b) : var (std::numeric_limits::infinity()); } }; struct ModuloOp : public BinaryOperator diff --git a/modules/juce_core/maths/juce_Random.cpp b/modules/juce_core/maths/juce_Random.cpp index 37c17b6b2b..c2b75d478b 100644 --- a/modules/juce_core/maths/juce_Random.cpp +++ b/modules/juce_core/maths/juce_Random.cpp @@ -105,7 +105,7 @@ bool Random::nextBool() noexcept float Random::nextFloat() noexcept { - auto result = static_cast (nextInt()) + auto result = static_cast (static_cast (nextInt())) / (static_cast (std::numeric_limits::max()) + 1.0f); return result == 1.0f ? 1.0f - std::numeric_limits::epsilon() : result; } diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp index 7ea5fcef0c..3fe5a83c60 100644 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -209,7 +209,7 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept double Time::getMillisecondCounterHiRes() noexcept { - return getHighResolutionTicks() * 0.001; + return (double) getHighResolutionTicks() * 0.001; } bool Time::setSystemTimeToThisTime() const diff --git a/modules/juce_core/time/juce_PerformanceCounter.cpp b/modules/juce_core/time/juce_PerformanceCounter.cpp index 9c038b447a..546cbb30ae 100644 --- a/modules/juce_core/time/juce_PerformanceCounter.cpp +++ b/modules/juce_core/time/juce_PerformanceCounter.cpp @@ -124,7 +124,7 @@ PerformanceCounter::Statistics PerformanceCounter::getStatisticsAndReset() stats.clear(); if (s.numRuns > 0) - s.averageSeconds = s.totalSeconds / s.numRuns; + s.averageSeconds = s.totalSeconds / (float) s.numRuns; return s; } diff --git a/modules/juce_core/time/juce_RelativeTime.cpp b/modules/juce_core/time/juce_RelativeTime.cpp index cbbf8830b2..c9a2514b66 100644 --- a/modules/juce_core/time/juce_RelativeTime.cpp +++ b/modules/juce_core/time/juce_RelativeTime.cpp @@ -28,8 +28,8 @@ RelativeTime::RelativeTime (const RelativeTime& other) noexcept : numSeconds ( RelativeTime::~RelativeTime() noexcept {} //============================================================================== -RelativeTime RelativeTime::milliseconds (int milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } -RelativeTime RelativeTime::milliseconds (int64 milliseconds) noexcept { return RelativeTime (milliseconds * 0.001); } +RelativeTime RelativeTime::milliseconds (int milliseconds) noexcept { return RelativeTime ((double) milliseconds * 0.001); } +RelativeTime RelativeTime::milliseconds (int64 milliseconds) noexcept { return RelativeTime ((double) milliseconds * 0.001); } RelativeTime RelativeTime::seconds (double s) noexcept { return RelativeTime (s); } RelativeTime RelativeTime::minutes (double numberOfMinutes) noexcept { return RelativeTime (numberOfMinutes * 60.0); } RelativeTime RelativeTime::hours (double numberOfHours) noexcept { return RelativeTime (numberOfHours * (60.0 * 60.0)); } diff --git a/modules/juce_core/time/juce_Time.cpp b/modules/juce_core/time/juce_Time.cpp index ca1c2653a7..ecbdbf149c 100644 --- a/modules/juce_core/time/juce_Time.cpp +++ b/modules/juce_core/time/juce_Time.cpp @@ -277,7 +277,7 @@ void Time::waitForMillisecondCounter (uint32 targetTime) noexcept //============================================================================== double Time::highResolutionTicksToSeconds (const int64 ticks) noexcept { - return ticks / (double) getHighResolutionTicksPerSecond(); + return (double) ticks / (double) getHighResolutionTicksPerSecond(); } int64 Time::secondsToHighResolutionTicks (const double seconds) noexcept diff --git a/modules/juce_dsp/filter_design/juce_FilterDesign.cpp b/modules/juce_dsp/filter_design/juce_FilterDesign.cpp index a9e515fda8..f1acc87af4 100644 --- a/modules/juce_dsp/filter_design/juce_FilterDesign.cpp +++ b/modules/juce_dsp/filter_design/juce_FilterDesign.cpp @@ -45,7 +45,7 @@ typename FIR::Coefficients::Ptr for (size_t i = 0; i <= order; ++i) { - if (i == order * 0.5) + if (i == order / 2) { c[i] = static_cast (normalisedFrequency * 2); } @@ -113,8 +113,8 @@ typename FIR::Coefficients::Ptr } else { - auto indice = MathConstants::pi * (i - 0.5 * order); - auto indice2 = MathConstants::pi * normalisedTransitionWidth * (i - 0.5 * order) / spline; + auto indice = MathConstants::pi * ((double) i - 0.5 * (double) order); + auto indice2 = MathConstants::pi * normalisedTransitionWidth * ((double) i - 0.5 * (double) order) / spline; c[i] = static_cast (std::sin (2 * indice * normalisedFrequency) / indice * std::pow (std::sin (indice2) / indice2, spline)); } @@ -160,12 +160,12 @@ typename FIR::Coefficients::Ptr auto factors = ws / MathConstants::pi; for (size_t i = 0; i <= M; ++i) - b (i, 0) = factorp * sinc (factorp * i); + b (i, 0) = factorp * sinc (factorp * (double) i); q (0, 0) = factorp + stopBandWeight * (1.0 - factors); for (size_t i = 1; i <= 2 * M; ++i) - q (i, 0) = factorp * sinc (factorp * i) - stopBandWeight * factors * sinc (factors * i); + q (i, 0) = factorp * sinc (factorp * (double) i) - stopBandWeight * factors * sinc (factors * (double) i); auto Q1 = Matrix::toeplitz (q, M + 1); auto Q2 = Matrix::hankel (q, M + 1, 0); @@ -198,12 +198,12 @@ typename FIR::Coefficients::Ptr auto factors = ws / MathConstants::pi; for (size_t i = 0; i < M; ++i) - b (i, 0) = factorp * sinc (factorp * (i + 0.5)); + b (i, 0) = factorp * sinc (factorp * ((double) i + 0.5)); for (size_t i = 0; i < 2 * M; ++i) { - qp (i, 0) = 0.25 * factorp * sinc (factorp * i); - qs (i, 0) = -0.25 * stopBandWeight * factors * sinc (factors * i); + qp (i, 0) = 0.25 * factorp * sinc (factorp * (double) i); + qs (i, 0) = -0.25 * stopBandWeight * factors * sinc (factors * (double) i); } auto Q1p = Matrix::toeplitz (qp, M); diff --git a/modules/juce_dsp/frequency/juce_FFT.cpp b/modules/juce_dsp/frequency/juce_FFT.cpp index 0d0633cf76..ec7c91a468 100644 --- a/modules/juce_dsp/frequency/juce_FFT.cpp +++ b/modules/juce_dsp/frequency/juce_FFT.cpp @@ -113,7 +113,7 @@ struct FFTFallback : public FFT::Instance { configInverse->perform (input, output); - const float scaleFactor = 1.0f / size; + const float scaleFactor = 1.0f / (float) size; for (int i = 0; i < size; ++i) output[i] *= scaleFactor; diff --git a/modules/juce_dsp/frequency/juce_Windowing.cpp b/modules/juce_dsp/frequency/juce_Windowing.cpp index 41ae2ef490..13097817e0 100644 --- a/modules/juce_dsp/frequency/juce_Windowing.cpp +++ b/modules/juce_dsp/frequency/juce_Windowing.cpp @@ -136,10 +136,11 @@ void WindowingFunction::fillWindowingTables (FloatType* samples, size case kaiser: { const double factor = 1.0 / SpecialFunctions::besselI0 (beta); + const auto doubleSize = (double) size; for (size_t i = 0; i < size; ++i) - samples[i] = static_cast (SpecialFunctions::besselI0 (beta * std::sqrt (1.0 - std::pow ((i - 0.5 * (size - 1.0)) - / ( 0.5 * (size - 1.0)), 2.0))) + samples[i] = static_cast (SpecialFunctions::besselI0 (beta * std::sqrt (1.0 - std::pow (((double) i - 0.5 * (doubleSize - 1.0)) + / ( 0.5 * (doubleSize - 1.0)), 2.0))) * factor); } break; diff --git a/modules/juce_dsp/maths/juce_LookupTable.h b/modules/juce_dsp/maths/juce_LookupTable.h index 4a43cd9ec7..5ef84e208d 100644 --- a/modules/juce_dsp/maths/juce_LookupTable.h +++ b/modules/juce_dsp/maths/juce_LookupTable.h @@ -122,7 +122,7 @@ public: */ FloatType get (FloatType index) const noexcept { - if (index >= getNumPoints()) + if (index >= (FloatType) getNumPoints()) index = static_cast (getGuardIndex()); else if (index < 0) index = {}; diff --git a/modules/juce_dsp/processors/juce_Oversampling.cpp b/modules/juce_dsp/processors/juce_Oversampling.cpp index 467d8a7a0c..9e258990f9 100644 --- a/modules/juce_dsp/processors/juce_Oversampling.cpp +++ b/modules/juce_dsp/processors/juce_Oversampling.cpp @@ -563,8 +563,8 @@ Oversampling::Oversampling (size_t newNumChannels, size_t newFactor, auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f); addOversamplingStage (FilterType::filterHalfBandPolyphaseIIR, - twUp, gaindBStartUp + gaindBFactorUp * n, - twDown, gaindBStartDown + gaindBFactorDown * n); + twUp, gaindBStartUp + gaindBFactorUp * (float) n, + twDown, gaindBStartDown + gaindBFactorDown * (float) n); } } else if (newType == FilterType::filterHalfBandFIREquiripple) @@ -580,8 +580,8 @@ Oversampling::Oversampling (size_t newNumChannels, size_t newFactor, auto gaindBFactorDown = (isMaximumQuality ? 10.0f : 8.0f); addOversamplingStage (FilterType::filterHalfBandFIREquiripple, - twUp, gaindBStartUp + gaindBFactorUp * n, - twDown, gaindBStartDown + gaindBFactorDown * n); + twUp, gaindBStartUp + gaindBFactorUp * (float) n, + twDown, gaindBStartDown + gaindBFactorDown * (float) n); } } } diff --git a/modules/juce_graphics/colour/juce_Colour.cpp b/modules/juce_graphics/colour/juce_Colour.cpp index 1826cab217..007a2f3645 100644 --- a/modules/juce_graphics/colour/juce_Colour.cpp +++ b/modules/juce_graphics/colour/juce_Colour.cpp @@ -46,11 +46,11 @@ namespace ColourHelpers if (hi > 0) { - auto invDiff = 1.0f / (hi - lo); + auto invDiff = 1.0f / (float) (hi - lo); - auto red = (hi - r) * invDiff; - auto green = (hi - g) * invDiff; - auto blue = (hi - b) * invDiff; + auto red = (float) (hi - r) * invDiff; + auto green = (float) (hi - g) * invDiff; + auto blue = (float) (hi - b) * invDiff; if (r == hi) hue = blue - green; else if (g == hi) hue = 2.0f + red - blue; @@ -79,12 +79,12 @@ namespace ColourHelpers if (hi > 0) { - lightness = ((hi + lo) / 2.0f) / 255.0f; + lightness = ((float) (hi + lo) / 2.0f) / 255.0f; if (lightness > 0.0f) hue = getHue (col); - saturation = (hi - lo) / (1.0f - std::abs ((2.0f * lightness) - 1.0f)); + saturation = (float) (hi - lo) / (1.0f - std::abs ((2.0f * lightness) - 1.0f)); } } @@ -136,12 +136,12 @@ namespace ColourHelpers if (hi > 0) { - saturation = (hi - lo) / (float) hi; + saturation = (float) (hi - lo) / (float) hi; if (saturation > 0.0f) hue = getHue (col); - brightness = hi / 255.0f; + brightness = (float) hi / 255.0f; } } diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index 12a6443097..d82dd34b79 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -532,10 +532,10 @@ void Graphics::fillCheckerBoard (Rectangle area, float checkWidth, float if (! clipped.isEmpty()) { - const int checkNumX = (int) ((clipped.getX() - area.getX()) / checkWidth); - const int checkNumY = (int) ((clipped.getY() - area.getY()) / checkHeight); - const float startX = area.getX() + checkNumX * checkWidth; - const float startY = area.getY() + checkNumY * checkHeight; + const int checkNumX = (int) (((float) clipped.getX() - area.getX()) / checkWidth); + const int checkNumY = (int) (((float) clipped.getY() - area.getY()) / checkHeight); + const float startX = area.getX() + (float) checkNumX * checkWidth; + const float startY = area.getY() + (float) checkNumY * checkHeight; const float right = (float) clipped.getRight(); const float bottom = (float) clipped.getBottom(); @@ -666,7 +666,7 @@ void Graphics::drawImage (const Image& imageToDraw, { if (imageToDraw.isValid() && context.clipRegionIntersects (coordsToRectangle (dx, dy, dw, dh))) drawImageTransformed (imageToDraw.getClippedImage (coordsToRectangle (sx, sy, sw, sh)), - AffineTransform::scale (dw / (float) sw, dh / (float) sh) + AffineTransform::scale ((float) dw / (float) sw, (float) dh / (float) sh) .translated ((float) dx, (float) dy), fillAlphaChannelWithCurrentBrush); } diff --git a/modules/juce_graphics/contexts/juce_LowLevelGraphicsPostScriptRenderer.cpp b/modules/juce_graphics/contexts/juce_LowLevelGraphicsPostScriptRenderer.cpp index 3b0fe28908..f66dde13e5 100644 --- a/modules/juce_graphics/contexts/juce_LowLevelGraphicsPostScriptRenderer.cpp +++ b/modules/juce_graphics/contexts/juce_LowLevelGraphicsPostScriptRenderer.cpp @@ -50,7 +50,7 @@ LowLevelGraphicsPostScriptRenderer::LowLevelGraphicsPostScriptRenderer (OutputSt stateStack.add (new SavedState()); stateStack.getLast()->clip = Rectangle (totalWidth_, totalHeight_); - const float scale = jmin ((520.0f / totalWidth_), (750.0f / totalHeight)); + const float scale = jmin ((520.0f / (float) totalWidth_), (750.0f / (float) totalHeight)); out << "%!PS-Adobe-3.0 EPSF-3.0" "\n%%BoundingBox: 0 0 600 824" diff --git a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp index 28959dcf1d..3502902b40 100644 --- a/modules/juce_graphics/effects/juce_DropShadowEffect.cpp +++ b/modules/juce_graphics/effects/juce_DropShadowEffect.cpp @@ -133,8 +133,8 @@ void DropShadow::drawForRectangle (Graphics& g, const Rectangle& targetArea for (float i = 0.05f; i < 1.0f; i += 0.1f) cg.addColour (1.0 - i, colour.withMultipliedAlpha (i * i)); - const float radiusInset = radius / 2.0f; - const float expandedRadius = radius + radiusInset; + const float radiusInset = (float) radius / 2.0f; + const float expandedRadius = (float) radius + radiusInset; auto area = targetArea.toFloat().reduced (radiusInset) + offset.toFloat(); @@ -169,10 +169,10 @@ void DropShadowEffect::setShadowProperties (const DropShadow& newShadow) void DropShadowEffect::applyEffect (Image& image, Graphics& g, float scaleFactor, float alpha) { DropShadow s (shadow); - s.radius = roundToInt (s.radius * scaleFactor); + s.radius = roundToInt ((float) s.radius * scaleFactor); s.colour = s.colour.withMultipliedAlpha (alpha); - s.offset.x = roundToInt (s.offset.x * scaleFactor); - s.offset.y = roundToInt (s.offset.y * scaleFactor); + s.offset.x = roundToInt ((float) s.offset.x * scaleFactor); + s.offset.y = roundToInt ((float) s.offset.y * scaleFactor); s.drawForImage (g, image); diff --git a/modules/juce_graphics/fonts/juce_Font.cpp b/modules/juce_graphics/fonts/juce_Font.cpp index 2612cd4a3f..4a08265e55 100644 --- a/modules/juce_graphics/fonts/juce_Font.cpp +++ b/modules/juce_graphics/fonts/juce_Font.cpp @@ -636,7 +636,7 @@ float Font::getStringWidthFloat (const String& text) const auto w = getTypeface()->getStringWidth (text); if (font->kerning != 0.0f) - w += font->kerning * text.length(); + w += font->kerning * (float) text.length(); return w * font->height * font->horizontalScale; } @@ -657,7 +657,7 @@ void Font::getGlyphPositions (const String& text, Array& glyphs, Arraykerning != 0.0f) { for (int i = 0; i < num; ++i) - x[i] = (x[i] + i * font->kerning) * scale; + x[i] = (x[i] + (float) i * font->kerning) * scale; } else { diff --git a/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp b/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp index 6830b37e23..50984ac178 100644 --- a/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp +++ b/modules/juce_graphics/fonts/juce_GlyphArrangement.cpp @@ -581,7 +581,7 @@ void GlyphArrangement::splitLines (const String& text, Font font, int startIndex // allowing for unevenness in the lengths due to differently sized words. const float lineLengthUnevennessAllowance = 80.0f; - if (numLines > (lineWidth + lineLengthUnevennessAllowance) / width || newFontHeight < 8.0f) + if ((float) numLines > (lineWidth + lineLengthUnevennessAllowance) / width || newFontHeight < 8.0f) break; } @@ -591,7 +591,7 @@ void GlyphArrangement::splitLines (const String& text, Font font, int startIndex int lineIndex = 0; auto lineY = y; auto widthPerLine = jmin (width / minimumHorizontalScale, - lineWidth / numLines); + lineWidth / (float) numLines); while (lineY < y + height) { diff --git a/modules/juce_graphics/fonts/juce_TextLayout.cpp b/modules/juce_graphics/fonts/juce_TextLayout.cpp index 288676d008..3755e7e595 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.cpp +++ b/modules/juce_graphics/fonts/juce_TextLayout.cpp @@ -224,8 +224,8 @@ void TextLayout::draw (Graphics& g, Rectangle area) const context.saveState(); auto clip = context.getClipBounds(); - auto clipTop = clip.getY() - origin.y; - auto clipBottom = clip.getBottom() - origin.y; + auto clipTop = (float) clip.getY() - origin.y; + auto clipBottom = (float) clip.getBottom() - origin.y; for (auto& line : *this) { diff --git a/modules/juce_graphics/fonts/juce_Typeface.cpp b/modules/juce_graphics/fonts/juce_Typeface.cpp index 8a5eae091c..71e2baba99 100644 --- a/modules/juce_graphics/fonts/juce_Typeface.cpp +++ b/modules/juce_graphics/fonts/juce_Typeface.cpp @@ -242,7 +242,7 @@ private: } } - return num < 4 ? 0.0f : total / (num * (float) standardHeight); + return num < 4 ? 0.0f : total / ((float) num * (float) standardHeight); } enum { standardHeight = 100 }; diff --git a/modules/juce_graphics/geometry/juce_Path.cpp b/modules/juce_graphics/geometry/juce_Path.cpp index a56f4b0f78..eb7d04efd6 100644 --- a/modules/juce_graphics/geometry/juce_Path.cpp +++ b/modules/juce_graphics/geometry/juce_Path.cpp @@ -615,11 +615,11 @@ void Path::addPolygon (Point centre, int numberOfSides, if (numberOfSides > 1) { - auto angleBetweenPoints = MathConstants::twoPi / numberOfSides; + auto angleBetweenPoints = MathConstants::twoPi / (float) numberOfSides; for (int i = 0; i < numberOfSides; ++i) { - auto angle = startAngle + i * angleBetweenPoints; + auto angle = startAngle + (float) i * angleBetweenPoints; auto p = centre.getPointOnCircumference (radius, angle); if (i == 0) @@ -639,11 +639,11 @@ void Path::addStar (Point centre, int numberOfPoints, float innerRadius, if (numberOfPoints > 1) { - auto angleBetweenPoints = MathConstants::twoPi / numberOfPoints; + auto angleBetweenPoints = MathConstants::twoPi / (float) numberOfPoints; for (int i = 0; i < numberOfPoints; ++i) { - auto angle = startAngle + i * angleBetweenPoints; + auto angle = startAngle + (float) i * angleBetweenPoints; auto p = centre.getPointOnCircumference (outerRadius, angle); if (i == 0) diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index 8b9086df74..abc5dc4a7a 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -121,11 +121,11 @@ public: /** Returns a point whose coordinates are multiplied by a given scalar value. */ template - constexpr Point operator* (FloatType multiplier) const noexcept { return Point ((ValueType) (x * multiplier), (ValueType) (y * multiplier)); } + constexpr Point operator* (FloatType multiplier) const noexcept { return Point ((ValueType) ((FloatType) x * multiplier), (ValueType) ((FloatType) y * multiplier)); } /** Returns a point whose coordinates are divided by a given scalar value. */ template - constexpr Point operator/ (FloatType divisor) const noexcept { return Point ((ValueType) (x / divisor), (ValueType) (y / divisor)); } + constexpr Point operator/ (FloatType divisor) const noexcept { return Point ((ValueType) ((FloatType) x / divisor), (ValueType) ((FloatType) y / divisor)); } /** Multiplies the point's coordinates by a scalar value. */ template @@ -212,8 +212,8 @@ public: /** Returns the position of this point, if it is transformed by a given AffineTransform. */ Point transformedBy (const AffineTransform& transform) const noexcept { - return Point (static_cast (transform.mat00 * x + transform.mat01 * y + transform.mat02), - static_cast (transform.mat10 * x + transform.mat11 * y + transform.mat12)); + return Point (static_cast (transform.mat00 * (float) x + transform.mat01 * (float) y + transform.mat02), + static_cast (transform.mat10 * (float) x + transform.mat11 * (float) y + transform.mat12)); } //============================================================================== diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index 640d5f496f..ac1fa8d329 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -349,10 +349,10 @@ public: template Rectangle operator*= (FloatType scaleFactor) noexcept { - Rectangle (pos.x * scaleFactor, - pos.y * scaleFactor, - w * scaleFactor, - h * scaleFactor).copyWithRounding (*this); + Rectangle ((FloatType) pos.x * scaleFactor, + (FloatType) pos.y * scaleFactor, + (FloatType) w * scaleFactor, + (FloatType) h * scaleFactor).copyWithRounding (*this); return *this; } @@ -364,10 +364,10 @@ public: template Rectangle operator*= (Point scaleFactor) noexcept { - Rectangle (pos.x * scaleFactor.x, - pos.y * scaleFactor.y, - w * scaleFactor.x, - h * scaleFactor.y).copyWithRounding (*this); + Rectangle ((FloatType) pos.x * scaleFactor.x, + (FloatType) pos.y * scaleFactor.y, + (FloatType) w * scaleFactor.x, + (FloatType) h * scaleFactor.y).copyWithRounding (*this); return *this; } @@ -384,10 +384,10 @@ public: template Rectangle operator/= (FloatType scaleFactor) noexcept { - Rectangle (pos.x / scaleFactor, - pos.y / scaleFactor, - w / scaleFactor, - h / scaleFactor).copyWithRounding (*this); + Rectangle ((FloatType) pos.x / scaleFactor, + (FloatType) pos.y / scaleFactor, + (FloatType) w / scaleFactor, + (FloatType) h / scaleFactor).copyWithRounding (*this); return *this; } @@ -395,10 +395,10 @@ public: template Rectangle operator/= (Point scaleFactor) noexcept { - Rectangle (pos.x / scaleFactor.x, - pos.y / scaleFactor.y, - w / scaleFactor.x, - h / scaleFactor.y).copyWithRounding (*this); + Rectangle ((FloatType) pos.x / scaleFactor.x, + (FloatType) pos.y / scaleFactor.y, + (FloatType) w / scaleFactor.x, + (FloatType) h / scaleFactor.y).copyWithRounding (*this); return *this; } @@ -552,22 +552,22 @@ public: template Point getRelativePoint (FloatType relativeX, FloatType relativeY) const noexcept { - return { pos.x + static_cast (w * relativeX), - pos.y + static_cast (h * relativeY) }; + return { pos.x + static_cast ((FloatType) w * relativeX), + pos.y + static_cast ((FloatType) h * relativeY) }; } /** Returns a proportion of the width of this rectangle. */ template ValueType proportionOfWidth (FloatType proportion) const noexcept { - return static_cast (w * proportion); + return static_cast ((FloatType) w * proportion); } /** Returns a proportion of the height of this rectangle. */ template ValueType proportionOfHeight (FloatType proportion) const noexcept { - return static_cast (h * proportion); + return static_cast ((FloatType) h * proportion); } /** Returns a rectangle based on some proportional coordinates relative to this one. diff --git a/modules/juce_graphics/images/juce_Image.cpp b/modules/juce_graphics/images/juce_Image.cpp index 43a0d3670f..f6560e30c0 100644 --- a/modules/juce_graphics/images/juce_Image.cpp +++ b/modules/juce_graphics/images/juce_Image.cpp @@ -309,8 +309,8 @@ Image Image::rescaled (int newWidth, int newHeight, Graphics::ResamplingQuality Graphics g (newImage); g.setImageResamplingQuality (quality); - g.drawImageTransformed (*this, AffineTransform::scale (newWidth / (float) image->width, - newHeight / (float) image->height), false); + g.drawImageTransformed (*this, AffineTransform::scale ((float) newWidth / (float) image->width, + (float) newHeight / (float) image->height), false); return newImage; } diff --git a/modules/juce_graphics/native/juce_freetype_Fonts.cpp b/modules/juce_graphics/native/juce_freetype_Fonts.cpp index 793fa44bcf..a74e630cce 100644 --- a/modules/juce_graphics/native/juce_freetype_Fonts.cpp +++ b/modules/juce_graphics/native/juce_freetype_Fonts.cpp @@ -197,7 +197,7 @@ public: { for (auto& path : paths) { - for (const auto iter : RangedDirectoryIterator (File::getCurrentWorkingDirectory().getChildFile (path), true)) + for (const auto& iter : RangedDirectoryIterator (File::getCurrentWorkingDirectory().getChildFile (path), true)) if (iter.getFile().hasFileExtension ("ttf;pfb;pcf;otf")) scanFont (iter.getFile()); } @@ -325,7 +325,7 @@ public: if (getGlyphShape (destShape, face->glyph->outline, scale)) { - addGlyph (character, destShape, face->glyph->metrics.horiAdvance * scale); + addGlyph (character, destShape, (float) face->glyph->metrics.horiAdvance * scale); if ((face->face_flags & FT_FACE_FLAG_KERNING) != 0) addKerning (face, (uint32) character, glyphIndex); @@ -355,15 +355,15 @@ private: for (int p = startPoint; p <= endPoint; ++p) { - auto x = scaleX * points[p].x; - auto y = scaleY * points[p].y; + auto x = scaleX * (float) points[p].x; + auto y = scaleY * (float) points[p].y; if (p == startPoint) { if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_Conic) { - auto x2 = scaleX * points [endPoint].x; - auto y2 = scaleY * points [endPoint].y; + auto x2 = scaleX * (float) points[endPoint].x; + auto y2 = scaleY * (float) points[endPoint].y; if (FT_CURVE_TAG (tags[endPoint]) != FT_Curve_Tag_On) { @@ -387,8 +387,8 @@ private: else if (FT_CURVE_TAG (tags[p]) == FT_Curve_Tag_Conic) { const int nextIndex = (p == endPoint) ? startPoint : p + 1; - auto x2 = scaleX * points [nextIndex].x; - auto y2 = scaleY * points [nextIndex].y; + auto x2 = scaleX * (float) points[nextIndex].x; + auto y2 = scaleY * (float) points[nextIndex].y; if (FT_CURVE_TAG (tags [nextIndex]) == FT_Curve_Tag_Conic) { @@ -412,10 +412,10 @@ private: || FT_CURVE_TAG (tags[next2]) != FT_Curve_Tag_On) return false; - auto x2 = scaleX * points [next1].x; - auto y2 = scaleY * points [next1].y; - auto x3 = scaleX * points [next2].x; - auto y3 = scaleY * points [next2].y; + auto x2 = scaleX * (float) points[next1].x; + auto y2 = scaleY * (float) points[next1].y; + auto x3 = scaleX * (float) points[next2].x; + auto y3 = scaleY * (float) points[next2].y; destShape.cubicTo (x, y, x2, y2, x3, y3); p += 2; @@ -441,7 +441,7 @@ private: if (FT_Get_Kerning (face, glyphIndex, rightGlyphIndex, ft_kerning_unscaled, &kerning) == 0 && kerning.x != 0) - addKerningPair ((juce_wchar) character, (juce_wchar) rightCharCode, kerning.x / height); + addKerningPair ((juce_wchar) character, (juce_wchar) rightCharCode, (float) kerning.x / height); rightCharCode = FT_Get_Next_Char (face, rightCharCode, &rightGlyphIndex); } diff --git a/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp b/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp index 2ea421ad1d..81463ed4a7 100644 --- a/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp @@ -40,7 +40,7 @@ void ArrowButton::paintButton (Graphics& g, bool /*shouldDrawButtonAsHighlighted Path p (path); const float offset = shouldDrawButtonAsDown ? 1.0f : 0.0f; - p.applyTransform (path.getTransformToScaleToFit (offset, offset, getWidth() - 3.0f, getHeight() - 3.0f, false)); + p.applyTransform (path.getTransformToScaleToFit (offset, offset, (float) getWidth() - 3.0f, (float) getHeight() - 3.0f, false)); DropShadow (Colours::black.withAlpha (0.3f), shouldDrawButtonAsDown ? 2 : 4, Point()).drawForPath (g, p); diff --git a/modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp b/modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp index 49975ac730..81664b2d1f 100644 --- a/modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp @@ -71,7 +71,7 @@ void HyperlinkButton::setURL (const URL& newURL) noexcept Font HyperlinkButton::getFontToUse() const { if (resizeFont) - return font.withHeight (getHeight() * 0.7f); + return font.withHeight ((float) getHeight() * 0.7f); return font; } diff --git a/modules/juce_gui_basics/buttons/juce_ImageButton.cpp b/modules/juce_gui_basics/buttons/juce_ImageButton.cpp index 5e7f09efa2..f3fac83d80 100644 --- a/modules/juce_gui_basics/buttons/juce_ImageButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_ImageButton.cpp @@ -133,18 +133,18 @@ void ImageButton::paintButton (Graphics& g, if (preserveProportions) { int newW, newH; - const float imRatio = ih / (float) iw; - const float destRatio = h / (float) w; + const float imRatio = (float) ih / (float) iw; + const float destRatio = (float) h / (float) w; if (imRatio > destRatio) { - newW = roundToInt (h / imRatio); + newW = roundToInt ((float) h / imRatio); newH = h; } else { newW = w; - newH = roundToInt (w * imRatio); + newH = roundToInt ((float) w * imRatio); } x = (w - newW) / 2; diff --git a/modules/juce_gui_basics/components/juce_Component.cpp b/modules/juce_gui_basics/components/juce_Component.cpp index 80f48abe98..25783bcec6 100644 --- a/modules/juce_gui_basics/components/juce_Component.cpp +++ b/modules/juce_gui_basics/components/juce_Component.cpp @@ -202,18 +202,18 @@ struct ScalingHelpers // judder when moving windows static Rectangle unscaledScreenPosToScaled (float scale, Rectangle pos) noexcept { - return scale != 1.0f ? Rectangle (roundToInt (pos.getX() / scale), - roundToInt (pos.getY() / scale), - roundToInt (pos.getWidth() / scale), - roundToInt (pos.getHeight() / scale)) : pos; + return scale != 1.0f ? Rectangle (roundToInt ((float) pos.getX() / scale), + roundToInt ((float) pos.getY() / scale), + roundToInt ((float) pos.getWidth() / scale), + roundToInt ((float) pos.getHeight() / scale)) : pos; } static Rectangle scaledScreenPosToUnscaled (float scale, Rectangle pos) noexcept { - return scale != 1.0f ? Rectangle (roundToInt (pos.getX() * scale), - roundToInt (pos.getY() * scale), - roundToInt (pos.getWidth() * scale), - roundToInt (pos.getHeight() * scale)) : pos; + return scale != 1.0f ? Rectangle (roundToInt ((float) pos.getX() * scale), + roundToInt ((float) pos.getY() * scale), + roundToInt ((float) pos.getWidth() * scale), + roundToInt ((float) pos.getHeight() * scale)) : pos; } template @@ -808,8 +808,8 @@ struct StandardCachedComponentImage : public CachedComponentImage validArea = compBounds; g.setColour (Colours::black.withAlpha (owner.getAlpha())); - g.drawImageTransformed (image, AffineTransform::scale (compBounds.getWidth() / (float) imageBounds.getWidth(), - compBounds.getHeight() / (float) imageBounds.getHeight()), false); + g.drawImageTransformed (image, AffineTransform::scale ((float) compBounds.getWidth() / (float) imageBounds.getWidth(), + (float) compBounds.getHeight() / (float) imageBounds.getHeight()), false); } bool invalidateAll() override { validArea.clear(); return true; } @@ -1026,8 +1026,8 @@ bool Component::isAlwaysOnTop() const noexcept } //============================================================================== -int Component::proportionOfWidth (float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getWidth()); } -int Component::proportionOfHeight (float proportion) const noexcept { return roundToInt (proportion * boundsRelativeToParent.getHeight()); } +int Component::proportionOfWidth (float proportion) const noexcept { return roundToInt (proportion * (float) boundsRelativeToParent.getWidth()); } +int Component::proportionOfHeight (float proportion) const noexcept { return roundToInt (proportion * (float) boundsRelativeToParent.getHeight()); } int Component::getParentWidth() const noexcept { @@ -1179,8 +1179,8 @@ void Component::setCentrePosition (int x, int y) { setCentrePosition ({ x void Component::setCentreRelative (float x, float y) { - setCentrePosition (roundToInt (getParentWidth() * x), - roundToInt (getParentHeight() * y)); + setCentrePosition (roundToInt ((float) getParentWidth() * x), + roundToInt ((float) getParentHeight() * y)); } void Component::setBoundsRelative (Rectangle target) @@ -1854,8 +1854,8 @@ void Component::internalRepaintUnchecked (Rectangle area, bool isEntireComp { // Tweak the scaling so that the component's integer size exactly aligns with the peer's scaled size auto peerBounds = peer->getBounds(); - auto scaled = area * Point (peerBounds.getWidth() / (float) getWidth(), - peerBounds.getHeight() / (float) getHeight()); + auto scaled = area * Point ((float) peerBounds.getWidth() / (float) getWidth(), + (float) peerBounds.getHeight() / (float) getHeight()); peer->repaint (affineTransform != nullptr ? scaled.transformedBy (*affineTransform) : scaled); } @@ -1981,8 +1981,8 @@ void Component::paintEntireComponent (Graphics& g, bool ignoreAlphaLevel) scaledBounds.getWidth(), scaledBounds.getHeight(), ! flags.opaqueFlag); { Graphics g2 (effectImage); - g2.addTransform (AffineTransform::scale (scaledBounds.getWidth() / (float) getWidth(), - scaledBounds.getHeight() / (float) getHeight())); + g2.addTransform (AffineTransform::scale ((float) scaledBounds.getWidth() / (float) getWidth(), + (float) scaledBounds.getHeight() / (float) getHeight())); paintComponentAndChildren (g2); } @@ -2032,16 +2032,16 @@ Image Component::createComponentSnapshot (Rectangle areaToGrab, if (r.isEmpty()) return {}; - auto w = roundToInt (scaleFactor * r.getWidth()); - auto h = roundToInt (scaleFactor * r.getHeight()); + auto w = roundToInt (scaleFactor * (float) r.getWidth()); + auto h = roundToInt (scaleFactor * (float) r.getHeight()); Image image (flags.opaqueFlag ? Image::RGB : Image::ARGB, w, h, true); Graphics g (image); if (w != getWidth() || h != getHeight()) - g.addTransform (AffineTransform::scale (w / (float) r.getWidth(), - h / (float) r.getHeight())); + g.addTransform (AffineTransform::scale ((float) w / (float) r.getWidth(), + (float) h / (float) r.getHeight())); g.setOrigin (-r.getPosition()); paintEntireComponent (g, true); diff --git a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp index 40976976ca..5158a7df6b 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp @@ -63,7 +63,7 @@ public: auto area = getLocalBounds(); text.createLayout (getLookAndFeel().createFileChooserHeaderText (getName(), instructions), - getWidth() - 12.0f); + (float) getWidth() - 12.0f); area.removeFromTop (roundToInt (text.getHeight()) + 10); diff --git a/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.cpp index 9974a737db..70ef0c426d 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.cpp @@ -129,7 +129,7 @@ void FileSearchPathListComponent::paintListBoxItem (int rowNumber, Graphics& g, g.fillAll (findColour (TextEditor::highlightColourId)); g.setColour (findColour (ListBox::textColourId)); - Font f (height * 0.7f); + Font f ((float) height * 0.7f); f.setHorizontalScale (0.9f); g.setFont (f); diff --git a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp index 1bdfbb93d1..84b18388ea 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp @@ -175,8 +175,8 @@ public: void paint (Graphics& g) override { g.setOpacity (1.0f); - g.drawImageTransformed (image, AffineTransform::scale (getWidth() / (float) jmax (1, image.getWidth()), - getHeight() / (float) jmax (1, image.getHeight())), false); + g.drawImageTransformed (image, AffineTransform::scale ((float) getWidth() / (float) jmax (1, image.getWidth()), + (float) getHeight() / (float) jmax (1, image.getHeight())), false); } private: diff --git a/modules/juce_gui_basics/layout/juce_Grid.cpp b/modules/juce_gui_basics/layout/juce_Grid.cpp index 46bd415c0c..82e43805f4 100644 --- a/modules/juce_gui_basics/layout/juce_Grid.cpp +++ b/modules/juce_gui_basics/layout/juce_Grid.cpp @@ -440,25 +440,25 @@ struct Grid::PlacementHelpers if (alignContent == Grid::AlignContent::spaceBetween) { - const auto shift = ((rowNumber - 1) * (calculation.remainingHeight / float(numberOfRows - 1))); + const auto shift = ((float) (rowNumber - 1) * (calculation.remainingHeight / float(numberOfRows - 1))); area.setY (area.getY() + shift); } if (justifyContent == Grid::JustifyContent::spaceBetween) { - const auto shift = ((columnNumber - 1) * (calculation.remainingWidth / float(numberOfColumns - 1))); + const auto shift = ((float) (columnNumber - 1) * (calculation.remainingWidth / float(numberOfColumns - 1))); area.setX (area.getX() + shift); } if (alignContent == Grid::AlignContent::spaceEvenly) { - const auto shift = (rowNumber * (calculation.remainingHeight / float(numberOfRows + 1))); + const auto shift = ((float) rowNumber * (calculation.remainingHeight / float(numberOfRows + 1))); area.setY (area.getY() + shift); } if (justifyContent == Grid::JustifyContent::spaceEvenly) { - const auto shift = (columnNumber * (calculation.remainingWidth / float(numberOfColumns + 1))); + const auto shift = ((float) columnNumber * (calculation.remainingWidth / float(numberOfColumns + 1))); area.setX (area.getX() + shift); } @@ -466,7 +466,7 @@ struct Grid::PlacementHelpers { const auto inbetweenShift = calculation.remainingHeight / float(numberOfRows); const auto sidesShift = inbetweenShift / 2; - auto shift = (rowNumber - 1) * inbetweenShift + sidesShift; + auto shift = (float) (rowNumber - 1) * inbetweenShift + sidesShift; area.setY (area.getY() + shift); } @@ -475,7 +475,7 @@ struct Grid::PlacementHelpers { const auto inbetweenShift = calculation.remainingWidth / float(numberOfColumns); const auto sidesShift = inbetweenShift / 2; - auto shift = (columnNumber - 1) * inbetweenShift + sidesShift; + auto shift = (float) (columnNumber - 1) * inbetweenShift + sidesShift; area.setX (area.getX() + shift); } diff --git a/modules/juce_gui_basics/layout/juce_Viewport.cpp b/modules/juce_gui_basics/layout/juce_Viewport.cpp index e0557af4bd..e37dd362f3 100644 --- a/modules/juce_gui_basics/layout/juce_Viewport.cpp +++ b/modules/juce_gui_basics/layout/juce_Viewport.cpp @@ -531,7 +531,7 @@ static int rescaleMouseWheelDistance (float distance, int singleStepSize) noexce if (distance == 0.0f) return 0; - distance *= 14.0f * singleStepSize; + distance *= 14.0f * (float) singleStepSize; return roundToInt (distance < 0 ? jmin (distance, -1.0f) : jmax (distance, 1.0f)); diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp index 542e123fdb..738fed8c1e 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp @@ -57,13 +57,13 @@ void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Co const int height = button.getHeight(); const float indent = 2.0f; - const int cornerSize = jmin (roundToInt (width * 0.4f), - roundToInt (height * 0.4f)); + const int cornerSize = jmin (roundToInt ((float) width * 0.4f), + roundToInt ((float) height * 0.4f)); Path p; p.addRoundedRectangle (indent, indent, - width - indent * 2.0f, - height - indent * 2.0f, + (float) width - indent * 2.0f, + (float) height - indent * 2.0f, (float) cornerSize); Colour bc (backgroundColour.withMultipliedSaturation (0.3f)); @@ -127,7 +127,7 @@ void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool s const int tickWidth = jmin (20, button.getHeight() - 4); - drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f, + drawTickBox (g, button, 4.0f, (float) (button.getHeight() - tickWidth) * 0.5f, (float) tickWidth, (float) tickWidth, button.getToggleState(), button.isEnabled(), @@ -135,7 +135,7 @@ void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool s shouldDrawButtonAsDown); g.setColour (button.findColour (ToggleButton::textColourId)); - g.setFont (jmin (15.0f, button.getHeight() * 0.6f)); + g.setFont (jmin (15.0f, (float) button.getHeight() * 0.6f)); if (! button.isEnabled()) g.setOpacity (0.5f); @@ -171,7 +171,7 @@ void LookAndFeel_V1::drawProgressBar (Graphics& g, ProgressBar& progressBar, if (textToShow.isNotEmpty()) { g.setColour (Colour::contrasting (background, foreground)); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawText (textToShow, 0, 0, width, height, Justification::centred, false); } @@ -191,22 +191,25 @@ void LookAndFeel_V1::drawScrollbarButton (Graphics& g, ScrollBar& bar, Path p; + const auto w = (float) width; + const auto h = (float) height; + if (buttonDirection == 0) - p.addTriangle (width * 0.5f, height * 0.2f, - width * 0.1f, height * 0.7f, - width * 0.9f, height * 0.7f); + p.addTriangle (w * 0.5f, h * 0.2f, + w * 0.1f, h * 0.7f, + w * 0.9f, h * 0.7f); else if (buttonDirection == 1) - p.addTriangle (width * 0.8f, height * 0.5f, - width * 0.3f, height * 0.1f, - width * 0.3f, height * 0.9f); + p.addTriangle (w * 0.8f, h * 0.5f, + w * 0.3f, h * 0.1f, + w * 0.3f, h * 0.9f); else if (buttonDirection == 2) - p.addTriangle (width * 0.5f, height * 0.8f, - width * 0.1f, height * 0.3f, - width * 0.9f, height * 0.3f); + p.addTriangle (w * 0.5f, h * 0.8f, + w * 0.1f, h * 0.3f, + w * 0.9f, h * 0.3f); else if (buttonDirection == 3) - p.addTriangle (width * 0.2f, height * 0.5f, - width * 0.7f, height * 0.1f, - width * 0.7f, height * 0.9f); + p.addTriangle (w * 0.2f, h * 0.5f, + w * 0.7f, h * 0.1f, + w * 0.7f, h * 0.9f); if (shouldDrawButtonAsDown) g.setColour (Colours::white); @@ -231,15 +234,15 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar, g.setColour (bar.findColour (ScrollBar::thumbColourId) .withAlpha ((isMouseOver || isMouseDown) ? 0.4f : 0.15f)); - if (thumbSize > 0.0f) + if ((float) thumbSize > 0.0f) { Rectangle thumb; if (isScrollbarVertical) { width -= 2; - g.fillRect (x + roundToInt (width * 0.35f), y, - roundToInt (width * 0.3f), height); + g.fillRect (x + roundToInt ((float) width * 0.35f), y, + roundToInt ((float) width * 0.3f), height); thumb.setBounds (x + 1, thumbStartPosition, width - 2, thumbSize); @@ -247,8 +250,8 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar, else { height -= 2; - g.fillRect (x, y + roundToInt (height * 0.35f), - width, roundToInt (height * 0.3f)); + g.fillRect (x, y + roundToInt ((float) height * 0.35f), + width, roundToInt ((float) height * 0.3f)); thumb.setBounds (thumbStartPosition, y + 1, thumbSize, height - 2); @@ -266,20 +269,20 @@ void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar, { for (int i = 3; --i >= 0;) { - const float linePos = thumbStartPosition + thumbSize / 2 + (i - 1) * 4.0f; + const float linePos = (float) thumbStartPosition + (float) thumbSize * 0.5f + (float) (i - 1) * 4.0f; g.setColour (Colours::black.withAlpha (0.15f)); if (isScrollbarVertical) { - g.drawLine (x + width * 0.2f, linePos, width * 0.8f, linePos); + g.drawLine ((float) x + (float) width * 0.2f, linePos, (float) width * 0.8f, linePos); g.setColour (Colours::white.withAlpha (0.15f)); - g.drawLine (width * 0.2f, linePos - 1, width * 0.8f, linePos - 1); + g.drawLine ((float) width * 0.2f, linePos - 1.0f, (float) width * 0.8f, linePos - 1.0f); } else { - g.drawLine (linePos, height * 0.2f, linePos, height * 0.8f); + g.drawLine (linePos, (float) height * 0.2f, linePos, (float) height * 0.8f); g.setColour (Colours::white.withAlpha (0.15f)); - g.drawLine (linePos - 1, height * 0.2f, linePos - 1, height * 0.8f); + g.drawLine (linePos - 1.0f, (float) height * 0.2f, linePos - 1.0f, (float) height * 0.8f); } } } @@ -335,16 +338,21 @@ void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height, const float arrowX = 0.2f; const float arrowH = 0.3f; + const auto x = (float) buttonX; + const auto y = (float) buttonY; + const auto w = (float) buttonW; + const auto h = (float) buttonH; + if (box.isEnabled()) { Path p; - p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); + p.addTriangle (x + w * 0.5f, y + h * (0.45f - arrowH), + x + w * (1.0f - arrowX), y + h * 0.45f, + x + w * arrowX, y + h * 0.45f); - p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); + p.addTriangle (x + w * 0.5f, y + h * (0.55f + arrowH), + x + w * (1.0f - arrowX), y + h * 0.55f, + x + w * arrowX, y + h * 0.55f); g.setColour (box.findColour ((isButtonDown) ? ComboBox::backgroundColourId : ComboBox::buttonColourId)); @@ -354,7 +362,7 @@ void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height, Font LookAndFeel_V1::getComboBoxFont (ComboBox& box) { - Font f (jmin (15.0f, box.getHeight() * 0.85f)); + Font f (jmin (15.0f, (float) box.getHeight() * 0.85f)); f.setHorizontalScale (0.9f); return f; } @@ -394,13 +402,13 @@ void LookAndFeel_V1::drawLinearSlider (Graphics& g, if (slider.isHorizontal()) { - g.fillRect (x, y + roundToInt (h * 0.6f), - w, roundToInt (h * 0.2f)); + g.fillRect (x, y + roundToInt ((float) h * 0.6f), + w, roundToInt ((float) h * 0.2f)); } else { - g.fillRect (x + roundToInt (w * 0.5f - jmin (3.0f, w * 0.1f)), y, - jmin (4, roundToInt (w * 0.2f)), h); + g.fillRect (x + roundToInt ((float) w * 0.5f - jmin (3.0f, (float) w * 0.1f)), y, + jmin (4, roundToInt ((float) w * 0.2f)), h); } float alpha = 0.35f; @@ -413,41 +421,47 @@ void LookAndFeel_V1::drawLinearSlider (Graphics& g, if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical) { - drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), minSliderPos, - x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos - 7.0f, - x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos, + drawTriangle (g, + (float) x + (float) w * 0.5f + jmin (4.0f, (float) w * 0.3f), minSliderPos, + (float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), minSliderPos - 7.0f, + (float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), minSliderPos, fill, outline); - drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), maxSliderPos, - x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos, - x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos + 7.0f, + drawTriangle (g, + (float) x + (float) w * 0.5f + jmin (4.0f, (float) w * 0.3f), maxSliderPos, + (float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), maxSliderPos, + (float) x + (float) w * 0.5f - jmin (8.0f, (float) w * 0.4f), maxSliderPos + 7.0f, fill, outline); } else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal) { - drawTriangle (g, minSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f), - minSliderPos - 7.0f, y + h * 0.9f , - minSliderPos, y + h * 0.9f, + drawTriangle (g, + minSliderPos, (float) y + (float) h * 0.6f - jmin (4.0f, (float) h * 0.3f), + minSliderPos - 7.0f, (float) y + (float) h * 0.9f, + minSliderPos, (float) y + (float) h * 0.9f, fill, outline); - drawTriangle (g, maxSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f), - maxSliderPos, y + h * 0.9f, - maxSliderPos + 7.0f, y + h * 0.9f, + drawTriangle (g, + maxSliderPos, (float) y + (float) h * 0.6f - jmin (4.0f, (float) h * 0.3f), + maxSliderPos, (float) y + (float) h * 0.9f, + maxSliderPos + 7.0f, (float) y + (float) h * 0.9f, fill, outline); } if (style == Slider::LinearHorizontal || style == Slider::ThreeValueHorizontal) { - drawTriangle (g, sliderPos, y + h * 0.9f, - sliderPos - 7.0f, y + h * 0.2f, - sliderPos + 7.0f, y + h * 0.2f, + drawTriangle (g, + sliderPos, (float) y + (float) h * 0.9f, + sliderPos - 7.0f, (float) y + (float) h * 0.2f, + sliderPos + 7.0f, (float) y + (float) h * 0.2f, fill, outline); } else if (style == Slider::LinearVertical || style == Slider::ThreeValueVertical) { - drawTriangle (g, x + w * 0.5f - jmin (4.0f, w * 0.3f), sliderPos, - x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos - 7.0f, - x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos + 7.0f, + drawTriangle (g, + (float) x + (float) w * 0.5f - jmin (4.0f, (float) w * 0.3f), sliderPos, + (float) x + (float) w * 0.5f + jmin (8.0f, (float) w * 0.4f), sliderPos - 7.0f, + (float) x + (float) w * 0.5f + jmin (8.0f, (float) w * 0.4f), sliderPos + 7.0f, fill, outline); } } @@ -477,14 +491,14 @@ void LookAndFeel_V1::drawCornerResizer (Graphics& g, int w, int h, bool isMouseO g.setColour ((isMouseOver || isMouseDragging) ? Colours::lightgrey : Colours::darkgrey); - const float lineThickness = jmin (w, h) * 0.1f; + const float lineThickness = (float) jmin (w, h) * 0.1f; for (float i = 0.0f; i < 1.0f; i += 0.3f) { - g.drawLine (w * i, - h + 1.0f, - w + 1.0f, - h * i, + g.drawLine ((float) w * i, + (float) h + 1.0f, + (float) w + 1.0f, + (float) h * i, lineThickness); } } diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp index 2cbe2a863f..4b53000bb3 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp @@ -261,8 +261,8 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g, drawGlassLozenge (g, indentL, indentT, - width - indentL - indentR, - height - indentT - indentB, + (float) width - indentL - indentR, + (float) height - indentT - indentB, baseColour, outlineThickness, -1.0f, button.isConnectedOnLeft(), button.isConnectedOnRight(), @@ -272,7 +272,7 @@ void LookAndFeel_V2::drawButtonBackground (Graphics& g, Font LookAndFeel_V2::getTextButtonFont (TextButton&, int buttonHeight) { - return Font (jmin (15.0f, buttonHeight * 0.6f)); + return Font (jmin (15.0f, (float) buttonHeight * 0.6f)); } int LookAndFeel_V2::getTextButtonWidthToFitText (TextButton& b, int buttonHeight) @@ -344,10 +344,10 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button, g.drawRect (0, 0, button.getWidth(), button.getHeight()); } - float fontSize = jmin (15.0f, button.getHeight() * 0.75f); + float fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f); const float tickWidth = fontSize * 1.1f; - drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f, + drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f, tickWidth, tickWidth, button.getToggleState(), button.isEnabled(), @@ -368,7 +368,7 @@ void LookAndFeel_V2::drawToggleButton (Graphics& g, ToggleButton& button, void LookAndFeel_V2::changeToggleButtonWidthToFitText (ToggleButton& button) { - auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); + auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f); auto tickWidth = fontSize * 1.1f; Font font (fontSize); @@ -468,7 +468,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert, colour = 0x55ff5555; character = '!'; - icon.addTriangle (iconRect.getX() + iconRect.getWidth() * 0.5f, (float) iconRect.getY(), + icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(), (float) iconRect.getRight(), (float) iconRect.getBottom(), (float) iconRect.getX(), (float) iconRect.getBottom()); @@ -483,7 +483,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert, } GlyphArrangement ga; - ga.addFittedText (Font (iconRect.getHeight() * 0.9f, Font::bold), + ga.addFittedText (Font ((float) iconRect.getHeight() * 0.9f, Font::bold), String::charToString ((juce_wchar) (uint8) character), (float) iconRect.getX(), (float) iconRect.getY(), (float) iconRect.getWidth(), (float) iconRect.getHeight(), @@ -577,11 +577,11 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar, Path p; - for (float x = (float) (- position); x < width + stripeWidth; x += stripeWidth) + for (float x = (float) (- position); x < (float) (width + stripeWidth); x += (float) stripeWidth) p.addQuadrilateral (x, 0.0f, - x + stripeWidth * 0.5f, 0.0f, + x + (float) stripeWidth * 0.5f, 0.0f, x, (float) height, - x - stripeWidth * 0.5f, (float) height); + x - (float) stripeWidth * 0.5f, (float) height); Image im (Image::ARGB, width, height, true); @@ -602,7 +602,7 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar, if (textToShow.isNotEmpty()) { g.setColour (Colour::contrasting (background, foreground)); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawText (textToShow, 0, 0, width, height, Justification::centred, false); } @@ -610,15 +610,15 @@ void LookAndFeel_V2::drawProgressBar (Graphics& g, ProgressBar& progressBar, void LookAndFeel_V2::drawSpinningWaitAnimation (Graphics& g, const Colour& colour, int x, int y, int w, int h) { - const float radius = jmin (w, h) * 0.4f; + const float radius = (float) jmin (w, h) * 0.4f; const float thickness = radius * 0.15f; Path p; p.addRoundedRectangle (radius * 0.4f, thickness * -0.5f, radius * 0.6f, thickness, thickness * 0.5f); - const float cx = x + w * 0.5f; - const float cy = y + h * 0.5f; + const float cx = (float) x + (float) w * 0.5f; + const float cy = (float) y + (float) h * 0.5f; const uint32 animationIndex = (Time::getMillisecondCounter() / (1000 / 10)) % 12; @@ -626,8 +626,8 @@ void LookAndFeel_V2::drawSpinningWaitAnimation (Graphics& g, const Colour& colou { const uint32 n = (i + 12 - animationIndex) % 12; - g.setColour (colour.withMultipliedAlpha ((n + 1) / 12.0f)); - g.fillPath (p, AffineTransform::rotation (i * (MathConstants::pi / 6.0f)) + g.setColour (colour.withMultipliedAlpha ((float) (n + 1) / 12.0f)); + g.fillPath (p, AffineTransform::rotation ((float) i * (MathConstants::pi / 6.0f)) .translated (cx, cy)); } } @@ -650,22 +650,25 @@ void LookAndFeel_V2::drawScrollbarButton (Graphics& g, ScrollBar& scrollbar, { Path p; + const auto w = (float) width; + const auto h = (float) height; + if (buttonDirection == 0) - p.addTriangle (width * 0.5f, height * 0.2f, - width * 0.1f, height * 0.7f, - width * 0.9f, height * 0.7f); + p.addTriangle (w * 0.5f, h * 0.2f, + w * 0.1f, h * 0.7f, + w * 0.9f, h * 0.7f); else if (buttonDirection == 1) - p.addTriangle (width * 0.8f, height * 0.5f, - width * 0.3f, height * 0.1f, - width * 0.3f, height * 0.9f); + p.addTriangle (w * 0.8f, h * 0.5f, + w * 0.3f, h * 0.1f, + w * 0.3f, h * 0.9f); else if (buttonDirection == 2) - p.addTriangle (width * 0.5f, height * 0.8f, - width * 0.1f, height * 0.3f, - width * 0.9f, height * 0.3f); + p.addTriangle (w * 0.5f, h * 0.8f, + w * 0.1f, h * 0.3f, + w * 0.9f, h * 0.3f); else if (buttonDirection == 3) - p.addTriangle (width * 0.2f, height * 0.5f, - width * 0.7f, height * 0.1f, - width * 0.7f, height * 0.9f); + p.addTriangle (w * 0.2f, h * 0.5f, + w * 0.7f, h * 0.1f, + w * 0.7f, h * 0.9f); if (shouldDrawButtonAsDown) g.setColour (scrollbar.findColour (ScrollBar::thumbColourId).contrasting (0.2f)); @@ -701,37 +704,37 @@ void LookAndFeel_V2::drawScrollbar (Graphics& g, if (isScrollbarVertical) { - slotPath.addRoundedRectangle (x + slotIndent, - y + slotIndent, - width - slotIndentx2, - height - slotIndentx2, - (width - slotIndentx2) * 0.5f); + slotPath.addRoundedRectangle ((float) x + slotIndent, + (float) y + slotIndent, + (float) width - slotIndentx2, + (float) height - slotIndentx2, + ((float) width - slotIndentx2) * 0.5f); if (thumbSize > 0) - thumbPath.addRoundedRectangle (x + thumbIndent, - thumbStartPosition + thumbIndent, - width - thumbIndentx2, - thumbSize - thumbIndentx2, - (width - thumbIndentx2) * 0.5f); + thumbPath.addRoundedRectangle ((float) x + thumbIndent, + (float) thumbStartPosition + thumbIndent, + (float) width - thumbIndentx2, + (float) thumbSize - thumbIndentx2, + ((float) width - thumbIndentx2) * 0.5f); gx1 = (float) x; - gx2 = x + width * 0.7f; + gx2 = (float) x + (float) width * 0.7f; } else { - slotPath.addRoundedRectangle (x + slotIndent, - y + slotIndent, - width - slotIndentx2, - height - slotIndentx2, - (height - slotIndentx2) * 0.5f); + slotPath.addRoundedRectangle ((float) x + slotIndent, + (float) y + slotIndent, + (float) width - slotIndentx2, + (float) height - slotIndentx2, + ((float) height - slotIndentx2) * 0.5f); if (thumbSize > 0) - thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, - y + thumbIndent, - thumbSize - thumbIndentx2, - height - thumbIndentx2, - (height - thumbIndentx2) * 0.5f); + thumbPath.addRoundedRectangle ((float) thumbStartPosition + thumbIndent, + (float) y + thumbIndent, + (float) thumbSize - thumbIndentx2, + (float) height - thumbIndentx2, + ((float) height - thumbIndentx2) * 0.5f); gy1 = (float) y; - gy2 = y + height * 0.7f; + gy2 = (float) y + (float) height * 0.7f; } const Colour thumbColour (scrollbar.findColour (ScrollBar::thumbColourId)); @@ -754,13 +757,13 @@ void LookAndFeel_V2::drawScrollbar (Graphics& g, if (isScrollbarVertical) { - gx1 = x + width * 0.6f; - gx2 = (float) x + width; + gx1 = (float) x + (float) width * 0.6f; + gx2 = (float) x + (float) width; } else { - gy1 = y + height * 0.6f; - gy2 = (float) y + height; + gy1 = (float) y + (float) height * 0.6f; + gy2 = (float) y + (float) height; } g.setGradientFill (ColourGradient (Colours::transparentBlack,gx1, gy1, @@ -826,13 +829,13 @@ void LookAndFeel_V2::drawTreeviewPlusMinusBox (Graphics& g, const Rectangle 0 && font.getHeight() > standardMenuItemHeight / 1.3f) - font.setHeight (standardMenuItemHeight / 1.3f); + if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f) + font.setHeight ((float) standardMenuItemHeight / 1.3f); idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f); idealWidth = font.getStringWidth (text) + idealHeight * 2; @@ -907,17 +910,17 @@ void LookAndFeel_V2::drawPopupMenuUpDownArrow (Graphics& g, int width, int heigh { auto background = findColour (PopupMenu::backgroundColourId); - g.setGradientFill (ColourGradient (background, 0.0f, height * 0.5f, + g.setGradientFill (ColourGradient (background, 0.0f, (float) height * 0.5f, background.withAlpha (0.0f), 0.0f, isScrollUpArrow ? ((float) height) : 0.0f, false)); g.fillRect (1, 1, width - 2, height - 2); - auto hw = width * 0.5f; - auto arrowW = height * 0.3f; - auto y1 = height * (isScrollUpArrow ? 0.6f : 0.3f); - auto y2 = height * (isScrollUpArrow ? 0.3f : 0.6f); + auto hw = (float) width * 0.5f; + auto arrowW = (float) height * 0.3f; + auto y1 = (float) height * (isScrollUpArrow ? 0.6f : 0.3f); + auto y2 = (float) height * (isScrollUpArrow ? 0.3f : 0.6f); Path p; p.addTriangle (hw - arrowW, y1, @@ -972,7 +975,7 @@ void LookAndFeel_V2::drawPopupMenuItem (Graphics& g, const Rectangle& area, Font font (getPopupMenuFont()); - auto maxFontHeight = area.getHeight() / 1.3f; + auto maxFontHeight = (float) area.getHeight() / 1.3f; if (font.getHeight() > maxFontHeight) font.setHeight (maxFontHeight); @@ -1027,7 +1030,7 @@ void LookAndFeel_V2::drawPopupMenuSectionHeader (Graphics& g, const Rectangle (buttonIndent, buttonIndent, buttonSize, buttonSize), Colours::white, isOpen, false); auto textX = (int) (buttonIndent * 2.0f + buttonSize + 2.0f); g.setColour (Colours::black); - g.setFont (Font (height * 0.7f, Font::bold)); + g.setFont (Font ((float) height * 0.7f, Font::bold)); g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true); } @@ -2466,7 +2488,7 @@ void LookAndFeel_V2::drawPropertyComponentLabel (Graphics& g, int, int height, P g.setColour (component.findColour (PropertyComponent::labelTextColourId) .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f)); - g.setFont (jmin (height, 24) * 0.65f); + g.setFont ((float) jmin (height, 24) * 0.65f); auto r = getPropertyComponentContentPosition (component); @@ -2558,7 +2580,7 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height, { if (auto* d = isDirectory ? getDefaultFolderImage() : getDefaultDocumentFileImage()) - d->drawWithin (g, Rectangle (2.0f, 2.0f, x - 4.0f, height - 4.0f), + d->drawWithin (g, Rectangle (2.0f, 2.0f, x - 4.0f, (float) height - 4.0f), RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f); } @@ -2569,18 +2591,18 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height, g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::textColourId) : findColour (DirectoryContentsDisplayComponent::textColourId)); - g.setFont (height * 0.7f); + g.setFont ((float) height * 0.7f); if (width > 450 && ! isDirectory) { - auto sizeX = roundToInt (width * 0.7f); - auto dateX = roundToInt (width * 0.8f); + auto sizeX = roundToInt ((float) width * 0.7f); + auto dateX = roundToInt ((float) width * 0.8f); g.drawFittedText (filename, x, 0, sizeX - x, height, Justification::centredLeft, 1); - g.setFont (height * 0.5f); + g.setFont ((float) height * 0.5f); g.setColour (Colours::darkgrey); if (! isDirectory) @@ -2746,11 +2768,11 @@ void LookAndFeel_V2::drawLevelMeter (Graphics& g, int width, int height, float l g.setColour (Colours::white.withAlpha (0.7f)); g.fillRoundedRectangle (0.0f, 0.0f, (float) width, (float) height, 3.0f); g.setColour (Colours::black.withAlpha (0.2f)); - g.drawRoundedRectangle (1.0f, 1.0f, width - 2.0f, height - 2.0f, 3.0f, 1.0f); + g.drawRoundedRectangle (1.0f, 1.0f, (float) width - 2.0f, (float) height - 2.0f, 3.0f, 1.0f); const int totalBlocks = 7; const int numBlocks = roundToInt (totalBlocks * level); - auto w = (width - 6.0f) / (float) totalBlocks; + auto w = ((float) width - 6.0f) / (float) totalBlocks; for (int i = 0; i < totalBlocks; ++i) { @@ -2760,7 +2782,11 @@ void LookAndFeel_V2::drawLevelMeter (Graphics& g, int width, int height, float l g.setColour (i < totalBlocks - 1 ? Colours::blue.withAlpha (0.5f) : Colours::red); - g.fillRoundedRectangle (3.0f + i * w + w * 0.1f, 3.0f, w * 0.8f, height - 6.0f, w * 0.4f); + g.fillRoundedRectangle (3.0f + (float) i * w + w * 0.1f, + 3.0f, + (float) w * 0.8f, + (float) height - 6.0f, + (float) w * 0.4f); } } @@ -2781,7 +2807,7 @@ void LookAndFeel_V2::drawKeymapChangeButton (Graphics& g, int width, int height, } g.setColour (textColour); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawFittedText (keyDescription, 3, 0, width - 6, height, Justification::centred, 1); @@ -2799,7 +2825,7 @@ void LookAndFeel_V2::drawKeymapChangeButton (Graphics& g, int width, int height, p.setUsingNonZeroWinding (false); g.setColour (textColour.withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f))); - g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, width - 4.0f, height - 4.0f, true)); + g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, (float) width - 4.0f, (float) height - 4.0f, true)); } if (button.hasKeyboardFocus (false)) @@ -2838,7 +2864,7 @@ void LookAndFeel_V2::drawBevel (Graphics& g, const int x, const int y, const int for (int i = bevelThickness; --i >= 0;) { - const float op = useGradient ? (sharpEdgeOnOutside ? bevelThickness - i : i) / (float) bevelThickness + const float op = useGradient ? (float) (sharpEdgeOnOutside ? bevelThickness - i : i) / (float) bevelThickness : 1.0f; context.setFill (topLeftColour.withMultipliedAlpha (op)); @@ -2941,7 +2967,9 @@ void LookAndFeel_V2::drawGlassPointer (Graphics& g, p.lineTo (x, y + diameter * 0.6f); p.closeSubPath(); - p.applyTransform (AffineTransform::rotation (direction * MathConstants::halfPi, x + diameter * 0.5f, y + diameter * 0.5f)); + p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants::halfPi, + x + diameter * 0.5f, + y + diameter * 0.5f)); { ColourGradient cg (Colours::white.overlaidWith (colour.withMultipliedAlpha (0.3f)), 0, y, diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp index 7d514243da..99930bc21b 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp @@ -64,15 +64,15 @@ void LookAndFeel_V3::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, in if (thumbSize > 0) { - const float thumbIndent = (isScrollbarVertical ? width : height) * 0.25f; + const float thumbIndent = (float) (isScrollbarVertical ? width : height) * 0.25f; const float thumbIndentx2 = thumbIndent * 2.0f; if (isScrollbarVertical) - thumbPath.addRoundedRectangle (x + thumbIndent, thumbStartPosition + thumbIndent, - width - thumbIndentx2, thumbSize - thumbIndentx2, (width - thumbIndentx2) * 0.5f); + thumbPath.addRoundedRectangle ((float) x + thumbIndent, (float) thumbStartPosition + thumbIndent, + (float) width - thumbIndentx2, (float) thumbSize - thumbIndentx2, ((float) width - thumbIndentx2) * 0.5f); else - thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, y + thumbIndent, - thumbSize - thumbIndentx2, height - thumbIndentx2, (height - thumbIndentx2) * 0.5f); + thumbPath.addRoundedRectangle ((float) thumbStartPosition + thumbIndent, (float) y + thumbIndent, + (float) thumbSize - thumbIndentx2, (float) height - thumbIndentx2, ((float) height - thumbIndentx2) * 0.5f); } Colour thumbCol (scrollbar.findColour (ScrollBar::thumbColourId, true)); @@ -102,7 +102,7 @@ void LookAndFeel_V3::drawConcertinaPanelHeader (Graphics& g, const Rectangle 0 && height > 0) { @@ -281,26 +281,26 @@ void LookAndFeel_V3::drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphic { case TabbedButtonBar::TabsAtLeft: gradient.point1.x = (float) w; - gradient.point2.x = w * (1.0f - shadowSize); + gradient.point2.x = (float) w * (1.0f - shadowSize); shadowRect.setBounds ((int) gradient.point2.x, 0, w - (int) gradient.point2.x, h); line.setBounds (w - 1, 0, 1, h); break; case TabbedButtonBar::TabsAtRight: - gradient.point2.x = w * shadowSize; + gradient.point2.x = (float) w * shadowSize; shadowRect.setBounds (0, 0, (int) gradient.point2.x, h); line.setBounds (0, 0, 1, h); break; case TabbedButtonBar::TabsAtTop: gradient.point1.y = (float) h; - gradient.point2.y = h * (1.0f - shadowSize); + gradient.point2.y = (float) h * (1.0f - shadowSize); shadowRect.setBounds (0, (int) gradient.point2.y, w, h - (int) gradient.point2.y); line.setBounds (0, h - 1, w, 1); break; case TabbedButtonBar::TabsAtBottom: - gradient.point2.y = h * shadowSize; + gradient.point2.y = (float) h * shadowSize; shadowRect.setBounds (0, 0, w, (int) gradient.point2.y); line.setBounds (0, 0, w, 1); break; @@ -371,14 +371,19 @@ void LookAndFeel_V3::drawComboBox (Graphics& g, int width, int height, const boo const float arrowX = 0.3f; const float arrowH = 0.2f; - Path p; - p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f); + const auto x = (float) buttonX; + const auto y = (float) buttonY; + const auto w = (float) buttonW; + const auto h = (float) buttonH; - p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH), - buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f, - buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f); + Path p; + p.addTriangle (x + w * 0.5f, y + h * (0.45f - arrowH), + x + w * (1.0f - arrowX), y + h * 0.45f, + x + w * arrowX, y + h * 0.45f); + + p.addTriangle (x + w * 0.5f, y + h * (0.55f + arrowH), + x + w * (1.0f - arrowX), y + h * 0.55f, + x + w * arrowX, y + h * 0.55f); g.setColour (box.findColour (ComboBox::arrowColourId).withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.3f)); g.fillPath (p); @@ -438,19 +443,19 @@ void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g, int x, int y, int if (slider.isHorizontal()) { - auto iy = y + height * 0.5f - sliderRadius * 0.5f; + auto iy = (float) y + (float) height * 0.5f - sliderRadius * 0.5f; g.setGradientFill (ColourGradient::vertical (gradCol1, iy, gradCol2, iy + sliderRadius)); - indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius, 5.0f); + indent.addRoundedRectangle ((float) x - sliderRadius * 0.5f, iy, (float) width + sliderRadius, sliderRadius, 5.0f); } else { - auto ix = x + width * 0.5f - sliderRadius * 0.5f; + auto ix = (float) x + (float) width * 0.5f - sliderRadius * 0.5f; g.setGradientFill (ColourGradient::horizontal (gradCol1, ix, gradCol2, ix + sliderRadius)); - indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius, 5.0f); + indent.addRoundedRectangle (ix, (float) y - sliderRadius * 0.5f, sliderRadius, (float) height + sliderRadius, 5.0f); } g.fillPath (indent); @@ -500,7 +505,7 @@ void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g, int width, int height, } g.setColour (textColour); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawFittedText (keyDescription, 4, 0, width - 8, height, Justification::centred, 1); } else @@ -516,7 +521,7 @@ void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g, int width, int height, p.setUsingNonZeroWinding (false); g.setColour (textColour.darker(0.1f).withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f))); - g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, width - 4.0f, height - 4.0f, true)); + g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, (float) width - 4.0f, (float) height - 4.0f, true)); } if (button.hasKeyboardFocus (false)) @@ -542,7 +547,7 @@ public: if (ResizableWindow* rw = findParentComponentOfClass()) background = rw->getBackgroundColour(); - const float cx = getWidth() * 0.5f, cy = getHeight() * 0.5f; + const float cx = (float) getWidth() * 0.5f, cy = (float) getHeight() * 0.5f; const float diam = jmin (cx, cy) * (shouldDrawButtonAsDown ? 0.60f : 0.65f); g.setColour (background); diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp index ecc26e234d..21042d0b25 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp @@ -138,7 +138,7 @@ public: auto reducedRect = Justification (Justification::centred) .appliedToRectangle (Rectangle (getHeight(), getHeight()), getLocalBounds()) .toFloat() - .reduced (getHeight() * 0.3f); + .reduced ((float) getHeight() * 0.3f); g.fillPath (p, p.getTransformToScaleToFit (reducedRect, true)); } @@ -237,7 +237,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic g.setColour (getCurrentColourScheme().getUIColour (ColourScheme::widgetBackground)); g.fillAll(); - Font font (h * 0.65f, Font::plain); + Font font ((float) h * 0.65f, Font::plain); g.setFont (font); auto textW = font.getStringWidth (window.getName()); @@ -277,7 +277,7 @@ void LookAndFeel_V4::drawDocumentWindowTitleBar (DocumentWindow& window, Graphic //============================================================================== Font LookAndFeel_V4::getTextButtonFont (TextButton&, int buttonHeight) { - return { jmin (16.0f, buttonHeight * 0.6f) }; + return { jmin (16.0f, (float) buttonHeight * 0.6f) }; } void LookAndFeel_V4::drawButtonBackground (Graphics& g, @@ -330,10 +330,10 @@ void LookAndFeel_V4::drawButtonBackground (Graphics& g, void LookAndFeel_V4::drawToggleButton (Graphics& g, ToggleButton& button, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) { - auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); + auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f); auto tickWidth = fontSize * 1.1f; - drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f, + drawTickBox (g, button, 4.0f, ((float) button.getHeight() - tickWidth) * 0.5f, tickWidth, tickWidth, button.getToggleState(), button.isEnabled(), @@ -376,7 +376,7 @@ void LookAndFeel_V4::drawTickBox (Graphics& g, Component& component, void LookAndFeel_V4::changeToggleButtonWidthToFitText (ToggleButton& button) { - auto fontSize = jmin (15.0f, button.getHeight() * 0.75f); + auto fontSize = jmin (15.0f, (float) button.getHeight() * 0.75f); auto tickWidth = fontSize * 1.1f; Font font (fontSize); @@ -441,7 +441,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert, { character = '!'; - icon.addTriangle (iconRect.getX() + iconRect.getWidth() * 0.5f, (float) iconRect.getY(), + icon.addTriangle ((float) iconRect.getX() + (float) iconRect.getWidth() * 0.5f, (float) iconRect.getY(), static_cast (iconRect.getRight()), static_cast (iconRect.getBottom()), static_cast (iconRect.getX()), static_cast (iconRect.getBottom())); @@ -457,7 +457,7 @@ void LookAndFeel_V4::drawAlertBox (Graphics& g, AlertWindow& alert, } GlyphArrangement ga; - ga.addFittedText ({ iconRect.getHeight() * 0.9f, Font::bold }, + ga.addFittedText ({ (float) iconRect.getHeight() * 0.9f, Font::bold }, String::charToString ((juce_wchar) (uint8) character), static_cast (iconRect.getX()), static_cast (iconRect.getY()), static_cast (iconRect.getWidth()), static_cast (iconRect.getHeight()), @@ -504,17 +504,17 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa auto barBounds = progressBar.getLocalBounds().toFloat(); g.setColour (background); - g.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f); + g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f); if (progress >= 0.0f && progress <= 1.0f) { Path p; - p.addRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f); + p.addRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f); g.reduceClipRegion (p); barBounds.setWidth (barBounds.getWidth() * (float) progress); g.setColour (foreground); - g.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f); + g.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f); } else { @@ -526,18 +526,18 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa Path p; - for (auto x = static_cast (-position); x < width + stripeWidth; x += stripeWidth) + for (auto x = static_cast (-position); x < (float) (width + stripeWidth); x += (float) stripeWidth) p.addQuadrilateral (x, 0.0f, - x + stripeWidth * 0.5f, 0.0f, + x + (float) stripeWidth * 0.5f, 0.0f, x, static_cast (height), - x - stripeWidth * 0.5f, static_cast (height)); + x - (float) stripeWidth * 0.5f, static_cast (height)); Image im (Image::ARGB, width, height, true); { Graphics g2 (im); g2.setColour (foreground); - g2.fillRoundedRectangle (barBounds, progressBar.getHeight() * 0.5f); + g2.fillRoundedRectangle (barBounds, (float) progressBar.getHeight() * 0.5f); } g.setTiledImageFill (im, 0, 0, 0.85f); @@ -547,7 +547,7 @@ void LookAndFeel_V4::drawLinearProgressBar (Graphics& g, ProgressBar& progressBa if (textToShow.isNotEmpty()) { g.setColour (Colour::contrasting (background, foreground)); - g.setFont (height * 0.6f); + g.setFont ((float) height * 0.6f); g.drawText (textToShow, 0, 0, width, height, Justification::centred, false); } @@ -770,7 +770,7 @@ void LookAndFeel_V4::drawPopupMenuItem (Graphics& g, const Rectangle& area, if (isSeparator) { auto r = area.reduced (5, 0); - r.removeFromTop (roundToInt ((r.getHeight() * 0.5f) - 0.5f)); + r.removeFromTop (roundToInt (((float) r.getHeight() * 0.5f) - 0.5f)); g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.3f)); g.fillRect (r.removeFromTop (1)); @@ -798,7 +798,7 @@ void LookAndFeel_V4::drawPopupMenuItem (Graphics& g, const Rectangle& area, auto font = getPopupMenuFont(); - auto maxFontHeight = r.getHeight() / 1.3f; + auto maxFontHeight = (float) r.getHeight() / 1.3f; if (font.getHeight() > maxFontHeight) font.setHeight (maxFontHeight); @@ -860,8 +860,8 @@ void LookAndFeel_V4::getIdealPopupMenuItemSize (const String& text, const bool i { auto font = getPopupMenuFont(); - if (standardMenuItemHeight > 0 && font.getHeight() > standardMenuItemHeight / 1.3f) - font.setHeight (standardMenuItemHeight / 1.3f); + if (standardMenuItemHeight > 0 && font.getHeight() > (float) standardMenuItemHeight / 1.3f) + font.setHeight ((float) standardMenuItemHeight / 1.3f); idealHeight = standardMenuItemHeight > 0 ? standardMenuItemHeight : roundToInt (font.getHeight() * 1.3f); idealWidth = font.getStringWidth (text) + idealHeight * 2; @@ -922,9 +922,9 @@ void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool, Rectangle arrowZone (width - 30, 0, 20, height); Path path; - path.startNewSubPath (arrowZone.getX() + 3.0f, arrowZone.getCentreY() - 2.0f); - path.lineTo (static_cast (arrowZone.getCentreX()), arrowZone.getCentreY() + 3.0f); - path.lineTo (arrowZone.getRight() - 3.0f, arrowZone.getCentreY() - 2.0f); + path.startNewSubPath ((float) arrowZone.getX() + 3.0f, (float) arrowZone.getCentreY() - 2.0f); + path.lineTo ((float) arrowZone.getCentreX(), (float) arrowZone.getCentreY() + 3.0f); + path.lineTo ((float) arrowZone.getRight() - 3.0f, (float) arrowZone.getCentreY() - 2.0f); g.setColour (box.findColour (ComboBox::arrowColourId).withAlpha ((box.isEnabled() ? 0.9f : 0.2f))); g.strokePath (path, PathStrokeType (2.0f)); @@ -932,7 +932,7 @@ void LookAndFeel_V4::drawComboBox (Graphics& g, int width, int height, bool, Font LookAndFeel_V4::getComboBoxFont (ComboBox& box) { - return { jmin (16.0f, box.getHeight() * 0.85f) }; + return { jmin (16.0f, (float) box.getHeight() * 0.85f) }; } void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label) @@ -947,8 +947,8 @@ void LookAndFeel_V4::positionComboBoxText (ComboBox& box, Label& label) //============================================================================== int LookAndFeel_V4::getSliderThumbRadius (Slider& slider) { - return jmin (12, slider.isHorizontal() ? static_cast (slider.getHeight() * 0.5f) - : static_cast (slider.getWidth() * 0.5f)); + return jmin (12, slider.isHorizontal() ? static_cast ((float) slider.getHeight() * 0.5f) + : static_cast ((float) slider.getWidth() * 0.5f)); } void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int height, @@ -960,21 +960,21 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int if (slider.isBar()) { g.setColour (slider.findColour (Slider::trackColourId)); - g.fillRect (slider.isHorizontal() ? Rectangle (static_cast (x), y + 0.5f, sliderPos - x, height - 1.0f) - : Rectangle (x + 0.5f, sliderPos, width - 1.0f, y + (height - sliderPos))); + g.fillRect (slider.isHorizontal() ? Rectangle (static_cast (x), (float) y + 0.5f, sliderPos - (float) x, (float) height - 1.0f) + : Rectangle ((float) x + 0.5f, sliderPos, (float) width - 1.0f, (float) y + ((float) height - sliderPos))); } else { auto isTwoVal = (style == Slider::SliderStyle::TwoValueVertical || style == Slider::SliderStyle::TwoValueHorizontal); auto isThreeVal = (style == Slider::SliderStyle::ThreeValueVertical || style == Slider::SliderStyle::ThreeValueHorizontal); - auto trackWidth = jmin (6.0f, slider.isHorizontal() ? height * 0.25f : width * 0.25f); + auto trackWidth = jmin (6.0f, slider.isHorizontal() ? (float) height * 0.25f : (float) width * 0.25f); - Point startPoint (slider.isHorizontal() ? x : x + width * 0.5f, - slider.isHorizontal() ? y + height * 0.5f : height + y); + Point startPoint (slider.isHorizontal() ? (float) x : (float) x + (float) width * 0.5f, + slider.isHorizontal() ? (float) y + (float) height * 0.5f : (float) (height + y)); - Point endPoint (slider.isHorizontal() ? width + x : startPoint.x, - slider.isHorizontal() ? startPoint.y : y); + Point endPoint (slider.isHorizontal() ? (float) (width + x) : startPoint.x, + slider.isHorizontal() ? startPoint.y : (float) y); Path backgroundTrack; backgroundTrack.startNewSubPath (startPoint); @@ -987,20 +987,20 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int if (isTwoVal || isThreeVal) { - minPoint = { slider.isHorizontal() ? minSliderPos : width * 0.5f, - slider.isHorizontal() ? height * 0.5f : minSliderPos }; + minPoint = { slider.isHorizontal() ? minSliderPos : (float) width * 0.5f, + slider.isHorizontal() ? (float) height * 0.5f : minSliderPos }; if (isThreeVal) - thumbPoint = { slider.isHorizontal() ? sliderPos : width * 0.5f, - slider.isHorizontal() ? height * 0.5f : sliderPos }; + thumbPoint = { slider.isHorizontal() ? sliderPos : (float) width * 0.5f, + slider.isHorizontal() ? (float) height * 0.5f : sliderPos }; - maxPoint = { slider.isHorizontal() ? maxSliderPos : width * 0.5f, - slider.isHorizontal() ? height * 0.5f : maxSliderPos }; + maxPoint = { slider.isHorizontal() ? maxSliderPos : (float) width * 0.5f, + slider.isHorizontal() ? (float) height * 0.5f : maxSliderPos }; } else { - auto kx = slider.isHorizontal() ? sliderPos : (x + width * 0.5f); - auto ky = slider.isHorizontal() ? (y + height * 0.5f) : sliderPos; + auto kx = slider.isHorizontal() ? sliderPos : ((float) x + (float) width * 0.5f); + auto ky = slider.isHorizontal() ? ((float) y + (float) height * 0.5f) : sliderPos; minPoint = startPoint; maxPoint = { kx, ky }; @@ -1021,26 +1021,26 @@ void LookAndFeel_V4::drawLinearSlider (Graphics& g, int x, int y, int width, int if (isTwoVal || isThreeVal) { - auto sr = jmin (trackWidth, (slider.isHorizontal() ? height : width) * 0.4f); + auto sr = jmin (trackWidth, (slider.isHorizontal() ? (float) height : (float) width) * 0.4f); auto pointerColour = slider.findColour (Slider::thumbColourId); if (slider.isHorizontal()) { drawPointer (g, minSliderPos - sr, - jmax (0.0f, y + height * 0.5f - trackWidth * 2.0f), + jmax (0.0f, (float) y + (float) height * 0.5f - trackWidth * 2.0f), trackWidth * 2.0f, pointerColour, 2); drawPointer (g, maxSliderPos - trackWidth, - jmin (y + height - trackWidth * 2.0f, y + height * 0.5f), + jmin ((float) (y + height) - trackWidth * 2.0f, (float) y + (float) height * 0.5f), trackWidth * 2.0f, pointerColour, 4); } else { - drawPointer (g, jmax (0.0f, x + width * 0.5f - trackWidth * 2.0f), + drawPointer (g, jmax (0.0f, (float) x + (float) width * 0.5f - trackWidth * 2.0f), minSliderPos - trackWidth, trackWidth * 2.0f, pointerColour, 1); - drawPointer (g, jmin (x + width - trackWidth * 2.0f, x + width * 0.5f), maxSliderPos - sr, + drawPointer (g, jmin ((float) (x + width) - trackWidth * 2.0f, (float) x + (float) width * 0.5f), maxSliderPos - sr, trackWidth * 2.0f, pointerColour, 3); } } @@ -1108,7 +1108,7 @@ void LookAndFeel_V4::drawPointer (Graphics& g, const float x, const float y, con p.lineTo (x, y + diameter * 0.6f); p.closeSubPath(); - p.applyTransform (AffineTransform::rotation (direction * MathConstants::halfPi, + p.applyTransform (AffineTransform::rotation ((float) direction * MathConstants::halfPi, x + diameter * 0.5f, y + diameter * 0.5f)); g.setColour (colour); g.fillPath (p); @@ -1173,10 +1173,10 @@ void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float l g.fillRoundedRectangle (0.0f, 0.0f, static_cast (width), static_cast (height), outerCornerSize); auto doubleOuterBorderWidth = 2.0f * outerBorderWidth; - auto numBlocks = roundToInt (totalBlocks * level); + auto numBlocks = roundToInt ((float) totalBlocks * level); - auto blockWidth = (width - doubleOuterBorderWidth) / static_cast (totalBlocks); - auto blockHeight = height - doubleOuterBorderWidth; + auto blockWidth = ((float) width - doubleOuterBorderWidth) / static_cast (totalBlocks); + auto blockHeight = (float) height - doubleOuterBorderWidth; auto blockRectWidth = (1.0f - 2.0f * spacingFraction) * blockWidth; auto blockRectSpacing = spacingFraction * blockWidth; @@ -1192,7 +1192,7 @@ void LookAndFeel_V4::drawLevelMeter (Graphics& g, int width, int height, float l else g.setColour (i < totalBlocks - 1 ? c : Colours::red); - g.fillRoundedRectangle (outerBorderWidth + (i * blockWidth) + blockRectSpacing, + g.fillRoundedRectangle (outerBorderWidth + ((float) i * blockWidth) + blockRectSpacing, outerBorderWidth, blockRectWidth, blockHeight, @@ -1207,8 +1207,8 @@ void LookAndFeel_V4::paintToolbarBackground (Graphics& g, int w, int h, Toolbar& g.setGradientFill ({ background, 0.0f, 0.0f, background.darker (0.2f), - toolbar.isVertical() ? w - 1.0f : 0.0f, - toolbar.isVertical() ? 0.0f : h - 1.0f, + toolbar.isVertical() ? (float) w - 1.0f : 0.0f, + toolbar.isVertical() ? 0.0f : (float) h - 1.0f, false }); g.fillAll(); } @@ -1222,7 +1222,7 @@ void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid g.setColour (baseTextColour.withAlpha (component.isEnabled() ? 1.0f : 0.25f)); - auto fontHeight = jmin (14.0f, height * 0.85f); + auto fontHeight = jmin (14.0f, (float) height * 0.85f); g.setFont (fontHeight); g.drawFittedText (text, @@ -1235,8 +1235,8 @@ void LookAndFeel_V4::paintToolbarButtonLabel (Graphics& g, int x, int y, int wid void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String& name, bool isOpen, int width, int height) { - auto buttonSize = height * 0.75f; - auto buttonIndent = (height - buttonSize) * 0.5f; + auto buttonSize = (float) height * 0.75f; + auto buttonIndent = ((float) height - buttonSize) * 0.5f; drawTreeviewPlusMinusBox (g, { buttonIndent, buttonIndent, buttonSize, buttonSize }, findColour (ResizableWindow::backgroundColourId), isOpen, false); @@ -1245,7 +1245,7 @@ void LookAndFeel_V4::drawPropertyPanelSectionHeader (Graphics& g, const String& g.setColour (findColour (PropertyComponent::labelTextColourId)); - g.setFont ({ height * 0.7f, Font::bold }); + g.setFont ({ (float) height * 0.7f, Font::bold }); g.drawText (name, textX, 0, width - textX - 4, height, Justification::centredLeft, true); } @@ -1264,7 +1264,7 @@ void LookAndFeel_V4::drawPropertyComponentLabel (Graphics& g, int width, int hei g.setColour (component.findColour (PropertyComponent::labelTextColourId) .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f)); - g.setFont (jmin (height, 24) * 0.65f); + g.setFont ((float) jmin (height, 24) * 0.65f); auto r = getPropertyComponentContentPosition (component); diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index b5be96f29b..cef68e38cf 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -1177,7 +1177,7 @@ private: else { oldGlobalPos += Point (2, 0); - subX += itemScreenBounds.getWidth(); + subX += (float) itemScreenBounds.getWidth(); } Path areaTowardsSubMenu; diff --git a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp index e201568642..77ef59434f 100644 --- a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp +++ b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp @@ -438,7 +438,7 @@ void DragAndDropContainer::startDragging (const var& sourceDescription, if (distance > lo) { auto alpha = (distance > hi) ? 0 - : (hi - distance) / (float) (hi - lo) + : (float) (hi - distance) / (float) (hi - lo) + random.nextFloat() * 0.008f; dragImage.multiplyAlphaAt (x, y, alpha); diff --git a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp index 928b86d225..a8c2c283a8 100644 --- a/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp +++ b/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp @@ -538,8 +538,8 @@ private: bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetweenMs) const noexcept { return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs) - && std::abs (position.x - other.position.x) < getPositionToleranceForInputType() - && std::abs (position.y - other.position.y) < getPositionToleranceForInputType() + && std::abs (position.x - other.position.x) < (float) getPositionToleranceForInputType() + && std::abs (position.y - other.position.y) < (float) getPositionToleranceForInputType() && buttons == other.buttons && peerID == other.peerID; } diff --git a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp index 7bbf0520a1..fdc99d9138 100644 --- a/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp +++ b/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp @@ -103,7 +103,7 @@ public: g.setFont (labelFont); g.drawFittedText (textToDisplayWhenEmpty, textArea, getJustificationType(), - jmax (1, (int) (textArea.getHeight() / labelFont.getHeight())), + jmax (1, (int) ((float) textArea.getHeight() / labelFont.getHeight())), getMinimumHorizontalScale()); } } diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 4bfc4f5de0..6cd138d350 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -890,7 +890,10 @@ Image ListBox::createSnapshotOfRows (const SparseSet& rows, int& imageX, in imageY = imageArea.getY(); auto listScale = Component::getApproximateScaleFactorForComponent (this); - Image snapshot (Image::ARGB, roundToInt (imageArea.getWidth() * listScale), roundToInt (imageArea.getHeight() * listScale), true); + Image snapshot (Image::ARGB, + roundToInt ((float) imageArea.getWidth() * listScale), + roundToInt ((float) imageArea.getHeight() * listScale), + true); for (int i = getNumRowsOnScreen() + 2; --i >= 0;) { diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index b4d9d38131..731193ff1b 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -685,8 +685,8 @@ public: //============================================================================== void handleRotaryDrag (const MouseEvent& e) { - auto dx = e.position.x - sliderRect.getCentreX(); - auto dy = e.position.y - sliderRect.getCentreY(); + auto dx = e.position.x - (float) sliderRect.getCentreX(); + auto dy = e.position.y - (float) sliderRect.getCentreY(); if (dx * dx + dy * dy > 25.0f) { @@ -768,7 +768,7 @@ public: } else { - newPos = (mousePos - sliderRegionStart) / (double) sliderRegionSize; + newPos = (mousePos - (float) sliderRegionStart) / (double) sliderRegionSize; if (isVertical()) newPos = 1.0 - newPos; @@ -1140,8 +1140,8 @@ public: { auto pixelPos = (float) getLinearSliderPos (pos); - mousePos = owner.localPointToGlobal (Point (isHorizontal() ? pixelPos : (owner.getWidth() / 2.0f), - isVertical() ? pixelPos : (owner.getHeight() / 2.0f))); + mousePos = owner.localPointToGlobal (Point (isHorizontal() ? pixelPos : ((float) owner.getWidth() / 2.0f), + isVertical() ? pixelPos : ((float) owner.getHeight() / 2.0f))); } const_cast (ms).setScreenPosition (mousePos); diff --git a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp index 98f402f16d..ca5743ea06 100644 --- a/modules/juce_gui_basics/widgets/juce_TextEditor.cpp +++ b/modules/juce_gui_basics/widgets/juce_TextEditor.cpp @@ -547,7 +547,7 @@ struct TextEditor::Iterator Graphics::ScopedSaveState state (g); g.reduceClipRegion ({ startX, baselineY, endX - startX, 1 }); - g.fillCheckerBoard ({ (float) endX, baselineY + 1.0f }, 3.0f, 1.0f, colour, Colours::transparentBlack); + g.fillCheckerBoard ({ (float) endX, (float) baselineY + 1.0f }, 3.0f, 1.0f, colour, Colours::transparentBlack); } void drawSelectedText (Graphics& g, Range selected, Colour selectedTextColour) const @@ -1584,9 +1584,9 @@ void TextEditor::drawContent (Graphics& g) Iterator i2 (i); RectangleList selectionArea; - while (i2.next() && i2.lineY < clip.getBottom()) + while (i2.next() && i2.lineY < (float) clip.getBottom()) { - if (i2.lineY + i2.lineHeight >= clip.getY() + if (i2.lineY + i2.lineHeight >= (float) clip.getY() && selection.intersects ({ i2.indexInText, i2.indexInText + i2.atom->numChars })) { i2.addSelection (selectionArea, selection); @@ -1601,9 +1601,9 @@ void TextEditor::drawContent (Graphics& g) const UniformTextSection* lastSection = nullptr; - while (i.next() && i.lineY < clip.getBottom()) + while (i.next() && i.lineY < (float) clip.getBottom()) { - if (i.lineY + i.lineHeight >= clip.getY()) + if (i.lineY + i.lineHeight >= (float) clip.getY()) { if (selection.intersects ({ i.indexInText, i.indexInText + i.atom->numChars })) { @@ -1621,9 +1621,9 @@ void TextEditor::drawContent (Graphics& g) { Iterator i2 (*this); - while (i2.next() && i2.lineY < clip.getBottom()) + while (i2.next() && i2.lineY < (float) clip.getBottom()) { - if (i2.lineY + i2.lineHeight >= clip.getY() + if (i2.lineY + i2.lineHeight >= (float) clip.getY() && underlinedSection.intersects ({ i2.indexInText, i2.indexInText + i2.atom->numChars })) { i2.drawUnderline (g, underlinedSection, findColour (textColourId)); @@ -1883,7 +1883,7 @@ bool TextEditor::pageUp (bool selecting) return moveCaretToStartOfLine (selecting); auto caretPos = getCaretRectangleFloat(); - return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getY() - viewport->getViewHeight()), selecting); + return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getY() - (float) viewport->getViewHeight()), selecting); } bool TextEditor::pageDown (bool selecting) @@ -1892,7 +1892,7 @@ bool TextEditor::pageDown (bool selecting) return moveCaretToEndOfLine (selecting); auto caretPos = getCaretRectangleFloat(); - return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getBottom() + viewport->getViewHeight()), selecting); + return moveCaretWithTransaction (indexAtPosition (caretPos.getX(), caretPos.getBottom() + (float) viewport->getViewHeight()), selecting); } void TextEditor::scrollByLines (int deltaLines) diff --git a/modules/juce_gui_basics/widgets/juce_Toolbar.cpp b/modules/juce_gui_basics/widgets/juce_Toolbar.cpp index 308a3642a1..d16b0c176a 100644 --- a/modules/juce_gui_basics/widgets/juce_Toolbar.cpp +++ b/modules/juce_gui_basics/widgets/juce_Toolbar.cpp @@ -51,7 +51,7 @@ public: } else { - maxSize = roundToInt (toolbarThickness * fixedSize); + maxSize = roundToInt ((float) toolbarThickness * fixedSize); minSize = drawBar ? maxSize : jmin (4, maxSize); preferredSize = maxSize; @@ -87,9 +87,9 @@ public: auto thickness = 0.2f; if (isToolbarVertical()) - g.fillRect (w * 0.1f, h * (0.5f - thickness * 0.5f), w * 0.8f, h * thickness); + g.fillRect ((float) w * 0.1f, (float) h * (0.5f - thickness * 0.5f), (float) w * 0.8f, (float) h * thickness); else - g.fillRect (w * (0.5f - thickness * 0.5f), h * 0.1f, w * thickness, h * 0.8f); + g.fillRect ((float) w * (0.5f - thickness * 0.5f), (float) h * 0.1f, (float) w * thickness, (float) h * 0.8f); } if (getEditingMode() != normalMode && ! drawBar) @@ -106,33 +106,33 @@ public: if (isToolbarVertical()) { - x1 = w * 0.5f; - y1 = h * 0.4f; + x1 = (float) w * 0.5f; + y1 = (float) h * 0.4f; x2 = x1; - y2 = indentX * 2.0f; + y2 = (float) indentX * 2.0f; x3 = x1; - y3 = h * 0.6f; + y3 = (float) h * 0.6f; x4 = x1; - y4 = h - y2; + y4 = (float) h - y2; - hw = w * 0.15f; - hl = w * 0.2f; + hw = (float) w * 0.15f; + hl = (float) w * 0.2f; } else { - x1 = w * 0.4f; - y1 = h * 0.5f; - x2 = indentX * 2.0f; + x1 = (float) w * 0.4f; + y1 = (float) h * 0.5f; + x2 = (float) indentX * 2.0f; y2 = y1; - x3 = w * 0.6f; + x3 = (float) w * 0.6f; y3 = y1; - x4 = w - x2; + x4 = (float) w - x2; y4 = y1; - hw = h * 0.15f; - hl = h * 0.2f; + hw = (float) h * 0.15f; + hl = (float) h * 0.2f; } Path p; diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.cpp b/modules/juce_gui_basics/widgets/juce_TreeView.cpp index 015aa212bd..b6d4d1cc6c 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.cpp +++ b/modules/juce_gui_basics/widgets/juce_TreeView.cpp @@ -993,7 +993,7 @@ public: void paint (Graphics& g) override { g.setColour (findColour (TreeView::dragAndDropIndicatorColourId, true)); - g.drawRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 3.0f, 2.0f); + g.drawRoundedRectangle (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 3.0f, 2.0f); } private: @@ -1552,13 +1552,13 @@ void TreeViewItem::paintRecursively (Graphics& g, int width) } } - auto halfH = itemHeight * 0.5f; + auto halfH = (float) itemHeight * 0.5f; auto indentWidth = ownerView->getIndentSize(); auto depth = TreeViewHelpers::calculateDepth (this, ownerView->rootItemVisible); if (depth >= 0 && ownerView->openCloseButtonsVisible) { - auto x = (depth + 0.5f) * indentWidth; + auto x = ((float) depth + 0.5f) * (float) indentWidth; const bool parentLinesDrawn = parentItem != nullptr && parentItem->areLinesDrawn(); @@ -1566,7 +1566,7 @@ void TreeViewItem::paintRecursively (Graphics& g, int width) paintVerticalConnectingLine (g, Line (x, 0, x, isLastOfSiblings() ? halfH : (float) itemHeight)); if (parentLinesDrawn || (parentItem == nullptr && areLinesDrawn())) - paintHorizontalConnectingLine (g, Line (x, halfH, x + indentWidth / 2, halfH)); + paintHorizontalConnectingLine (g, Line (x, halfH, x + (float) indentWidth * 0.5f, halfH)); { auto* p = parentItem; diff --git a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp index 190a499440..f45630f0cc 100644 --- a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp @@ -239,7 +239,7 @@ public: setFont (font); setText (message, false); - bestWidth = 2 * (int) std::sqrt (font.getHeight() * font.getStringWidth (message)); + bestWidth = 2 * (int) std::sqrt (font.getHeight() * (float) font.getStringWidth (message)); } void updateLayout (const int width) @@ -249,7 +249,7 @@ public: s.append (getText(), getFont()); TextLayout text; - text.createLayoutWithBalancedLineLengths (s, width - 8.0f); + text.createLayoutWithBalancedLineLengths (s, (float) width - 8.0f); setSize (width, jmin (width, (int) (text.getHeight() + getFont().getHeight()))); } @@ -355,8 +355,8 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) auto wid = jmax (messageFont.getStringWidth (text), messageFont.getStringWidth (getName())); - auto sw = (int) std::sqrt (messageFont.getHeight() * wid); - auto w = jmin (300 + sw * 2, (int) (getParentWidth() * 0.7f)); + auto sw = (int) std::sqrt (messageFont.getHeight() * (float) wid); + auto w = jmin (300 + sw * 2, (int) ((float) getParentWidth() * 0.7f)); const int edgeGap = 10; const int labelHeight = 18; int iconSpace = 0; @@ -382,7 +382,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) } w = jmax (350, (int) textLayout.getWidth() + iconSpace + edgeGap * 4); - w = jmin (w, (int) (getParentWidth() * 0.7f)); + w = jmin (w, (int) ((float) getParentWidth() * 0.7f)); auto textLayoutH = (int) textLayout.getHeight(); auto textBottom = 16 + titleH + textLayoutH; @@ -412,12 +412,12 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) for (auto* tb : textBlocks) w = jmax (w, static_cast (tb)->bestWidth); - w = jmin (w, (int) (getParentWidth() * 0.7f)); + w = jmin (w, (int) ((float) getParentWidth() * 0.7f)); for (auto* tb : textBlocks) { auto* ac = static_cast (tb); - ac->updateLayout ((int) (w * 0.8f)); + ac->updateLayout ((int) ((float) w * 0.8f)); h += ac->getHeight() + 10; } @@ -443,7 +443,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) totalWidth += b->getWidth() + spacer; auto x = (w - totalWidth) / 2; - auto y = (int) (getHeight() * 0.95f); + auto y = (int) ((float) getHeight() * 0.95f); for (auto* c : buttons) { diff --git a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp index 90bc1aeb74..5bb8169387 100644 --- a/modules/juce_gui_basics/windows/juce_CallOutBox.cpp +++ b/modules/juce_gui_basics/windows/juce_CallOutBox.cpp @@ -201,7 +201,7 @@ void CallOutBox::updatePosition (const Rectangle& newAreaToPointTo, const R auto hh = newBounds.getHeight() / 2; auto hwReduced = (float) (hw - borderSpace * 2); auto hhReduced = (float) (hh - borderSpace * 2); - auto arrowIndent = borderSpace - arrowSize; + auto arrowIndent = (float) borderSpace - arrowSize; Point targets[4] = { { (float) targetArea.getCentreX(), (float) targetArea.getBottom() }, { (float) targetArea.getRight(), (float) targetArea.getCentreY() }, @@ -234,8 +234,8 @@ void CallOutBox::updatePosition (const Rectangle& newAreaToPointTo, const R nearest = distanceFromCentre; targetPoint = targets[i]; - newBounds.setPosition ((int) (centre.x - hw), - (int) (centre.y - hh)); + newBounds.setPosition ((int) (centre.x - (float) hw), + (int) (centre.y - (float) hh)); } } diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 7c9f504c12..2caeee7b76 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -115,8 +115,8 @@ void ComponentPeer::handlePaint (LowLevelGraphicsContext& contextToPaintTo) if (peerBounds.getWidth() != componentBounds.getWidth() || peerBounds.getHeight() != componentBounds.getHeight()) // Tweak the scaling so that the component's integer size exactly aligns with the peer's scaled size - g.addTransform (AffineTransform::scale (peerBounds.getWidth() / (float) componentBounds.getWidth(), - peerBounds.getHeight() / (float) componentBounds.getHeight())); + g.addTransform (AffineTransform::scale ((float) peerBounds.getWidth() / (float) componentBounds.getWidth(), + (float) peerBounds.getHeight() / (float) componentBounds.getHeight())); #if JUCE_ENABLE_REPAINT_DEBUGGING #ifdef JUCE_IS_REPAINT_DEBUGGING_ACTIVE diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index 11b28861bf..0ac4532350 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -85,8 +85,8 @@ public: void getHighlightArea (RectangleList& area, float x, int y, int lineH, float characterWidth) const { if (highlightColumnStart < highlightColumnEnd) - area.add (Rectangle (x + highlightColumnStart * characterWidth - 1.0f, y - 0.5f, - (highlightColumnEnd - highlightColumnStart) * characterWidth + 1.5f, lineH + 1.0f)); + area.add (Rectangle (x + (float) highlightColumnStart * characterWidth - 1.0f, (float) y - 0.5f, + (float) (highlightColumnEnd - highlightColumnStart) * characterWidth + 1.5f, (float) lineH + 1.0f)); } void draw (CodeEditorComponent& owner, Graphics& g, const Font& fontToUse, @@ -100,7 +100,7 @@ public: for (auto& token : tokens) { - const float tokenX = x + column * characterWidth; + const float tokenX = x + (float) column * characterWidth; if (tokenX > rightClip) break; @@ -108,7 +108,7 @@ public: column += token.length; } - as.draw (g, { x, (float) y, column * characterWidth + 10.0f, (float) lineH }); + as.draw (g, { x, (float) y, (float) column * characterWidth + 10.0f, (float) lineH }); } private: @@ -301,7 +301,7 @@ public: lastNumLines - editor.firstLineOnScreen); auto lineNumberFont = editor.getFont().withHeight (jmin (13.0f, lineHeightFloat * 0.8f)); - auto w = getWidth() - 2.0f; + auto w = (float) getWidth() - 2.0f; GlyphArrangement ga; for (int i = firstLineToDraw; i < lastLineToDraw; ++i) @@ -443,7 +443,7 @@ void CodeEditorComponent::resized() { auto visibleWidth = getWidth() - scrollbarThickness - getGutterSize(); linesOnScreen = jmax (1, (getHeight() - scrollbarThickness) / lineHeight); - columnsOnScreen = jmax (1, (int) (visibleWidth / charWidth)); + columnsOnScreen = jmax (1, (int) ((float) visibleWidth / charWidth)); lines.clear(); rebuildLineTokens(); updateCaretPosition(); @@ -737,7 +737,7 @@ void CodeEditorComponent::scrollToKeepCaretOnScreen() Rectangle CodeEditorComponent::getCharacterBounds (const CodeDocument::Position& pos) const { - return { roundToInt ((getGutterSize() - xOffset * charWidth) + indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth), + return { roundToInt ((getGutterSize() - xOffset * charWidth) + (float) indexToColumn (pos.getLineNumber(), pos.getIndexInLine()) * charWidth), (pos.getLineNumber() - firstLineOnScreen) * lineHeight, roundToInt (charWidth), lineHeight }; diff --git a/modules/juce_gui_extra/misc/juce_BubbleMessageComponent.cpp b/modules/juce_gui_extra/misc/juce_BubbleMessageComponent.cpp index 3417689766..520e6e7383 100644 --- a/modules/juce_gui_extra/misc/juce_BubbleMessageComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_BubbleMessageComponent.cpp @@ -97,7 +97,7 @@ void BubbleMessageComponent::paintContent (Graphics& g, int w, int h) g.setColour (findColour (TooltipWindow::textColourId)); textLayout.draw (g, Rectangle (bubblePaddingX / 2.0f, bubblePaddingY / 2.0f, - w - bubblePaddingX, h - bubblePaddingY)); + (float) w - bubblePaddingX, (float) h - bubblePaddingY)); } void BubbleMessageComponent::timerCallback() diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp index ca7878945a..faa1a73d72 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.cpp +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.cpp @@ -67,11 +67,11 @@ public: for (int y = 0; y < height; ++y) { - auto val = 1.0f - y / (float) height; + auto val = 1.0f - (float) y / (float) height; for (int x = 0; x < width; ++x) { - auto sat = x / (float) width; + auto sat = (float) x / (float) width; pixels.setPixelColour (x, y, Colour (h, sat, val, 1.0f)); } } @@ -92,8 +92,8 @@ public: void mouseDrag (const MouseEvent& e) override { - auto sat = (e.x - edge) / (float) (getWidth() - edge * 2); - auto val = 1.0f - (e.y - edge) / (float) (getHeight() - edge * 2); + auto sat = (float) (e.x - edge) / (float) (getWidth() - edge * 2); + auto val = 1.0f - (float) (e.y - edge) / (float) (getHeight() - edge * 2); owner.setSV (sat, val); } @@ -135,9 +135,9 @@ private: void paint (Graphics& g) override { g.setColour (Colour::greyLevel (0.1f)); - g.drawEllipse (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 1.0f); + g.drawEllipse (1.0f, 1.0f, (float) getWidth() - 2.0f, (float) getHeight() - 2.0f, 1.0f); g.setColour (Colour::greyLevel (0.9f)); - g.drawEllipse (2.0f, 2.0f, getWidth() - 4.0f, getHeight() - 4.0f, 1.0f); + g.drawEllipse (2.0f, 2.0f, (float) getWidth() - 4.0f, (float) getHeight() - 4.0f, 1.0f); } }; @@ -195,7 +195,7 @@ public: void mouseDrag (const MouseEvent& e) override { - owner.setHue ((e.y - edge) / (float) (getHeight() - edge * 2)); + owner.setHue ((float) (e.y - edge) / (float) (getHeight() - edge * 2)); } void updateIfNeeded() diff --git a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp index 7fff036e94..4b8088c5fb 100644 --- a/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp +++ b/modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp @@ -88,7 +88,7 @@ public: if (keyNum < 0) setSize (h, h); else - setSize (jlimit (h * 4, h * 8, 6 + Font (h * 0.6f).getStringWidth (getName())), h); + setSize (jlimit (h * 4, h * 8, 6 + Font ((float) h * 0.6f).getStringWidth (getName())), h); } //============================================================================== @@ -240,7 +240,7 @@ public: void paint (Graphics& g) override { - g.setFont (getHeight() * 0.7f); + g.setFont ((float) getHeight() * 0.7f); g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId)); g.drawFittedText (TRANS (owner.getCommandManager().getNameOfCommand (commandID)), @@ -307,7 +307,7 @@ public: void paintItem (Graphics& g, int width, int height) override { - g.setFont (Font (height * 0.7f, Font::bold)); + g.setFont (Font ((float) height * 0.7f, Font::bold)); g.setColour (owner.findColour (KeyMappingEditorComponent::textColourId)); g.drawText (TRANS (categoryName), 2, 0, width - 2, height, Justification::centredLeft, true); diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index 0c05635624..7cb4a20066 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -119,8 +119,8 @@ struct CachedImageList : public ReferenceCountedObject, t.textureID = texture.getTextureID(); t.imageWidth = pixelData->width; t.imageHeight = pixelData->height; - t.fullWidthProportion = t.imageWidth / (float) texture.getWidth(); - t.fullHeightProportion = t.imageHeight / (float) texture.getHeight(); + t.fullWidthProportion = (float) t.imageWidth / (float) texture.getWidth(); + t.fullHeightProportion = (float) t.imageHeight / (float) texture.getHeight(); lastUsed = Time::getCurrentTime(); return t; @@ -646,16 +646,16 @@ struct ShaderPrograms : public ReferenceCountedObject float targetX, float targetY, bool isForTiling) const { auto t = trans.translated (-targetX, -targetY) - .inverted().scaled (fullWidthProportion / imageWidth, - fullHeightProportion / imageHeight); + .inverted().scaled (fullWidthProportion / (float) imageWidth, + fullHeightProportion / (float) imageHeight); const GLfloat m[] = { t.mat00, t.mat01, t.mat02, t.mat10, t.mat11, t.mat12 }; matrix.set (m, 6); if (isForTiling) { - fullWidthProportion -= 0.5f / imageWidth; - fullHeightProportion -= 0.5f / imageHeight; + fullWidthProportion -= 0.5f / (float) imageWidth; + fullHeightProportion -= 0.5f / (float) imageHeight; } imageLimits.set (fullWidthProportion, fullHeightProportion); @@ -1422,8 +1422,8 @@ struct GLState textureCache.bindTextureForGradient (activeTextures, g); } - auto t = transform.translated (0.5f - target.bounds.getX(), - 0.5f - target.bounds.getY()); + auto t = transform.translated (0.5f - (float) target.bounds.getX(), + 0.5f - (float) target.bounds.getY()); auto p1 = g.point1.transformedBy (t); auto p2 = g.point2.transformedBy (t); auto p3 = Point (g.point1.x + (g.point2.y - g.point1.y), diff --git a/modules/juce_osc/osc/juce_OSCTimeTag.cpp b/modules/juce_osc/osc/juce_OSCTimeTag.cpp index 857c2ea28b..c9d22b5e36 100644 --- a/modules/juce_osc/osc/juce_OSCTimeTag.cpp +++ b/modules/juce_osc/osc/juce_OSCTimeTag.cpp @@ -132,8 +132,8 @@ public: uint64 diff = laterTimeTagRaw - currentTimeTagRaw; double acceptableErrorInSeconds = 0.000001; // definitely not audible anymore. - expect (diff / float (1ULL << 32) < deltaInSeconds + acceptableErrorInSeconds ); - expect (diff / float (1ULL << 32) > deltaInSeconds - acceptableErrorInSeconds ); + expect ((float) diff / float (1ULL << 32) < deltaInSeconds + acceptableErrorInSeconds ); + expect ((float) diff / float (1ULL << 32) > deltaInSeconds - acceptableErrorInSeconds ); // round trip: diff --git a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp index a021e11cc3..b58a89ef44 100644 --- a/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp +++ b/modules/juce_product_unlocking/in_app_purchases/juce_InAppPurchases.cpp @@ -69,7 +69,7 @@ void InAppPurchases::purchaseProduct (const String& productIdentifier, Listener::PurchaseInfo purchaseInfo { Purchase { "", productIdentifier, {}, {}, {} }, {} }; listeners.call ([&] (Listener& l) { l.productPurchaseFinished (purchaseInfo, false, "In-app purchases unavailable"); }); - ignoreUnused (isSubscription, upgradeProductIdentifiers, creditForUnusedSubscription); + ignoreUnused (upgradeProductIdentifier, creditForUnusedSubscription); #endif }