summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-21 13:37:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-21 13:37:06 +0000
commit4f7479ad5bd977eff1d08c65c44cb8d3950a2d77 (patch)
treecc6d1cae52603b508fe68c0fb326050032f3ec09 /core/fxge
parent78faa4365445f69890dc990e4d07a68e68e89ae4 (diff)
downloadpdfium-4f7479ad5bd977eff1d08c65c44cb8d3950a2d77.tar.xz
Change FXSYS_RGB() to FXSYS_BGR().
Also change it from a macro to a constexpr function. Change-Id: I8b2bb42c45a23da6db136abdaee24132db4471c6 Reviewed-on: https://pdfium-review.googlesource.com/28579 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/dib/fx_dib_main.cpp2
-rw-r--r--core/fxge/fx_dib.h5
2 files changed, 4 insertions, 3 deletions
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index 6c3a236edd..002fc2e394 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -84,7 +84,7 @@ std::pair<int, FX_COLORREF> ArgbToAlphaAndColorRef(FX_ARGB argb) {
}
FX_COLORREF ArgbToColorRef(FX_ARGB argb) {
- return FXSYS_RGB(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
+ return FXSYS_BGR(FXARGB_B(argb), FXARGB_G(argb), FXARGB_R(argb));
}
FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref) {
diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h
index 4af47907ea..9acfa51bbe 100644
--- a/core/fxge/fx_dib.h
+++ b/core/fxge/fx_dib.h
@@ -74,8 +74,9 @@ extern const int16_t SDP_Table[513];
#define FXDIB_BLEND_LUMINOSITY 24
#define FXDIB_BLEND_UNSUPPORTED -1
-// TODO(thestig): Rename to FXSYS_BGR() and check callers.
-#define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
+constexpr uint32_t FXSYS_BGR(uint8_t b, uint8_t g, uint8_t r) {
+ return (b << 16) | (g << 8) | r;
+}
constexpr uint8_t FXSYS_GetRValue(uint32_t bgr) {
return bgr & 0xff;