diff options
author | Lei Zhang <thestig@chromium.org> | 2018-03-21 17:24:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-03-21 17:24:46 +0000 |
commit | 3851aff62c7ad2f9c942b4d5d095ec0e6610bb84 (patch) | |
tree | c15c662f2f9ac851c33fe1603057088d4eb319b5 /core/fxge/dib/fx_dib_main.cpp | |
parent | bf85feeafdd8791f9dab7bfcd14ff850e015be26 (diff) | |
download | pdfium-3851aff62c7ad2f9c942b4d5d095ec0e6610bb84.tar.xz |
Add helpers to work with FXDIB_Format.
Helper functions make getting the bpp and component count more readable.
Change-Id: Ie0f97d52136d11ef5251f6e22748e87aea289ae1
Reviewed-on: https://pdfium-review.googlesource.com/28572
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxge/dib/fx_dib_main.cpp')
-rw-r--r-- | core/fxge/dib/fx_dib_main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index 002fc2e394..546198b7a9 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -50,7 +50,7 @@ const int16_t SDP_Table[513] = { 0, 0, 0, }; -FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, +FX_RECT FXDIB_SwapClipBox(const FX_RECT& clip, int width, int height, bool bFlipX, @@ -93,9 +93,9 @@ FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref) { } FX_ARGB StringToFXARGB(const WideStringView& wsValue) { - uint8_t r = 0, g = 0, b = 0; + static constexpr FX_ARGB kDefaultValue = 0xff000000; if (wsValue.GetLength() == 0) - return 0xff000000; + return kDefaultValue; int cc = 0; const wchar_t* str = wsValue.unterminated_c_str(); @@ -104,8 +104,11 @@ FX_ARGB StringToFXARGB(const WideStringView& wsValue) { cc++; if (cc >= len) - return 0xff000000; + return kDefaultValue; + uint8_t r = 0; + uint8_t g = 0; + uint8_t b = 0; while (cc < len) { if (str[cc] == ',' || !FXSYS_isDecimalDigit(str[cc])) break; |