Use fxcrt::Zip() in CPDF_DIB::LoadJpxBitmap()

Appears to avoid two branches from CHECKS()s in a release build.

Change-Id: I36c3af4cd00b2ca523bc4edbc47836135ed6ac73
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/121390
Reviewed-by: Tom Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_dib.cpp b/core/fpdfapi/page/cpdf_dib.cpp
index 6bb3c2e..b46cac6 100644
--- a/core/fpdfapi/page/cpdf_dib.cpp
+++ b/core/fpdfapi/page/cpdf_dib.cpp
@@ -40,6 +40,7 @@
 #include "core/fxcrt/fx_memcpy_wrappers.h"
 #include "core/fxcrt/fx_safe_types.h"
 #include "core/fxcrt/stl_util.h"
+#include "core/fxcrt/zip.h"
 #include "core/fxge/calculate_pitch.h"
 #include "core/fxge/dib/cfx_dibitmap.h"
 
@@ -765,16 +766,13 @@
             result_bitmap->GetScanlineAs<FX_BGRA_STRUCT<uint8_t>>(row).first(
                 image_info.width);
         auto dest =
-            rgb_bitmap->GetWritableScanlineAs<FX_BGR_STRUCT<uint8_t>>(row)
-                .first(image_info.width);
-        for (const auto& input : src) {
-          auto& output = dest.front();
+            rgb_bitmap->GetWritableScanlineAs<FX_BGR_STRUCT<uint8_t>>(row);
+        for (auto [input, output] : fxcrt::Zip(src, dest)) {
           m_JpxInlineData.data.push_back(input.alpha);
           const uint8_t na = 255 - input.alpha;
           output.blue = (input.blue * input.alpha + 255 * na) / 255;
           output.green = (input.green * input.alpha + 255 * na) / 255;
           output.red = (input.red * input.alpha + 255 * na) / 255;
-          dest = dest.subspan(1);
         }
       }
     } else {
@@ -784,14 +782,11 @@
             result_bitmap->GetScanlineAs<FX_BGRA_STRUCT<uint8_t>>(row).first(
                 image_info.width);
         auto dest =
-            rgb_bitmap->GetWritableScanlineAs<FX_BGR_STRUCT<uint8_t>>(row)
-                .first(image_info.width);
-        for (const auto& input : src) {
-          auto& output = dest.front();
+            rgb_bitmap->GetWritableScanlineAs<FX_BGR_STRUCT<uint8_t>>(row);
+        for (auto [input, output] : fxcrt::Zip(src, dest)) {
           output.green = input.green;
           output.red = input.red;
           output.blue = input.blue;
-          dest = dest.subspan(1);
         }
       }
     }