summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
-rw-r--r--core/fxge/dib/fx_dib_main.cpp6
-rw-r--r--core/fxge/fx_dib.h6
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp7
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp5
-rw-r--r--xfa/fxfa/parser/cxfa_stipple.cpp2
6 files changed, 16 insertions, 14 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index a0b6713274..d5204fe500 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -1373,7 +1373,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(CPDF_PageObject* pObj,
pObj->m_GeneralState.GetTransferFunc()->TranslateColor(colorref);
}
}
- return m_Options.TranslateColor(ArgbEncode(alpha, colorref));
+ return m_Options.TranslateColor(AlphaAndColorRefToArgb(alpha, colorref));
}
FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
@@ -1400,7 +1400,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(CPDF_PageObject* pObj) const {
pObj->m_GeneralState.GetTransferFunc()->TranslateColor(colorref);
}
}
- return m_Options.TranslateColor(ArgbEncode(alpha, colorref));
+ return m_Options.TranslateColor(AlphaAndColorRefToArgb(alpha, colorref));
}
void CPDF_RenderStatus::ProcessClipPath(const CPDF_ClipPath& ClipPath,
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index 5d7b585979..6c3a236edd 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -87,9 +87,9 @@ FX_COLORREF ArgbToColorRef(FX_ARGB argb) {
return FXSYS_RGB(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
}
-uint32_t ArgbEncode(int a, FX_COLORREF bgr) {
- return FXARGB_MAKE(a, FXSYS_GetRValue(bgr), FXSYS_GetGValue(bgr),
- FXSYS_GetBValue(bgr));
+FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref) {
+ return FXARGB_MAKE(a, FXSYS_GetRValue(colorref), FXSYS_GetGValue(colorref),
+ FXSYS_GetBValue(colorref));
}
FX_ARGB StringToFXARGB(const WideStringView& wsValue) {
diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h
index 5dcfac4962..0878dfd7fd 100644
--- a/core/fxge/fx_dib.h
+++ b/core/fxge/fx_dib.h
@@ -99,11 +99,11 @@ std::pair<int, FX_COLORREF> 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) {
+constexpr FX_ARGB ArgbEncode(int a, int r, int g, int b) {
return (a << 24) | (r << 16) | (g << 8) | b;
}
-// TODO(thestig): Rename to AlphaAndColorRefToArgb().
-FX_ARGB ArgbEncode(int a, FX_COLORREF bgr);
+
+FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref);
FX_ARGB StringToFXARGB(const WideStringView& view);
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 6d81829bc9..055ad63aa5 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -707,9 +707,10 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
rcDevice.Normalize();
FX_RECT rcDev = rcDevice.ToFxRect();
- pDevice->FillRect(
- &rcDev, ArgbEncode(static_cast<int>(m_pInterForm->GetHighlightAlpha()),
- m_pInterForm->GetHighlightColor(fieldType)));
+ pDevice->FillRect(&rcDev,
+ AlphaAndColorRefToArgb(
+ static_cast<int>(m_pInterForm->GetHighlightAlpha()),
+ m_pInterForm->GetHighlightColor(fieldType)));
}
CFX_FloatRect CPDFSDK_Widget::GetClientRect() const {
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 0833759429..cb6ce1ccf8 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -596,8 +596,9 @@ FX_ARGB CPDFXFA_DocEnvironment::GetHighlightColor(CXFA_FFDoc* hDoc) {
if (!pInterForm)
return 0;
- return ArgbEncode(pInterForm->GetHighlightAlpha(),
- pInterForm->GetHighlightColor(FormFieldType::kXFA));
+ return AlphaAndColorRefToArgb(
+ pInterForm->GetHighlightAlpha(),
+ pInterForm->GetHighlightColor(FormFieldType::kXFA));
}
bool CPDFXFA_DocEnvironment::NotifySubmit(bool bPrevOrPost) {
diff --git a/xfa/fxfa/parser/cxfa_stipple.cpp b/xfa/fxfa/parser/cxfa_stipple.cpp
index 2c36e11353..19ca0ca403 100644
--- a/xfa/fxfa/parser/cxfa_stipple.cpp
+++ b/xfa/fxfa/parser/cxfa_stipple.cpp
@@ -64,7 +64,7 @@ void CXFA_Stipple::Draw(CXFA_Graphics* pGS,
int32_t alpha;
FX_COLORREF colorref;
std::tie(alpha, colorref) = ArgbToAlphaAndColorRef(crColor);
- FX_ARGB cr = ArgbEncode(iRate * alpha / 100, colorref);
+ FX_ARGB cr = AlphaAndColorRefToArgb(iRate * alpha / 100, colorref);
pGS->SaveGraphState();
pGS->SetFillColor(CXFA_GEColor(cr));