diff options
author | Lei Zhang <thestig@chromium.org> | 2018-03-21 13:35:36 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-21 13:35:36 +0000 |
commit | 78faa4365445f69890dc990e4d07a68e68e89ae4 (patch) | |
tree | f5b1ac5ad51b4367ed34a88ca0f083446e91f4f2 | |
parent | 9a635e8127880dd93b2abc5e8da6a45046d35e31 (diff) | |
download | pdfium-78faa4365445f69890dc990e4d07a68e68e89ae4.tar.xz |
Change FXSYS_Get{R,G,B}Value()'s input param to BGR.
Also change them from macros to constexpr functions.
Change-Id: I5ebec07487b7b7f59cc769debc95c730776d4613
Reviewed-on: https://pdfium-review.googlesource.com/28578
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.h | 2 | ||||
-rw-r--r-- | core/fxge/fx_dib.h | 16 |
3 files changed, 15 insertions, 7 deletions
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index a9764e7550..ae9bf244f0 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -682,7 +682,7 @@ void CFX_DIBitmap::DownSampleScanline(int line, } } -void CFX_DIBitmap::ConvertRGBColorScale(uint32_t forecolor, +void CFX_DIBitmap::ConvertBGRColorScale(uint32_t forecolor, uint32_t backcolor) { int fr = FXSYS_GetRValue(forecolor); int fg = FXSYS_GetGValue(forecolor); @@ -807,7 +807,7 @@ bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) { if (IsCmykImage()) ConvertCMYKColorScale(forecolor, backcolor); else - ConvertRGBColorScale(forecolor, backcolor); + ConvertBGRColorScale(forecolor, backcolor); return true; } diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index 7240829773..00a145af68 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h @@ -122,7 +122,7 @@ class CFX_DIBitmap : public CFX_DIBSource { #endif private: - void ConvertRGBColorScale(uint32_t forecolor, uint32_t backcolor); + void ConvertBGRColorScale(uint32_t forecolor, uint32_t backcolor); void ConvertCMYKColorScale(uint32_t forecolor, uint32_t backcolor); }; diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h index 0878dfd7fd..4af47907ea 100644 --- a/core/fxge/fx_dib.h +++ b/core/fxge/fx_dib.h @@ -76,10 +76,18 @@ extern const int16_t SDP_Table[513]; // TODO(thestig): Rename to FXSYS_BGR() and check callers. #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) -// TODO(thestig): Rename parameter to |bgr| and check callers. -#define FXSYS_GetRValue(rgb) ((rgb)&0xff) -#define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) -#define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) + +constexpr uint8_t FXSYS_GetRValue(uint32_t bgr) { + return bgr & 0xff; +} + +constexpr uint8_t FXSYS_GetGValue(uint32_t bgr) { + return (bgr >> 8) & 0xff; +} + +constexpr uint8_t FXSYS_GetBValue(uint32_t bgr) { + return (bgr >> 16) & 0xff; +} #define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) #define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) |