summaryrefslogtreecommitdiff
path: root/core/fxge/fx_dib.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-03-21 17:24:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-03-21 17:24:46 +0000
commit3851aff62c7ad2f9c942b4d5d095ec0e6610bb84 (patch)
treec15c662f2f9ac851c33fe1603057088d4eb319b5 /core/fxge/fx_dib.h
parentbf85feeafdd8791f9dab7bfcd14ff850e015be26 (diff)
downloadpdfium-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/fx_dib.h')
-rw-r--r--core/fxge/fx_dib.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h
index 9acfa51bbe..57e844b946 100644
--- a/core/fxge/fx_dib.h
+++ b/core/fxge/fx_dib.h
@@ -95,6 +95,14 @@ constexpr uint8_t FXSYS_GetBValue(uint32_t bgr) {
#define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff)
#define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff)
+inline int GetBppFromFormat(FXDIB_Format format) {
+ return format & 0xff;
+}
+
+inline int GetCompsFromFormat(FXDIB_Format format) {
+ return (format & 0xff) / 8;
+}
+
inline FX_CMYK CmykEncode(int c, int m, int y, int k) {
return (c << 24) | (m << 16) | (y << 8) | k;
}
@@ -149,7 +157,7 @@ FX_ARGB StringToFXARGB(const WideStringView& view);
((uint8_t)(argb >> 16) | ((uint8_t)(argb >> 8)) << 8 | \
((uint8_t)(argb)) << 16 | ((uint8_t)(argb >> 24) << 24))
-FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
+FX_RECT FXDIB_SwapClipBox(const FX_RECT& clip,
int width,
int height,
bool bFlipX,