summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-20 21:06:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-20 21:06:35 +0000
commit40d37b1a8077031a078b374eaf6644d89e506d23 (patch)
tree72928249b6b2c0c230917518a5a616cf757c0da8 /fpdfsdk
parentaff457782dcb9c2f7fa82e3c9c469182c5b8ad15 (diff)
downloadpdfium-40d37b1a8077031a078b374eaf6644d89e506d23.tar.xz
Rename "RGB" methods/variables to "ColorRef" in CPDF_ColorState.
Change-Id: I196e3148d680c9efeaf9609dd3ddbfe3f6635fa6 Reviewed-on: https://pdfium-review.googlesource.com/28576 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdfeditpath.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/fpdfsdk/fpdfeditpath.cpp b/fpdfsdk/fpdfeditpath.cpp
index a291987dce..d0a9406fd7 100644
--- a/fpdfsdk/fpdfeditpath.cpp
+++ b/fpdfsdk/fpdfeditpath.cpp
@@ -35,6 +35,14 @@ static_assert(static_cast<int>(FXPT_TYPE::BezierTo) == FPDF_SEGMENT_BEZIERTO,
static_assert(static_cast<int>(FXPT_TYPE::MoveTo) == FPDF_SEGMENT_MOVETO,
"FXPT_TYPE::MoveTo value mismatch");
+namespace {
+
+unsigned int GetAlphaAsUnsignedInt(float alpha) {
+ return static_cast<unsigned int>(alpha * 255.f + 0.5f);
+}
+
+} // namespace
+
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x,
float y) {
auto pPathObj = pdfium::MakeUnique<CPDF_PathObject>();
@@ -81,12 +89,11 @@ FPDFPath_GetStrokeColor(FPDF_PAGEOBJECT path,
if (!pPathObj || !R || !G || !B || !A)
return false;
- uint32_t strokeRGB = pPathObj->m_ColorState.GetStrokeRGB();
- *R = FXSYS_GetRValue(strokeRGB);
- *G = FXSYS_GetGValue(strokeRGB);
- *B = FXSYS_GetBValue(strokeRGB);
- *A = static_cast<unsigned int>(
- (pPathObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
+ FX_COLORREF strokeColor = pPathObj->m_ColorState.GetStrokeColorRef();
+ *R = FXSYS_GetRValue(strokeColor);
+ *G = FXSYS_GetGValue(strokeColor);
+ *B = FXSYS_GetBValue(strokeColor);
+ *A = GetAlphaAsUnsignedInt(pPathObj->m_GeneralState.GetStrokeAlpha());
return true;
}
@@ -118,12 +125,11 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
if (!pPathObj || !R || !G || !B || !A)
return false;
- uint32_t fillRGB = pPathObj->m_ColorState.GetFillRGB();
- *R = FXSYS_GetRValue(fillRGB);
- *G = FXSYS_GetGValue(fillRGB);
- *B = FXSYS_GetBValue(fillRGB);
- *A = static_cast<unsigned int>(
- (pPathObj->m_GeneralState.GetFillAlpha() * 255.f) + 0.5f);
+ FX_COLORREF fillColor = pPathObj->m_ColorState.GetFillColorRef();
+ *R = FXSYS_GetRValue(fillColor);
+ *G = FXSYS_GetGValue(fillColor);
+ *B = FXSYS_GetBValue(fillColor);
+ *A = GetAlphaAsUnsignedInt(pPathObj->m_GeneralState.GetFillAlpha());
return true;
}