From 04e4dc88da34c323e7a16586bddf377a610d63c5 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 18 Oct 2017 12:17:14 -0400 Subject: Fix rounding of colour values This CL fixes rounding issues with the colour values when written then read from path objects. Bug: pdfium:919 Change-Id: I8ab33706f1c7d81c3ec755706b1a613cf2a557b3 Reviewed-on: https://pdfium-review.googlesource.com/16270 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/fpdfeditpath.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fpdfsdk/fpdfeditpath.cpp') diff --git a/fpdfsdk/fpdfeditpath.cpp b/fpdfsdk/fpdfeditpath.cpp index 30c6cb0698..a291987dce 100644 --- a/fpdfsdk/fpdfeditpath.cpp +++ b/fpdfsdk/fpdfeditpath.cpp @@ -85,8 +85,8 @@ FPDFPath_GetStrokeColor(FPDF_PAGEOBJECT path, *R = FXSYS_GetRValue(strokeRGB); *G = FXSYS_GetGValue(strokeRGB); *B = FXSYS_GetBValue(strokeRGB); - *A = static_cast(pPathObj->m_GeneralState.GetStrokeAlpha() * - 255.f); + *A = static_cast( + (pPathObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f); return true; } @@ -122,8 +122,8 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetFillColor(FPDF_PAGEOBJECT path, *R = FXSYS_GetRValue(fillRGB); *G = FXSYS_GetGValue(fillRGB); *B = FXSYS_GetBValue(fillRGB); - *A = static_cast(pPathObj->m_GeneralState.GetFillAlpha() * - 255.f); + *A = static_cast( + (pPathObj->m_GeneralState.GetFillAlpha() * 255.f) + 0.5f); return true; } -- cgit v1.2.3