diff options
author | Nicolas Pena <npm@chromium.org> | 2017-04-04 12:12:49 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-04 16:25:29 +0000 |
commit | 37cc5fb6b3407ce8e079bc1bdd0606713b975532 (patch) | |
tree | a816f60f67dc4deb6db42aa98b5aca4a419243ff /core/fxge/fx_dib.h | |
parent | 29479f6380942515b06240c4933bf3b4cf502013 (diff) | |
download | pdfium-37cc5fb6b3407ce8e079bc1bdd0606713b975532.tar.xz |
Finish splitting up fx_dib.h
After this CL, fx_dib.h only has some definitions used in multiple places.
Definitions that were of restricted usage were moved out to the corresponding
place. Includes in fx_dib were reduced, thus revealing other needed includes.
Change-Id: I3607da0af81c491256d64c0aa085225631efbdcc
Reviewed-on: https://pdfium-review.googlesource.com/3594
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/fx_dib.h')
-rw-r--r-- | core/fxge/fx_dib.h | 111 |
1 files changed, 46 insertions, 65 deletions
diff --git a/core/fxge/fx_dib.h b/core/fxge/fx_dib.h index e0018f32f5..cd6a0e6007 100644 --- a/core/fxge/fx_dib.h +++ b/core/fxge/fx_dib.h @@ -7,37 +7,71 @@ #ifndef CORE_FXGE_FX_DIB_H_ #define CORE_FXGE_FX_DIB_H_ -#include <memory> -#include <vector> +#include "core/fxcrt/fx_system.h" -#include "core/fxcrt/cfx_retain_ptr.h" -#include "core/fxcrt/fx_basic.h" -#include "core/fxcrt/fx_coordinates.h" -#include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" -#include "core/fxge/dib/cfx_scanlinecompositor.h" -#include "third_party/base/stl_util.h" +enum FXDIB_Format { + FXDIB_Invalid = 0, + FXDIB_1bppRgb = 0x001, + FXDIB_8bppRgb = 0x008, + FXDIB_Rgb = 0x018, + FXDIB_Rgb32 = 0x020, + FXDIB_1bppMask = 0x101, + FXDIB_8bppMask = 0x108, + FXDIB_8bppRgba = 0x208, + FXDIB_Rgba = 0x218, + FXDIB_Argb = 0x220, + FXDIB_1bppCmyk = 0x401, + FXDIB_8bppCmyk = 0x408, + FXDIB_Cmyk = 0x420, + FXDIB_8bppCmyka = 0x608, + FXDIB_Cmyka = 0x620, +}; typedef uint32_t FX_ARGB; typedef uint32_t FX_COLORREF; typedef uint32_t FX_CMYK; class CFX_ClipRgn; +class CFX_DIBSource; class CStretchEngine; +#define FXDIB_DOWNSAMPLE 0x04 +#define FXDIB_INTERPOL 0x20 +#define FXDIB_BICUBIC_INTERPOL 0x80 +#define FXDIB_NOSMOOTH 0x100 +#define FXDIB_BLEND_NORMAL 0 +#define FXDIB_BLEND_MULTIPLY 1 +#define FXDIB_BLEND_SCREEN 2 +#define FXDIB_BLEND_OVERLAY 3 +#define FXDIB_BLEND_DARKEN 4 +#define FXDIB_BLEND_LIGHTEN 5 + +#define FXDIB_BLEND_COLORDODGE 6 +#define FXDIB_BLEND_COLORBURN 7 +#define FXDIB_BLEND_HARDLIGHT 8 +#define FXDIB_BLEND_SOFTLIGHT 9 +#define FXDIB_BLEND_DIFFERENCE 10 +#define FXDIB_BLEND_EXCLUSION 11 +#define FXDIB_BLEND_NONSEPARABLE 21 +#define FXDIB_BLEND_HUE 21 +#define FXDIB_BLEND_SATURATION 22 +#define FXDIB_BLEND_COLOR 23 +#define FXDIB_BLEND_LUMINOSITY 24 +#define FXDIB_BLEND_UNSUPPORTED -1 + #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) #define FXSYS_GetRValue(rgb) ((rgb)&0xff) #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) -#define FX_CCOLOR(val) (255 - (val)) + #define FXSYS_CMYK(c, m, y, k) (((c) << 24) | ((m) << 16) | ((y) << 8) | (k)) #define FXSYS_GetCValue(cmyk) ((uint8_t)((cmyk) >> 24) & 0xff) #define FXSYS_GetMValue(cmyk) ((uint8_t)((cmyk) >> 16) & 0xff) #define FXSYS_GetYValue(cmyk) ((uint8_t)((cmyk) >> 8) & 0xff) #define FXSYS_GetKValue(cmyk) ((uint8_t)(cmyk)&0xff) -void CmykDecode(FX_CMYK cmyk, int& c, int& m, int& y, int& k); inline FX_CMYK CmykEncode(int c, int m, int y, int k) { return (c << 24) | (m << 16) | (y << 8) | k; } + void ArgbDecode(FX_ARGB argb, int& a, int& r, int& g, int& b); void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { @@ -52,21 +86,10 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define FXARGB_MUL_ALPHA(argb, alpha) \ (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) + #define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) -#define FXCMYK2GRAY(c, m, y, k) \ - (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ - (255 - (y)) * (255 - (k)) * 11) / \ - 25500) #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) -#define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) -#define FXCMYK_GETDIB(p) \ - ((((uint8_t*)(p))[0] << 24 | (((uint8_t*)(p))[1] << 16) | \ - (((uint8_t*)(p))[2] << 8) | ((uint8_t*)(p))[3])) -#define FXCMYK_SETDIB(p, cmyk) ((uint8_t*)(p))[0] = (uint8_t)((cmyk) >> 24), \ - ((uint8_t*)(p))[1] = (uint8_t)((cmyk) >> 16), \ - ((uint8_t*)(p))[2] = (uint8_t)((cmyk) >> 8), \ - ((uint8_t*)(p))[3] = (uint8_t)(cmyk)) #define FXARGB_GETDIB(p) \ ((((uint8_t*)(p))[0]) | (((uint8_t*)(p))[1] << 8) | \ (((uint8_t*)(p))[2] << 16) | (((uint8_t*)(p))[3] << 24)) @@ -75,29 +98,11 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ ((uint8_t*)(p))[2] = (uint8_t)((argb) >> 16), \ ((uint8_t*)(p))[3] = (uint8_t)((argb) >> 24) -#define FXARGB_COPY(dest, src) \ - *(uint8_t*)(dest) = *(uint8_t*)(src), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) -#define FXCMYK_COPY(dest, src) \ - *(uint8_t*)(dest) = *(uint8_t*)(src), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3) #define FXARGB_SETRGBORDERDIB(p, argb) \ ((uint8_t*)(p))[3] = (uint8_t)(argb >> 24), \ ((uint8_t*)(p))[0] = (uint8_t)((argb) >> 16), \ ((uint8_t*)(p))[1] = (uint8_t)((argb) >> 8), \ ((uint8_t*)(p))[2] = (uint8_t)(argb) -#define FXARGB_GETRGBORDERDIB(p) \ - (((uint8_t*)(p))[2]) | (((uint8_t*)(p))[1] << 8) | \ - (((uint8_t*)(p))[0] << 16) | (((uint8_t*)(p))[3] << 24) -#define FXARGB_RGBORDERCOPY(dest, src) \ - *((uint8_t*)(dest) + 3) = *((uint8_t*)(src) + 3), \ - *(uint8_t*)(dest) = *((uint8_t*)(src) + 2), \ - *((uint8_t*)(dest) + 1) = *((uint8_t*)(src) + 1), \ - *((uint8_t*)(dest) + 2) = *((uint8_t*)(src)) #define FXARGB_TODIB(argb) (argb) #define FXCMYK_TODIB(cmyk) \ ((uint8_t)((cmyk) >> 24) | ((uint8_t)((cmyk) >> 16)) << 8 | \ @@ -108,28 +113,4 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); #define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8) #define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag) -bool ConvertBuffer(FXDIB_Format dest_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_RetainPtr<CFX_DIBSource>& pSrcBitmap, - int src_left, - int src_top, - std::unique_ptr<uint32_t, FxFreeDeleter>* pal); - -class IFX_ScanlineComposer { - public: - virtual ~IFX_ScanlineComposer() {} - - virtual void ComposeScanline(int line, - const uint8_t* scanline, - const uint8_t* scan_extra_alpha = nullptr) = 0; - - virtual bool SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) = 0; -}; - #endif // CORE_FXGE_FX_DIB_H_ |