Improve comments and naming in calculate_pitch.h

Change-Id: I73b557bac38ffa9097eeffb973ee676ef3371499
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117931
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/calculate_pitch.cpp b/core/fxge/calculate_pitch.cpp
index 14390b1..2831d83 100644
--- a/core/fxge/calculate_pitch.cpp
+++ b/core/fxge/calculate_pitch.cpp
@@ -32,25 +32,32 @@
 
 }  // namespace
 
-uint32_t CalculatePitch8OrDie(uint32_t bpc, uint32_t components, int width) {
-  return CalculatePitch8Safely(bpc, components, width).ValueOrDie();
+uint32_t CalculatePitch8OrDie(uint32_t bits_per_component,
+                              uint32_t components_per_pixel,
+                              int width_in_pixels) {
+  return CalculatePitch8Safely(bits_per_component, components_per_pixel,
+                               width_in_pixels)
+      .ValueOrDie();
 }
 
-uint32_t CalculatePitch32OrDie(int bpp, int width) {
-  return CalculatePitch32Safely(bpp, width).ValueOrDie();
+uint32_t CalculatePitch32OrDie(int bits_per_pixel, int width_in_pixels) {
+  return CalculatePitch32Safely(bits_per_pixel, width_in_pixels).ValueOrDie();
 }
 
-std::optional<uint32_t> CalculatePitch8(uint32_t bpc,
+std::optional<uint32_t> CalculatePitch8(uint32_t bits_per_component,
                                         uint32_t components,
-                                        int width) {
-  FX_SAFE_UINT32 pitch = CalculatePitch8Safely(bpc, components, width);
+                                        int width_in_pixels) {
+  FX_SAFE_UINT32 pitch =
+      CalculatePitch8Safely(bits_per_component, components, width_in_pixels);
   if (!pitch.IsValid())
     return std::nullopt;
   return pitch.ValueOrDie();
 }
 
-std::optional<uint32_t> CalculatePitch32(int bpp, int width) {
-  FX_SAFE_UINT32 pitch = CalculatePitch32Safely(bpp, width);
+std::optional<uint32_t> CalculatePitch32(int bits_per_pixel,
+                                         int width_in_pixels) {
+  FX_SAFE_UINT32 pitch =
+      CalculatePitch32Safely(bits_per_pixel, width_in_pixels);
   if (!pitch.IsValid())
     return std::nullopt;
   return pitch.ValueOrDie();
diff --git a/core/fxge/calculate_pitch.h b/core/fxge/calculate_pitch.h
index 5aefc92..fdeeb8f 100644
--- a/core/fxge/calculate_pitch.h
+++ b/core/fxge/calculate_pitch.h
@@ -11,12 +11,24 @@
 
 namespace fxge {
 
-uint32_t CalculatePitch8OrDie(uint32_t bpc, uint32_t components, int width);
-uint32_t CalculatePitch32OrDie(int bpp, int width);
-std::optional<uint32_t> CalculatePitch8(uint32_t bpc,
-                                        uint32_t components,
-                                        int width);
-std::optional<uint32_t> CalculatePitch32(int bpp, int width);
+// Returns the bytes between successive rows of an image where rows are aligned
+// on a byte boundary and there is no additional padding beyond that, or nullopt
+// if the result can not fit in a uint32_t.
+std::optional<uint32_t> CalculatePitch8(uint32_t bits_per_component,
+                                        uint32_t components_per_pixel,
+                                        int width_in_pixels);
+
+// Returns the bytes between successive rows of an image where rows are aligned
+// on a 32-bit word boundary and there is no additional padding beyond that, or
+// nullopt if the result can not fit in a uint32_t.
+std::optional<uint32_t> CalculatePitch32(int bits_per_pixel,
+                                         int width_in_pixels);
+
+// Same as above, but terminate if the result can not fit in a uint32_t.
+uint32_t CalculatePitch8OrDie(uint32_t bits_per_component,
+                              uint32_t components_per_pixel,
+                              int width_in_pixels);
+uint32_t CalculatePitch32OrDie(int bits_per_pixel, int width_in_pixels);
 
 }  // namespace fxge