From 2e6405c333d8daae4e3edaa6b48f5ac5a8d7675b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 20 Mar 2018 15:25:57 +0000 Subject: Change ArgbToColorRef() to ArgbToAlphaAndColorRef(). Since that is what it really returns. Add a replacement ArgbToColorRef() that only returns a FX_COLORREF, and remove a duplicate implementation. Then update callers and only use ArgbToAlphaAndColorRef() where appropriate. Also update comments to explain what FX_COLORREF is. Change-Id: I5ed3d71683898dc2b3a66395dea0ec2562c14a68 Reviewed-on: https://pdfium-review.googlesource.com/28575 Reviewed-by: dsinclair Commit-Queue: dsinclair --- core/fxge/fx_dib.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'core/fxge/fx_dib.h') diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h index 8134c5066d..5dcfac4962 100644 --- a/core/fxge/fx_dib.h +++ b/core/fxge/fx_dib.h @@ -37,9 +37,13 @@ struct PixelWeight { int m_Weights[1]; }; -typedef uint32_t FX_ARGB; -typedef uint32_t FX_COLORREF; -typedef uint32_t FX_CMYK; +using FX_ARGB = uint32_t; + +// FX_COLORREF, like win32 COLORREF, is BGR. +using FX_COLORREF = uint32_t; + +using FX_CMYK = uint32_t; + class CFX_ClipRgn; class CFX_DIBSource; class CStretchEngine; @@ -86,11 +90,14 @@ inline FX_CMYK CmykEncode(int c, int m, int y, int k) { return (c << 24) | (m << 16) | (y << 8) | k; } -// Returns tuple a, r, g, b +// Returns (a, r, g, b) std::tuple ArgbDecode(FX_ARGB argb); -// Returns pair a, rgb -std::pair ArgbToColorRef(FX_ARGB argb); +// Returns (a, FX_COLORREF) +std::pair ArgbToAlphaAndColorRef(FX_ARGB argb); + +// Returns FX_COLORREF. +FX_COLORREF ArgbToColorRef(FX_ARGB argb); inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { return (a << 24) | (r << 16) | (g << 8) | b; -- cgit v1.2.3