Bug 957904: Fix signed/unsigned comparison build warnings in CompositorD3D11.cpp. r=nrc
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 09 Jan 2014 06:26:20 -0800
changeset 178714 28531e5859c9180567939191ab066246f2a3d666
parent 178713 2189ba4114f5e4dd5f52b6d172cf391ffb336957
child 178715 fdc99101203985da7abef6679591a6997836dfa6
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnrc
bugs957904
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 957904: Fix signed/unsigned comparison build warnings in CompositorD3D11.cpp. r=nrc
gfx/layers/d3d11/CompositorD3D11.cpp
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -423,18 +423,20 @@ CompositorD3D11::CreateRenderTargetFromS
     srcBox.left = aSourcePoint.x;
     srcBox.top = aSourcePoint.y;
     srcBox.front = 0;
     srcBox.right = aSourcePoint.x + aRect.width;
     srcBox.bottom = aSourcePoint.y + aRect.height;
     srcBox.back = 0;
 
     const IntSize& srcSize = sourceD3D11->GetSize();
-    if (srcBox.right <= srcSize.width &&
-        srcBox.bottom <= srcSize.height) {
+    MOZ_ASSERT(srcSize.width >= 0 && srcSize.height >= 0,
+               "render targets should have nonnegative sizes");
+    if (srcBox.right <= static_cast<uint32_t>(srcSize.width) &&
+        srcBox.bottom <= static_cast<uint32_t>(srcSize.height)) {
       mContext->CopySubresourceRegion(texture, 0,
                                       0, 0, 0,
                                       sourceD3D11->GetD3D11Texture(), 0,
                                       &srcBox);
     } else {
       NS_WARNING("Could not copy render target - source rect out of bounds");
     }
   }