summaryrefslogtreecommitdiff
path: root/core/fxge/win32
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-20 15:25:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-20 15:25:57 +0000
commit2e6405c333d8daae4e3edaa6b48f5ac5a8d7675b (patch)
treedf8f6a28b695c34407b3bbe28220584f421afc0e /core/fxge/win32
parentb3a5240832fce3f0b706c16070a1e69c2c1edb86 (diff)
downloadpdfium-2e6405c333d8daae4e3edaa6b48f5ac5a8d7675b.tar.xz
Change ArgbToColorRef() to ArgbToAlphaAndColorRef().chromium/3377
Since that is what it really returns. Add a replacement ArgbToColorRef() that only returns a FX_COLORREF, and remove a duplicate implementation. Then update callers and only use ArgbToAlphaAndColorRef() where appropriate. Also update comments to explain what FX_COLORREF is. Change-Id: I5ed3d71683898dc2b3a66395dea0ec2562c14a68 Reviewed-on: https://pdfium-review.googlesource.com/28575 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/win32')
-rw-r--r--core/fxge/win32/fx_win32_device.cpp27
-rw-r--r--core/fxge/win32/fx_win32_print.cpp6
2 files changed, 13 insertions, 20 deletions
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 673593cdda..b857dde91b 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -132,11 +132,9 @@ HPEN CreateExtPen(const CFX_GraphStateData* pGraphState,
break;
}
- int a;
- FX_COLORREF bgr;
- std::tie(a, bgr) = ArgbToColorRef(argb);
+ FX_COLORREF colorref = ArgbToColorRef(argb);
LOGBRUSH lb;
- lb.lbColor = bgr;
+ lb.lbColor = colorref;
lb.lbStyle = BS_SOLID;
lb.lbHatch = 0;
std::vector<uint32_t> dashes;
@@ -155,10 +153,7 @@ HPEN CreateExtPen(const CFX_GraphStateData* pGraphState,
}
HBRUSH CreateBrush(uint32_t argb) {
- int a;
- FX_COLORREF bgr;
- std::tie(a, bgr) = ArgbToColorRef(argb);
- return CreateSolidBrush(bgr);
+ return CreateSolidBrush(ArgbToColorRef(argb));
}
void SetPathToDC(HDC hDC,
@@ -1073,15 +1068,15 @@ bool CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
return false;
int alpha;
- FX_COLORREF bgr;
- std::tie(alpha, bgr) = ArgbToColorRef(fill_color);
+ FX_COLORREF colorref;
+ std::tie(alpha, colorref) = ArgbToAlphaAndColorRef(fill_color);
if (alpha == 0)
return true;
if (alpha < 255)
return false;
- HBRUSH hBrush = CreateSolidBrush(bgr);
+ HBRUSH hBrush = CreateSolidBrush(colorref);
::FillRect(m_hDC, (RECT*)pRect, hBrush);
DeleteObject(hBrush);
return true;
@@ -1126,13 +1121,13 @@ bool CGdiDeviceDriver::DrawCosmeticLine(const CFX_PointF& ptMoveTo,
if (blend_type != FXDIB_BLEND_NORMAL)
return false;
- int a;
- FX_COLORREF bgr;
- std::tie(a, bgr) = ArgbToColorRef(color);
- if (a == 0)
+ int alpha;
+ FX_COLORREF colorref;
+ std::tie(alpha, colorref) = ArgbToAlphaAndColorRef(color);
+ if (alpha == 0)
return true;
- HPEN hPen = CreatePen(PS_SOLID, 1, bgr);
+ HPEN hPen = CreatePen(PS_SOLID, 1, colorref);
hPen = (HPEN)SelectObject(m_hDC, hPen);
MoveToEx(m_hDC, FXSYS_round(ptMoveTo.x), FXSYS_round(ptMoveTo.y), nullptr);
LineTo(m_hDC, FXSYS_round(ptLineTo.x), FXSYS_round(ptLineTo.y));
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index f2ae8a726e..66fbdd9b02 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -280,10 +280,8 @@ bool CGdiPrinterDriver::DrawDeviceText(int nChars,
ModifyWorldTransform(m_hDC, &xform, MWT_LEFTMULTIPLY);
// Color
- int iUnusedAlpha;
- FX_COLORREF bgr;
- std::tie(iUnusedAlpha, bgr) = ArgbToColorRef(color);
- SetTextColor(m_hDC, bgr);
+ FX_COLORREF colorref = ArgbToColorRef(color);
+ SetTextColor(m_hDC, colorref);
SetBkMode(m_hDC, TRANSPARENT);
// Text