1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Android: Fix numeric conversion warnings

This commit is contained in:
reuk 2021-02-02 11:12:35 +00:00
parent ef1926f916
commit 837ab64dbd
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
6 changed files with 15 additions and 15 deletions

View file

@ -228,24 +228,24 @@ private:
const float xmargin = 3.0f;
const float ymargin = 3.0f;
const float fontHeight = 0.4f * height;
const float deviceNameWidth = 0.6f * width;
const float fontHeight = 0.4f * (float) height;
const float deviceNameWidth = 0.6f * (float) width;
g.setFont (fontHeight);
g.setColour (getDeviceNameFontColour (device.connectionStatus));
g.drawText (device.name,
Rectangle<float> (xmargin, ymargin, deviceNameWidth - (2.0f * xmargin), height - (2.0f * ymargin)),
Rectangle<float> (xmargin, ymargin, deviceNameWidth - (2.0f * xmargin), (float) height - (2.0f * ymargin)),
Justification::topLeft, true);
g.setColour (getDeviceStatusFontColour (device.connectionStatus));
g.drawText (statusString,
Rectangle<float> (deviceNameWidth + xmargin, ymargin,
width - deviceNameWidth - (2.0f * xmargin), height - (2.0f * ymargin)),
(float) width - deviceNameWidth - (2.0f * xmargin), (float) height - (2.0f * ymargin)),
Justification::topRight, true);
g.setColour (Colours::grey);
g.drawHorizontalLine (height - 1, xmargin, width);
g.drawHorizontalLine (height - 1, xmargin, (float) width);
}
}

View file

@ -94,7 +94,7 @@ UnitTestAllocationChecker::UnitTestAllocationChecker (UnitTest& test)
UnitTestAllocationChecker::~UnitTestAllocationChecker() noexcept
{
getAllocationHooksForThread().removeListener (this);
unitTest.expectEquals (calls, (size_t) 0, "new or delete was incorrectly called while allocation checker was active");
unitTest.expectEquals ((int) calls, 0, "new or delete was incorrectly called while allocation checker was active");
}
void UnitTestAllocationChecker::newOrDeleteCalled() noexcept { ++calls; }

View file

@ -229,7 +229,7 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept
double Time::getMillisecondCounterHiRes() noexcept
{
return getHighResolutionTicks() * 0.001;
return (double) getHighResolutionTicks() * 0.001;
}
bool Time::setSystemTimeToThisTime() const

View file

@ -352,7 +352,7 @@ public:
LocalRef<jobject> bitmap (env->CallStaticObjectMethod (AndroidBitmap, AndroidBitmap.createBitmap, w, h, bitmapConfig.get()));
LocalRef<jobject> canvas (env->NewObject (AndroidCanvas, AndroidCanvas.create, bitmap.get()));
env->CallBooleanMethod (matrix.get(), AndroidMatrix.postTranslate, bounds.getX() * -1.0f, bounds.getY() * -1.0f);
env->CallBooleanMethod (matrix.get(), AndroidMatrix.postTranslate, (float) -bounds.getX(), (float) -bounds.getY());
env->CallVoidMethod (canvas.get(), AndroidCanvas.setMatrix, matrix.get());
env->CallVoidMethod (canvas.get(), AndroidCanvas.drawPath, path.get(), paint.get());

View file

@ -581,8 +581,8 @@ public:
return isPositiveAndBelow (localPos.x, component.getWidth())
&& isPositiveAndBelow (localPos.y, component.getHeight())
&& ((! trueIfInAChildWindow) || view.callBooleanMethod (ComponentPeerView.containsPoint,
localPos.x * scale,
localPos.y * scale));
(float) localPos.x * scale,
(float) localPos.y * scale));
}
BorderSize<int> getFrameSize() const override

View file

@ -544,7 +544,7 @@ private:
double getSpeed() const { return controller.getPlaySpeed(); }
Rectangle<int> getNativeSize() const { return player.getVideoNativeSize(); }
double getDuration() const { return player.getVideoDuration() / 1000.0; }
double getDuration() const { return (double) player.getVideoDuration() / 1000.0; }
void setVolume (float newVolume)
{
@ -578,7 +578,7 @@ private:
auto* env = getEnv();
auto pos = env->CallLongMethod (storedPlaybackState, AndroidPlaybackState.getPosition);
setPosition (pos / 1000.0);
setPosition ((double) pos / 1000.0);
setSpeed (playSpeedMult);
@ -680,7 +680,7 @@ private:
auto playbackState = LocalRef<jobject> (env->CallObjectMethod (nativeController, AndroidMediaController.getPlaybackState));
if (playbackState != nullptr)
return env->CallLongMethod (playbackState, AndroidPlaybackState.getPosition) / 1000.0;
return (double) env->CallLongMethod (playbackState, AndroidPlaybackState.getPosition) / 1000.0;
return 0.0;
}
@ -705,7 +705,7 @@ private:
auto maxVolume = env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getMaxVolume);
auto targetVolume = jmin (jint (maxVolume * newVolume), maxVolume);
auto targetVolume = jmin (jint ((float) maxVolume * newVolume), maxVolume);
static constexpr jint flagShowUI = 1;
env->CallVoidMethod (nativeController, AndroidMediaController.setVolumeTo, targetVolume, flagShowUI);
@ -720,7 +720,7 @@ private:
auto maxVolume = (int) (env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getMaxVolume));
auto curVolume = (int) (env->CallIntMethod (playbackInfo, AndroidMediaControllerPlaybackInfo.getCurrentVolume));
return static_cast<float> (curVolume) / maxVolume;
return static_cast<float> (curVolume) / (float) maxVolume;
}
private: