Bug 1577236 - clang-10: Fix -Wimplicit-int-float-conversion warnings in gfx/ r=nical

Differential Revision: https://phabricator.services.mozilla.com/D43776

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-08-28 21:31:26 +00:00
parent bbfc6ecf78
commit 843fae6aee
6 changed files with 23 additions and 23 deletions

View File

@ -1052,9 +1052,9 @@ void BasicCompositor::EndFrame() {
mRenderTarget->mDrawTarget->PopClip();
if (StaticPrefs::nglayout_debug_widget_update_flashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
// We're still clipped to mInvalidRegion, so just fill the bounds.
mRenderTarget->mDrawTarget->FillRect(
IntRectToRect(mInvalidRegion.GetBounds()).ToUnknownRect(),

View File

@ -663,9 +663,9 @@ bool BasicLayerManager::EndTransactionInternal(
void BasicLayerManager::FlashWidgetUpdateArea(gfxContext* aContext) {
if (StaticPrefs::nglayout_debug_widget_update_flashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
aContext->SetColor(Color(r, g, b, 0.2f));
aContext->Paint();
}

View File

@ -1903,9 +1903,9 @@ void CompositorOGL::EndFrame() {
#endif
if (StaticPrefs::nglayout_debug_widget_update_flashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
EffectChain effectChain;
effectChain.mPrimaryEffect = new EffectSolidColor(Color(r, g, b, 0.2f));
// If we're clipping the render target to the invalid rect, then the

View File

@ -2108,9 +2108,9 @@ static bool PaintItemByDrawTarget(nsDisplayItem* aItem, gfx::DrawTarget* aDT,
}
if (aItem->Frame()->PresContext()->GetPaintFlashing() && isInvalidated) {
aDT->SetTransform(gfx::Matrix());
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
aDT->FillRect(Rect(aDT->GetRect()),
gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
}

View File

@ -92,10 +92,10 @@ inline nscoord NSToCoordRound(double aValue) {
inline nscoord NSToCoordRoundWithClamp(float aValue) {
#ifndef NS_COORD_IS_FLOAT
// Bounds-check before converting out of float, to avoid overflow
if (aValue >= nscoord_MAX) {
if (aValue >= float(nscoord_MAX)) {
return nscoord_MAX;
}
if (aValue <= nscoord_MIN) {
if (aValue <= float(nscoord_MIN)) {
return nscoord_MIN;
}
#endif
@ -238,10 +238,10 @@ inline nscoord NSToCoordFloor(double aValue) { return nscoord(floor(aValue)); }
inline nscoord NSToCoordFloorClamped(float aValue) {
#ifndef NS_COORD_IS_FLOAT
// Bounds-check before converting out of float, to avoid overflow
if (aValue >= nscoord_MAX) {
if (aValue >= float(nscoord_MAX)) {
return nscoord_MAX;
}
if (aValue <= nscoord_MIN) {
if (aValue <= float(nscoord_MIN)) {
return nscoord_MIN;
}
#endif
@ -284,10 +284,10 @@ inline nscoord NSToCoordTrunc(double aValue) {
inline nscoord NSToCoordTruncClamped(float aValue) {
#ifndef NS_COORD_IS_FLOAT
// Bounds-check before converting out of float, to avoid overflow
if (aValue >= nscoord_MAX) {
if (aValue >= float(nscoord_MAX)) {
return nscoord_MAX;
}
if (aValue <= nscoord_MIN) {
if (aValue <= float(nscoord_MIN)) {
return nscoord_MIN;
}
#endif
@ -297,10 +297,10 @@ inline nscoord NSToCoordTruncClamped(float aValue) {
inline nscoord NSToCoordTruncClamped(double aValue) {
#ifndef NS_COORD_IS_FLOAT
// Bounds-check before converting out of double, to avoid overflow
if (aValue >= nscoord_MAX) {
if (aValue >= float(nscoord_MAX)) {
return nscoord_MAX;
}
if (aValue <= nscoord_MIN) {
if (aValue <= float(nscoord_MIN)) {
return nscoord_MIN;
}
#endif

View File

@ -433,9 +433,9 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob,
if (StaticPrefs::gfx_webrender_blob_paint_flashing()) {
dt->SetTransform(gfx::Matrix());
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;
float r = float(rand()) / float(RAND_MAX);
float g = float(rand()) / float(RAND_MAX);
float b = float(rand()) / float(RAND_MAX);
dt->FillRect(gfx::Rect(origin.x, origin.y, aSize.width, aSize.height),
gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
}