Retain bitmap in CPDF_RenderStatus::LoadSMask().

Avoids a warning from clang-tidy.

I believe the warning to be spurious since clang-tidy probably
can't reason about the number of other retain pointers to the
underlying object and assumes they might go to zero. Nonetheless,
we're doing enough work here that the cost of holding an additional
reference shouldn't be prohibitive, and it completely avoids the
reliance on other objects keeping the bitmap alive.

Change-Id: I554a5a7171a4c446c67441b1c67b12a7da61b2bc
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52431
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index dd67ca4..8f7dd84 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2533,14 +2533,14 @@
   if (!bitmap_device.Create(width, height, format, nullptr))
     return nullptr;
 
-  CFX_DIBitmap& bitmap = *bitmap_device.GetBitmap();
+  RetainPtr<CFX_DIBitmap> bitmap = bitmap_device.GetBitmap();
   int nCSFamily = 0;
   if (bLuminosity) {
     FX_ARGB back_color =
         GetBackColor(pSMaskDict, pGroup->GetDict(), &nCSFamily);
-    bitmap.Clear(back_color);
+    bitmap->Clear(back_color);
   } else {
-    bitmap.Clear(0);
+    bitmap->Clear(0);
   }
 
   const CPDF_Dictionary* pFormResource = nullptr;
@@ -2565,8 +2565,8 @@
 
   uint8_t* dest_buf = pMask->GetBuffer();
   int dest_pitch = pMask->GetPitch();
-  uint8_t* src_buf = bitmap.GetBuffer();
-  int src_pitch = bitmap.GetPitch();
+  uint8_t* src_buf = bitmap->GetBuffer();
+  int src_pitch = bitmap->GetPitch();
   std::vector<uint8_t> transfers(256);
   if (pFunc) {
     std::vector<float> results(pFunc->CountOutputs());
@@ -2582,7 +2582,7 @@
     }
   }
   if (bLuminosity) {
-    int Bpp = bitmap.GetBPP() / 8;
+    int Bpp = bitmap->GetBPP() / 8;
     for (int row = 0; row < height; row++) {
       uint8_t* dest_pos = dest_buf + row * dest_pitch;
       uint8_t* src_pos = src_buf + row * src_pitch;