Avoid mips as identifier because it fails on mips* arch
authorTimo Röhling <roehling@debian.org>
Mon, 7 Feb 2022 09:30:35 +0000 (10:30 +0100)
committerTimo Röhling <roehling@debian.org>
Thu, 16 Jun 2022 16:58:59 +0000 (17:58 +0100)
Gbp-Pq: Name 0014-Avoid-mips-as-identifier-because-it-fails-on-mips-ar.patch

libs/image/src/ImageSampler.cpp
libs/image/tests/test_image.cpp

index 53c68e8f1289f8b605e5f17ff3210b3cf4dbcdc8..80ae4b79ac3f03f2d4a18ff7ce9c5b3afd8ccfab 100644 (file)
@@ -339,11 +339,11 @@ void computeSingleSample(const LinearImage& source, float x, float y, SingleSamp
 
 // Unlike traditional mipmap generation, our implementation generates all levels from the original
 // image, under the premise that this produces a higher quality result.
-void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mips) {
-    mips = std::min(mips, getMipmapCount(source));
+void generateMipmaps(const LinearImage& source, Filter filter, LinearImage* result, uint32_t mipCount) {
+    mipCount = std::min(mipCount, getMipmapCount(source));
     uint32_t width = source.getWidth();
     uint32_t height = source.getHeight();
-    for (uint32_t n = 0; n < mips; ++n) {
+    for (uint32_t n = 0; n < mipCount; ++n) {
         width = std::max(width >> 1u, 1u);
         height = std::max(height >> 1u, 1u);
         result[n] = resampleImage(source, width, height, filter);
index 963515a414667f64f0bfb244ff97917df4ea137e..7ceb323124cf7ce53ecbc48911ed5730c3119b6b 100644 (file)
@@ -342,11 +342,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT
             "44444 41014 40704 41014 44444 44444 41014 40704 41014 44444");
     uint32_t count = getMipmapCount(src);
     ASSERT_EQ(count, 3);
-    vector<LinearImage> mips(count);
-    generateMipmaps(src, filter, mips.data(), count);
+    vector<LinearImage> mipmaps(count);
+    generateMipmaps(src, filter, mipmaps.data(), count);
     updateOrCompare(src, "mip0_5x10.png");
     for (uint32_t index = 0; index < count; ++index) {
-        updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_5x10.png");
+        updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_5x10.png");
     }
 
     // Test color space with a classic RED => GREEN color gradient.
@@ -354,11 +354,11 @@ TEST_F(ImageTest, Mipmaps) { // NOLINT
     src = resampleImage(src, 200, 100, Filter::NEAREST);
     count = getMipmapCount(src);
     ASSERT_EQ(count, 7);
-    mips.resize(count);
-    generateMipmaps(src, filter, mips.data(), count);
+    mipmaps.resize(count);
+    generateMipmaps(src, filter, mipmaps.data(), count);
     updateOrCompare(src, "mip0_200x100.png");
     for (uint32_t index = 0; index < count; ++index) {
-        updateOrCompare(mips[index], "mip" + std::to_string(index + 1) + "_200x100.png");
+        updateOrCompare(mipmaps[index], "mip" + std::to_string(index + 1) + "_200x100.png");
     }
 }