Bring CmykEncode() into conformance with ArgbEncode() -- mark as constexpr. -- use unsigned shifts to avoid undefined behavior. Change-Id: I36584e7461689c29e31ae27002b452974b79e8c3 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75812 Reviewed-by: Daniel Hosseinian <dhoss@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/dib/fx_dib.h b/core/fxge/dib/fx_dib.h index a167214..78a0c4a 100644 --- a/core/fxge/dib/fx_dib.h +++ b/core/fxge/dib/fx_dib.h
@@ -7,6 +7,8 @@ #ifndef CORE_FXGE_DIB_FX_DIB_H_ #define CORE_FXGE_DIB_FX_DIB_H_ +#include <stdint.h> + #include <tuple> #include <utility> @@ -109,7 +111,7 @@ FXDIB_Format MakeRGBFormat(int bpp); -inline FX_CMYK CmykEncode(int c, int m, int y, int k) { +constexpr FX_CMYK CmykEncode(uint32_t c, uint32_t m, uint32_t y, uint32_t k) { return (c << 24) | (m << 16) | (y << 8) | k; }