From a46c484afb91b6486835b117d582521d2befc70f Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 15 Sep 2021 14:40:30 +0100 Subject: [PATCH] Fix some conversion warnings flagged up by Android Studio --- .../buffers/juce_FloatVectorOperations.cpp | 2 +- .../native/juce_android_CameraDevice.h | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp index 5a51099451..0b94dfbef7 100644 --- a/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp +++ b/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp @@ -873,7 +873,7 @@ void FloatVectorOperations::abs (double* dest, const double* src, int num) noexc void JUCE_CALLTYPE FloatVectorOperations::convertFixedToFloat (float* dest, const int* src, float multiplier, int num) noexcept { #if JUCE_USE_ARM_NEON - JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = src[i] * multiplier, + JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = (float) src[i] * multiplier, vmulq_n_f32 (vcvtq_f32_s32 (vld1q_s32 (src)), multiplier), JUCE_LOAD_NONE, JUCE_INCREMENT_SRC_DEST, ) #else diff --git a/modules/juce_video/native/juce_android_CameraDevice.h b/modules/juce_video/native/juce_android_CameraDevice.h index a131e4467c..692b12e448 100644 --- a/modules/juce_video/native/juce_android_CameraDevice.h +++ b/modules/juce_video/native/juce_android_CameraDevice.h @@ -1067,8 +1067,8 @@ private: if (rotation == rotation90 || rotation == rotation270) { - env->CallBooleanMethod (matrix, AndroidMatrix.postScale, jfloat (height / (float) width), jfloat (width / (float) height), (jfloat) 0, (jfloat) 0); - env->CallBooleanMethod (matrix, AndroidMatrix.postRotate, (jfloat) 90 * (rotation - 2), (jfloat) 0, (jfloat) 0); + env->CallBooleanMethod (matrix, AndroidMatrix.postScale, jfloat ((float) height / (float) width), jfloat ((float) width / (float) height), (jfloat) 0, (jfloat) 0); + env->CallBooleanMethod (matrix, AndroidMatrix.postRotate, (jfloat) 90 * ((float) rotation - 2), (jfloat) 0, (jfloat) 0); env->CallBooleanMethod (matrix, AndroidMatrix.postTranslate, (jfloat) (rotation == 3 ? width : 0), (jfloat) (rotation == 1 ? height : 0)); } @@ -3216,7 +3216,7 @@ struct CameraDevice::ViewerComponent : public Component, { auto previewSize = device.pimpl->streamConfigurationMap.getDefaultPreviewSize(); - targetAspectRatio = previewSize.getWidth() / (float) previewSize.getHeight(); + targetAspectRatio = (float) previewSize.getWidth() / (float) previewSize.getHeight(); if (isOrientationLandscape()) setBounds (previewSize); @@ -3234,31 +3234,31 @@ private: void componentMovedOrResized (bool, bool) override { - auto b = getLocalBounds(); + auto b = getLocalBounds().toFloat(); auto targetWidth = b.getWidth(); auto targetHeight = b.getHeight(); if (isOrientationLandscape()) { - auto currentAspectRatio = b.getWidth() / (float) b.getHeight(); + auto currentAspectRatio = b.getWidth() / b.getHeight(); if (currentAspectRatio > targetAspectRatio) - targetWidth = static_cast (targetWidth * targetAspectRatio / currentAspectRatio); + targetWidth = targetWidth * targetAspectRatio / currentAspectRatio; else - targetHeight = static_cast (targetHeight * currentAspectRatio / targetAspectRatio); + targetHeight = targetHeight * currentAspectRatio / targetAspectRatio; } else { - auto currentAspectRatio = b.getHeight() / (float) b.getWidth(); + auto currentAspectRatio = b.getHeight() / b.getWidth(); if (currentAspectRatio > targetAspectRatio) - targetHeight = static_cast (targetHeight * targetAspectRatio / currentAspectRatio); + targetHeight = targetHeight * targetAspectRatio / currentAspectRatio; else - targetWidth = static_cast (targetWidth * currentAspectRatio / targetAspectRatio); + targetWidth = targetWidth * currentAspectRatio / targetAspectRatio; } - viewerComponent.setBounds (Rectangle (0, 0, targetWidth, targetHeight).withCentre (b.getCentre())); + viewerComponent.setBounds (Rectangle (targetWidth, targetHeight).withCentre (b.getCentre()).toNearestInt()); } bool isOrientationLandscape() const