OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_DIB_H_ |
8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ | 8 #define CORE_INCLUDE_FXGE_FX_DIB_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #define FXDIB_BLEND_HARDLIGHT 8 | 53 #define FXDIB_BLEND_HARDLIGHT 8 |
54 #define FXDIB_BLEND_SOFTLIGHT 9 | 54 #define FXDIB_BLEND_SOFTLIGHT 9 |
55 #define FXDIB_BLEND_DIFFERENCE 10 | 55 #define FXDIB_BLEND_DIFFERENCE 10 |
56 #define FXDIB_BLEND_EXCLUSION 11 | 56 #define FXDIB_BLEND_EXCLUSION 11 |
57 #define FXDIB_BLEND_NONSEPARABLE 21 | 57 #define FXDIB_BLEND_NONSEPARABLE 21 |
58 #define FXDIB_BLEND_HUE 21 | 58 #define FXDIB_BLEND_HUE 21 |
59 #define FXDIB_BLEND_SATURATION 22 | 59 #define FXDIB_BLEND_SATURATION 22 |
60 #define FXDIB_BLEND_COLOR 23 | 60 #define FXDIB_BLEND_COLOR 23 |
61 #define FXDIB_BLEND_LUMINOSITY 24 | 61 #define FXDIB_BLEND_LUMINOSITY 24 |
62 #define FXDIB_BLEND_UNSUPPORTED -1 | 62 #define FXDIB_BLEND_UNSUPPORTED -1 |
63 typedef FX_DWORD FX_ARGB; | 63 typedef uint32_t FX_ARGB; |
64 typedef FX_DWORD FX_COLORREF; | 64 typedef uint32_t FX_COLORREF; |
65 typedef FX_DWORD FX_CMYK; | 65 typedef uint32_t FX_CMYK; |
66 class CFX_ClipRgn; | 66 class CFX_ClipRgn; |
67 class CFX_DIBSource; | 67 class CFX_DIBSource; |
68 class CFX_DIBitmap; | 68 class CFX_DIBitmap; |
69 class CStretchEngine; | 69 class CStretchEngine; |
70 | 70 |
71 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) | 71 #define FXSYS_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16)) |
72 #define FXSYS_GetRValue(rgb) ((rgb)&0xff) | 72 #define FXSYS_GetRValue(rgb) ((rgb)&0xff) |
73 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) | 73 #define FXSYS_GetGValue(rgb) (((rgb) >> 8) & 0xff) |
74 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) | 74 #define FXSYS_GetBValue(rgb) (((rgb) >> 16) & 0xff) |
75 #define FX_CCOLOR(val) (255 - (val)) | 75 #define FX_CCOLOR(val) (255 - (val)) |
(...skipping 10 matching lines...) Expand all Loading... |
86 void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); | 86 void ArgbDecode(FX_ARGB argb, int& a, FX_COLORREF& rgb); |
87 inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { | 87 inline FX_ARGB ArgbEncode(int a, int r, int g, int b) { |
88 return (a << 24) | (r << 16) | (g << 8) | b; | 88 return (a << 24) | (r << 16) | (g << 8) | b; |
89 } | 89 } |
90 FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); | 90 FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); |
91 #define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) | 91 #define FXARGB_A(argb) ((uint8_t)((argb) >> 24)) |
92 #define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) | 92 #define FXARGB_R(argb) ((uint8_t)((argb) >> 16)) |
93 #define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) | 93 #define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) |
94 #define FXARGB_B(argb) ((uint8_t)(argb)) | 94 #define FXARGB_B(argb) ((uint8_t)(argb)) |
95 #define FXARGB_MAKE(a, r, g, b) \ | 95 #define FXARGB_MAKE(a, r, g, b) \ |
96 (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) | 96 (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) |
97 #define FXARGB_MUL_ALPHA(argb, alpha) \ | 97 #define FXARGB_MUL_ALPHA(argb, alpha) \ |
98 (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) | 98 (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) |
99 #define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) | 99 #define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) |
100 #define FXCMYK2GRAY(c, m, y, k) \ | 100 #define FXCMYK2GRAY(c, m, y, k) \ |
101 (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ | 101 (((255 - (c)) * (255 - (k)) * 30 + (255 - (m)) * (255 - (k)) * 59 + \ |
102 (255 - (y)) * (255 - (k)) * 11) / \ | 102 (255 - (y)) * (255 - (k)) * 11) / \ |
103 25500) | 103 25500) |
104 #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ | 104 #define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha) \ |
105 (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) | 105 (((backdrop) * (255 - (source_alpha)) + (source) * (source_alpha)) / 255) |
106 #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) | 106 #define FXDIB_ALPHA_UNION(dest, src) ((dest) + (src) - (dest) * (src) / 255) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 class CFX_DIBSource { | 161 class CFX_DIBSource { |
162 public: | 162 public: |
163 virtual ~CFX_DIBSource(); | 163 virtual ~CFX_DIBSource(); |
164 | 164 |
165 int GetWidth() const { return m_Width; } | 165 int GetWidth() const { return m_Width; } |
166 int GetHeight() const { return m_Height; } | 166 int GetHeight() const { return m_Height; } |
167 | 167 |
168 FXDIB_Format GetFormat() const { | 168 FXDIB_Format GetFormat() const { |
169 return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); | 169 return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); |
170 } | 170 } |
171 FX_DWORD GetPitch() const { return m_Pitch; } | 171 uint32_t GetPitch() const { return m_Pitch; } |
172 FX_DWORD* GetPalette() const { return m_pPalette; } | 172 uint32_t* GetPalette() const { return m_pPalette; } |
173 | 173 |
174 virtual uint8_t* GetBuffer() const; | 174 virtual uint8_t* GetBuffer() const; |
175 virtual const uint8_t* GetScanline(int line) const = 0; | 175 virtual const uint8_t* GetScanline(int line) const = 0; |
176 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; | 176 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; |
177 virtual void DownSampleScanline(int line, | 177 virtual void DownSampleScanline(int line, |
178 uint8_t* dest_scan, | 178 uint8_t* dest_scan, |
179 int dest_bpp, | 179 int dest_bpp, |
180 int dest_width, | 180 int dest_width, |
181 FX_BOOL bFlipX, | 181 FX_BOOL bFlipX, |
182 int clip_left, | 182 int clip_left, |
183 int clip_width) const = 0; | 183 int clip_width) const = 0; |
184 virtual void SetDownSampleSize(int width, int height) {} | 184 virtual void SetDownSampleSize(int width, int height) {} |
185 | 185 |
186 int GetBPP() const { return m_bpp; } | 186 int GetBPP() const { return m_bpp; } |
187 | 187 |
188 // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format, | 188 // TODO(thestig): Investigate this. Given the possible values of FXDIB_Format, |
189 // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and | 189 // it feels as though this should be implemented as !!(m_AlphaFlag & 1) and |
190 // IsOpaqueImage() below should never be able to return TRUE. | 190 // IsOpaqueImage() below should never be able to return TRUE. |
191 bool IsAlphaMask() const { return m_AlphaFlag == 1; } | 191 bool IsAlphaMask() const { return m_AlphaFlag == 1; } |
192 bool HasAlpha() const { return !!(m_AlphaFlag & 2); } | 192 bool HasAlpha() const { return !!(m_AlphaFlag & 2); } |
193 bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); } | 193 bool IsOpaqueImage() const { return !(m_AlphaFlag & 3); } |
194 bool IsCmykImage() const { return !!(m_AlphaFlag & 4); } | 194 bool IsCmykImage() const { return !!(m_AlphaFlag & 4); } |
195 | 195 |
196 int GetPaletteSize() const { | 196 int GetPaletteSize() const { |
197 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); | 197 return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); |
198 } | 198 } |
199 | 199 |
200 FX_DWORD GetPaletteEntry(int index) const; | 200 uint32_t GetPaletteEntry(int index) const; |
201 | 201 |
202 void SetPaletteEntry(int index, FX_DWORD color); | 202 void SetPaletteEntry(int index, uint32_t color); |
203 FX_DWORD GetPaletteArgb(int index) const { return GetPaletteEntry(index); } | 203 uint32_t GetPaletteArgb(int index) const { return GetPaletteEntry(index); } |
204 void SetPaletteArgb(int index, FX_DWORD color) { | 204 void SetPaletteArgb(int index, uint32_t color) { |
205 SetPaletteEntry(index, color); | 205 SetPaletteEntry(index, color); |
206 } | 206 } |
207 | 207 |
208 void CopyPalette(const FX_DWORD* pSrcPal, FX_DWORD size = 256); | 208 void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256); |
209 | 209 |
210 CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; | 210 CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; |
211 CFX_DIBitmap* CloneConvert(FXDIB_Format format, | 211 CFX_DIBitmap* CloneConvert(FXDIB_Format format, |
212 const FX_RECT* pClip = NULL, | 212 const FX_RECT* pClip = NULL, |
213 void* pIccTransform = NULL) const; | 213 void* pIccTransform = NULL) const; |
214 | 214 |
215 CFX_DIBitmap* StretchTo(int dest_width, | 215 CFX_DIBitmap* StretchTo(int dest_width, |
216 int dest_height, | 216 int dest_height, |
217 FX_DWORD flags = 0, | 217 uint32_t flags = 0, |
218 const FX_RECT* pClip = NULL) const; | 218 const FX_RECT* pClip = NULL) const; |
219 CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix, | 219 CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix, |
220 int& left, | 220 int& left, |
221 int& top, | 221 int& top, |
222 FX_DWORD flags = 0, | 222 uint32_t flags = 0, |
223 const FX_RECT* pClip = NULL) const; | 223 const FX_RECT* pClip = NULL) const; |
224 | 224 |
225 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; | 225 CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; |
226 FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, | 226 FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask, |
227 const FX_RECT* pClip = NULL); | 227 const FX_RECT* pClip = NULL); |
228 | 228 |
229 CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, | 229 CFX_DIBitmap* SwapXY(FX_BOOL bXFlip, |
230 FX_BOOL bYFlip, | 230 FX_BOOL bYFlip, |
231 const FX_RECT* pClip = NULL) const; | 231 const FX_RECT* pClip = NULL) const; |
232 | 232 |
(...skipping 10 matching lines...) Expand all Loading... |
243 const CFX_ClipRgn* pClipRgn); | 243 const CFX_ClipRgn* pClipRgn); |
244 | 244 |
245 CFX_DIBitmap* m_pAlphaMask; | 245 CFX_DIBitmap* m_pAlphaMask; |
246 | 246 |
247 protected: | 247 protected: |
248 CFX_DIBSource(); | 248 CFX_DIBSource(); |
249 | 249 |
250 int m_Width; | 250 int m_Width; |
251 int m_Height; | 251 int m_Height; |
252 int m_bpp; | 252 int m_bpp; |
253 FX_DWORD m_AlphaFlag; | 253 uint32_t m_AlphaFlag; |
254 FX_DWORD m_Pitch; | 254 uint32_t m_Pitch; |
255 FX_DWORD* m_pPalette; | 255 uint32_t* m_pPalette; |
256 | 256 |
257 void BuildPalette(); | 257 void BuildPalette(); |
258 FX_BOOL BuildAlphaMask(); | 258 FX_BOOL BuildAlphaMask(); |
259 int FindPalette(FX_DWORD color) const; | 259 int FindPalette(uint32_t color) const; |
260 void GetPalette(FX_DWORD* pal, int alpha) const; | 260 void GetPalette(uint32_t* pal, int alpha) const; |
261 }; | 261 }; |
262 class CFX_DIBitmap : public CFX_DIBSource { | 262 class CFX_DIBitmap : public CFX_DIBSource { |
263 public: | 263 public: |
264 CFX_DIBitmap(); | 264 CFX_DIBitmap(); |
265 explicit CFX_DIBitmap(const CFX_DIBitmap& src); | 265 explicit CFX_DIBitmap(const CFX_DIBitmap& src); |
266 ~CFX_DIBitmap() override; | 266 ~CFX_DIBitmap() override; |
267 | 267 |
268 FX_BOOL Create(int width, | 268 FX_BOOL Create(int width, |
269 int height, | 269 int height, |
270 FXDIB_Format format, | 270 FXDIB_Format format, |
(...skipping 10 matching lines...) Expand all Loading... |
281 int dest_bpp, | 281 int dest_bpp, |
282 int dest_width, | 282 int dest_width, |
283 FX_BOOL bFlipX, | 283 FX_BOOL bFlipX, |
284 int clip_left, | 284 int clip_left, |
285 int clip_width) const override; | 285 int clip_width) const override; |
286 | 286 |
287 void TakeOver(CFX_DIBitmap* pSrcBitmap); | 287 void TakeOver(CFX_DIBitmap* pSrcBitmap); |
288 | 288 |
289 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); | 289 FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); |
290 | 290 |
291 void Clear(FX_DWORD color); | 291 void Clear(uint32_t color); |
292 | 292 |
293 FX_DWORD GetPixel(int x, int y) const; | 293 uint32_t GetPixel(int x, int y) const; |
294 | 294 |
295 void SetPixel(int x, int y, FX_DWORD color); | 295 void SetPixel(int x, int y, uint32_t color); |
296 | 296 |
297 FX_BOOL LoadChannel(FXDIB_Channel destChannel, | 297 FX_BOOL LoadChannel(FXDIB_Channel destChannel, |
298 const CFX_DIBSource* pSrcBitmap, | 298 const CFX_DIBSource* pSrcBitmap, |
299 FXDIB_Channel srcChannel); | 299 FXDIB_Channel srcChannel); |
300 | 300 |
301 FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value); | 301 FX_BOOL LoadChannel(FXDIB_Channel destChannel, int value); |
302 | 302 |
303 FX_BOOL MultiplyAlpha(int alpha); | 303 FX_BOOL MultiplyAlpha(int alpha); |
304 | 304 |
305 FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); | 305 FX_BOOL MultiplyAlpha(const CFX_DIBSource* pAlphaMask); |
(...skipping 17 matching lines...) Expand all Loading... |
323 int blend_type = FXDIB_BLEND_NORMAL, | 323 int blend_type = FXDIB_BLEND_NORMAL, |
324 const CFX_ClipRgn* pClipRgn = NULL, | 324 const CFX_ClipRgn* pClipRgn = NULL, |
325 FX_BOOL bRgbByteOrder = FALSE, | 325 FX_BOOL bRgbByteOrder = FALSE, |
326 void* pIccTransform = NULL); | 326 void* pIccTransform = NULL); |
327 | 327 |
328 FX_BOOL TransferMask(int dest_left, | 328 FX_BOOL TransferMask(int dest_left, |
329 int dest_top, | 329 int dest_top, |
330 int width, | 330 int width, |
331 int height, | 331 int height, |
332 const CFX_DIBSource* pMask, | 332 const CFX_DIBSource* pMask, |
333 FX_DWORD color, | 333 uint32_t color, |
334 int src_left, | 334 int src_left, |
335 int src_top, | 335 int src_top, |
336 int alpha_flag = 0, | 336 int alpha_flag = 0, |
337 void* pIccTransform = NULL); | 337 void* pIccTransform = NULL); |
338 | 338 |
339 FX_BOOL CompositeMask(int dest_left, | 339 FX_BOOL CompositeMask(int dest_left, |
340 int dest_top, | 340 int dest_top, |
341 int width, | 341 int width, |
342 int height, | 342 int height, |
343 const CFX_DIBSource* pMask, | 343 const CFX_DIBSource* pMask, |
344 FX_DWORD color, | 344 uint32_t color, |
345 int src_left, | 345 int src_left, |
346 int src_top, | 346 int src_top, |
347 int blend_type = FXDIB_BLEND_NORMAL, | 347 int blend_type = FXDIB_BLEND_NORMAL, |
348 const CFX_ClipRgn* pClipRgn = NULL, | 348 const CFX_ClipRgn* pClipRgn = NULL, |
349 FX_BOOL bRgbByteOrder = FALSE, | 349 FX_BOOL bRgbByteOrder = FALSE, |
350 int alpha_flag = 0, | 350 int alpha_flag = 0, |
351 void* pIccTransform = NULL); | 351 void* pIccTransform = NULL); |
352 | 352 |
353 FX_BOOL CompositeRect(int dest_left, | 353 FX_BOOL CompositeRect(int dest_left, |
354 int dest_top, | 354 int dest_top, |
355 int width, | 355 int width, |
356 int height, | 356 int height, |
357 FX_DWORD color, | 357 uint32_t color, |
358 int alpha_flag = 0, | 358 int alpha_flag = 0, |
359 void* pIccTransform = NULL); | 359 void* pIccTransform = NULL); |
360 | 360 |
361 FX_BOOL ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor); | 361 FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor); |
362 | 362 |
363 FX_BOOL DitherFS(const FX_DWORD* pPalette, | 363 FX_BOOL DitherFS(const uint32_t* pPalette, |
364 int pal_size, | 364 int pal_size, |
365 const FX_RECT* pRect = NULL); | 365 const FX_RECT* pRect = NULL); |
366 | 366 |
367 protected: | 367 protected: |
368 uint8_t* m_pBuffer; | 368 uint8_t* m_pBuffer; |
369 | 369 |
370 FX_BOOL m_bExtBuf; | 370 FX_BOOL m_bExtBuf; |
371 | 371 |
372 FX_BOOL GetGrayData(void* pIccTransform = NULL); | 372 FX_BOOL GetGrayData(void* pIccTransform = NULL); |
373 }; | 373 }; |
(...skipping 12 matching lines...) Expand all Loading... |
386 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; | 386 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; |
387 class CFX_FilteredDIB : public CFX_DIBSource { | 387 class CFX_FilteredDIB : public CFX_DIBSource { |
388 public: | 388 public: |
389 CFX_FilteredDIB(); | 389 CFX_FilteredDIB(); |
390 ~CFX_FilteredDIB() override; | 390 ~CFX_FilteredDIB() override; |
391 | 391 |
392 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); | 392 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); |
393 | 393 |
394 virtual FXDIB_Format GetDestFormat() = 0; | 394 virtual FXDIB_Format GetDestFormat() = 0; |
395 | 395 |
396 virtual FX_DWORD* GetDestPalette() = 0; | 396 virtual uint32_t* GetDestPalette() = 0; |
397 | 397 |
398 virtual void TranslateScanline(uint8_t* dest_buf, | 398 virtual void TranslateScanline(uint8_t* dest_buf, |
399 const uint8_t* src_buf) const = 0; | 399 const uint8_t* src_buf) const = 0; |
400 | 400 |
401 virtual void TranslateDownSamples(uint8_t* dest_buf, | 401 virtual void TranslateDownSamples(uint8_t* dest_buf, |
402 const uint8_t* src_buf, | 402 const uint8_t* src_buf, |
403 int pixels, | 403 int pixels, |
404 int Bpp) const = 0; | 404 int Bpp) const = 0; |
405 | 405 |
406 protected: | 406 protected: |
(...skipping 18 matching lines...) Expand all Loading... |
425 public: | 425 public: |
426 virtual ~IFX_ScanlineComposer() {} | 426 virtual ~IFX_ScanlineComposer() {} |
427 | 427 |
428 virtual void ComposeScanline(int line, | 428 virtual void ComposeScanline(int line, |
429 const uint8_t* scanline, | 429 const uint8_t* scanline, |
430 const uint8_t* scan_extra_alpha = NULL) = 0; | 430 const uint8_t* scan_extra_alpha = NULL) = 0; |
431 | 431 |
432 virtual FX_BOOL SetInfo(int width, | 432 virtual FX_BOOL SetInfo(int width, |
433 int height, | 433 int height, |
434 FXDIB_Format src_format, | 434 FXDIB_Format src_format, |
435 FX_DWORD* pSrcPalette) = 0; | 435 uint32_t* pSrcPalette) = 0; |
436 }; | 436 }; |
437 class CFX_ScanlineCompositor { | 437 class CFX_ScanlineCompositor { |
438 public: | 438 public: |
439 CFX_ScanlineCompositor(); | 439 CFX_ScanlineCompositor(); |
440 | 440 |
441 ~CFX_ScanlineCompositor(); | 441 ~CFX_ScanlineCompositor(); |
442 | 442 |
443 FX_BOOL Init(FXDIB_Format dest_format, | 443 FX_BOOL Init(FXDIB_Format dest_format, |
444 FXDIB_Format src_format, | 444 FXDIB_Format src_format, |
445 int32_t width, | 445 int32_t width, |
446 FX_DWORD* pSrcPalette, | 446 uint32_t* pSrcPalette, |
447 FX_DWORD mask_color, | 447 uint32_t mask_color, |
448 int blend_type, | 448 int blend_type, |
449 FX_BOOL bClip, | 449 FX_BOOL bClip, |
450 FX_BOOL bRgbByteOrder = FALSE, | 450 FX_BOOL bRgbByteOrder = FALSE, |
451 int alpha_flag = 0, | 451 int alpha_flag = 0, |
452 void* pIccTransform = NULL); | 452 void* pIccTransform = NULL); |
453 | 453 |
454 void CompositeRgbBitmapLine(uint8_t* dest_scan, | 454 void CompositeRgbBitmapLine(uint8_t* dest_scan, |
455 const uint8_t* src_scan, | 455 const uint8_t* src_scan, |
456 int width, | 456 int width, |
457 const uint8_t* clip_scan, | 457 const uint8_t* clip_scan, |
(...skipping 17 matching lines...) Expand all Loading... |
475 void CompositeBitMaskLine(uint8_t* dest_scan, | 475 void CompositeBitMaskLine(uint8_t* dest_scan, |
476 const uint8_t* src_scan, | 476 const uint8_t* src_scan, |
477 int src_left, | 477 int src_left, |
478 int width, | 478 int width, |
479 const uint8_t* clip_scan, | 479 const uint8_t* clip_scan, |
480 uint8_t* dst_extra_alpha = NULL); | 480 uint8_t* dst_extra_alpha = NULL); |
481 | 481 |
482 protected: | 482 protected: |
483 int m_Transparency; | 483 int m_Transparency; |
484 FXDIB_Format m_SrcFormat, m_DestFormat; | 484 FXDIB_Format m_SrcFormat, m_DestFormat; |
485 FX_DWORD* m_pSrcPalette; | 485 uint32_t* m_pSrcPalette; |
486 | 486 |
487 int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; | 487 int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; |
488 int m_BlendType; | 488 int m_BlendType; |
489 void* m_pIccTransform; | 489 void* m_pIccTransform; |
490 uint8_t* m_pCacheScanline; | 490 uint8_t* m_pCacheScanline; |
491 int m_CacheSize; | 491 int m_CacheSize; |
492 FX_BOOL m_bRgbByteOrder; | 492 FX_BOOL m_bRgbByteOrder; |
493 }; | 493 }; |
494 | 494 |
495 class CFX_BitmapComposer : public IFX_ScanlineComposer { | 495 class CFX_BitmapComposer : public IFX_ScanlineComposer { |
496 public: | 496 public: |
497 CFX_BitmapComposer(); | 497 CFX_BitmapComposer(); |
498 ~CFX_BitmapComposer() override; | 498 ~CFX_BitmapComposer() override; |
499 | 499 |
500 void Compose(CFX_DIBitmap* pDest, | 500 void Compose(CFX_DIBitmap* pDest, |
501 const CFX_ClipRgn* pClipRgn, | 501 const CFX_ClipRgn* pClipRgn, |
502 int bitmap_alpha, | 502 int bitmap_alpha, |
503 FX_DWORD mask_color, | 503 uint32_t mask_color, |
504 FX_RECT& dest_rect, | 504 FX_RECT& dest_rect, |
505 FX_BOOL bVertical, | 505 FX_BOOL bVertical, |
506 FX_BOOL bFlipX, | 506 FX_BOOL bFlipX, |
507 FX_BOOL bFlipY, | 507 FX_BOOL bFlipY, |
508 FX_BOOL bRgbByteOrder = FALSE, | 508 FX_BOOL bRgbByteOrder = FALSE, |
509 int alpha_flag = 0, | 509 int alpha_flag = 0, |
510 void* pIccTransform = NULL, | 510 void* pIccTransform = NULL, |
511 int blend_type = FXDIB_BLEND_NORMAL); | 511 int blend_type = FXDIB_BLEND_NORMAL); |
512 | 512 |
513 // IFX_ScanlineComposer | 513 // IFX_ScanlineComposer |
514 FX_BOOL SetInfo(int width, | 514 FX_BOOL SetInfo(int width, |
515 int height, | 515 int height, |
516 FXDIB_Format src_format, | 516 FXDIB_Format src_format, |
517 FX_DWORD* pSrcPalette) override; | 517 uint32_t* pSrcPalette) override; |
518 | 518 |
519 void ComposeScanline(int line, | 519 void ComposeScanline(int line, |
520 const uint8_t* scanline, | 520 const uint8_t* scanline, |
521 const uint8_t* scan_extra_alpha) override; | 521 const uint8_t* scan_extra_alpha) override; |
522 | 522 |
523 protected: | 523 protected: |
524 void DoCompose(uint8_t* dest_scan, | 524 void DoCompose(uint8_t* dest_scan, |
525 const uint8_t* src_scan, | 525 const uint8_t* src_scan, |
526 int dest_width, | 526 int dest_width, |
527 const uint8_t* clip_scan, | 527 const uint8_t* clip_scan, |
528 const uint8_t* src_extra_alpha = NULL, | 528 const uint8_t* src_extra_alpha = NULL, |
529 uint8_t* dst_extra_alpha = NULL); | 529 uint8_t* dst_extra_alpha = NULL); |
530 CFX_DIBitmap* m_pBitmap; | 530 CFX_DIBitmap* m_pBitmap; |
531 const CFX_ClipRgn* m_pClipRgn; | 531 const CFX_ClipRgn* m_pClipRgn; |
532 FXDIB_Format m_SrcFormat; | 532 FXDIB_Format m_SrcFormat; |
533 int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; | 533 int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; |
534 FX_DWORD m_MaskColor; | 534 uint32_t m_MaskColor; |
535 const CFX_DIBitmap* m_pClipMask; | 535 const CFX_DIBitmap* m_pClipMask; |
536 CFX_ScanlineCompositor m_Compositor; | 536 CFX_ScanlineCompositor m_Compositor; |
537 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; | 537 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; |
538 int m_AlphaFlag; | 538 int m_AlphaFlag; |
539 void* m_pIccTransform; | 539 void* m_pIccTransform; |
540 FX_BOOL m_bRgbByteOrder; | 540 FX_BOOL m_bRgbByteOrder; |
541 int m_BlendType; | 541 int m_BlendType; |
542 void ComposeScanlineV(int line, | 542 void ComposeScanlineV(int line, |
543 const uint8_t* scanline, | 543 const uint8_t* scanline, |
544 const uint8_t* scan_extra_alpha = NULL); | 544 const uint8_t* scan_extra_alpha = NULL); |
545 uint8_t* m_pScanlineV; | 545 uint8_t* m_pScanlineV; |
546 uint8_t* m_pClipScanV; | 546 uint8_t* m_pClipScanV; |
547 uint8_t* m_pAddClipScan; | 547 uint8_t* m_pAddClipScan; |
548 uint8_t* m_pScanlineAlphaV; | 548 uint8_t* m_pScanlineAlphaV; |
549 }; | 549 }; |
550 | 550 |
551 class CFX_BitmapStorer : public IFX_ScanlineComposer { | 551 class CFX_BitmapStorer : public IFX_ScanlineComposer { |
552 public: | 552 public: |
553 CFX_BitmapStorer(); | 553 CFX_BitmapStorer(); |
554 ~CFX_BitmapStorer() override; | 554 ~CFX_BitmapStorer() override; |
555 | 555 |
556 // IFX_ScanlineComposer | 556 // IFX_ScanlineComposer |
557 void ComposeScanline(int line, | 557 void ComposeScanline(int line, |
558 const uint8_t* scanline, | 558 const uint8_t* scanline, |
559 const uint8_t* scan_extra_alpha) override; | 559 const uint8_t* scan_extra_alpha) override; |
560 | 560 |
561 FX_BOOL SetInfo(int width, | 561 FX_BOOL SetInfo(int width, |
562 int height, | 562 int height, |
563 FXDIB_Format src_format, | 563 FXDIB_Format src_format, |
564 FX_DWORD* pSrcPalette) override; | 564 uint32_t* pSrcPalette) override; |
565 | 565 |
566 CFX_DIBitmap* GetBitmap() { return m_pBitmap; } | 566 CFX_DIBitmap* GetBitmap() { return m_pBitmap; } |
567 | 567 |
568 CFX_DIBitmap* Detach(); | 568 CFX_DIBitmap* Detach(); |
569 | 569 |
570 void Replace(CFX_DIBitmap* pBitmap); | 570 void Replace(CFX_DIBitmap* pBitmap); |
571 | 571 |
572 private: | 572 private: |
573 CFX_DIBitmap* m_pBitmap; | 573 CFX_DIBitmap* m_pBitmap; |
574 }; | 574 }; |
575 | 575 |
576 class CFX_ImageStretcher { | 576 class CFX_ImageStretcher { |
577 public: | 577 public: |
578 CFX_ImageStretcher(); | 578 CFX_ImageStretcher(); |
579 ~CFX_ImageStretcher(); | 579 ~CFX_ImageStretcher(); |
580 | 580 |
581 FX_BOOL Start(IFX_ScanlineComposer* pDest, | 581 FX_BOOL Start(IFX_ScanlineComposer* pDest, |
582 const CFX_DIBSource* pBitmap, | 582 const CFX_DIBSource* pBitmap, |
583 int dest_width, | 583 int dest_width, |
584 int dest_height, | 584 int dest_height, |
585 const FX_RECT& bitmap_rect, | 585 const FX_RECT& bitmap_rect, |
586 FX_DWORD flags); | 586 uint32_t flags); |
587 | 587 |
588 FX_BOOL Continue(IFX_Pause* pPause); | 588 FX_BOOL Continue(IFX_Pause* pPause); |
589 FX_BOOL StartQuickStretch(); | 589 FX_BOOL StartQuickStretch(); |
590 FX_BOOL StartStretch(); | 590 FX_BOOL StartStretch(); |
591 FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); | 591 FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); |
592 FX_BOOL ContinueStretch(IFX_Pause* pPause); | 592 FX_BOOL ContinueStretch(IFX_Pause* pPause); |
593 | 593 |
594 IFX_ScanlineComposer* m_pDest; | 594 IFX_ScanlineComposer* m_pDest; |
595 const CFX_DIBSource* m_pSource; | 595 const CFX_DIBSource* m_pSource; |
596 CStretchEngine* m_pStretchEngine; | 596 CStretchEngine* m_pStretchEngine; |
597 FX_DWORD m_Flags; | 597 uint32_t m_Flags; |
598 FX_BOOL m_bFlipX; | 598 FX_BOOL m_bFlipX; |
599 FX_BOOL m_bFlipY; | 599 FX_BOOL m_bFlipY; |
600 int m_DestWidth; | 600 int m_DestWidth; |
601 int m_DestHeight; | 601 int m_DestHeight; |
602 FX_RECT m_ClipRect; | 602 FX_RECT m_ClipRect; |
603 int m_LineIndex; | 603 int m_LineIndex; |
604 int m_DestBPP; | 604 int m_DestBPP; |
605 uint8_t* m_pScanline; | 605 uint8_t* m_pScanline; |
606 uint8_t* m_pMaskScanline; | 606 uint8_t* m_pMaskScanline; |
607 FXDIB_Format m_DestFormat; | 607 FXDIB_Format m_DestFormat; |
(...skipping 12 matching lines...) Expand all Loading... |
620 | 620 |
621 CFX_Matrix* m_pMatrix; | 621 CFX_Matrix* m_pMatrix; |
622 FX_RECT m_StretchClip; | 622 FX_RECT m_StretchClip; |
623 int m_ResultLeft; | 623 int m_ResultLeft; |
624 int m_ResultTop; | 624 int m_ResultTop; |
625 int m_ResultWidth; | 625 int m_ResultWidth; |
626 int m_ResultHeight; | 626 int m_ResultHeight; |
627 CFX_Matrix m_dest2stretch; | 627 CFX_Matrix m_dest2stretch; |
628 CFX_ImageStretcher m_Stretcher; | 628 CFX_ImageStretcher m_Stretcher; |
629 CFX_BitmapStorer m_Storer; | 629 CFX_BitmapStorer m_Storer; |
630 FX_DWORD m_Flags; | 630 uint32_t m_Flags; |
631 int m_Status; | 631 int m_Status; |
632 }; | 632 }; |
633 class CFX_ImageRenderer { | 633 class CFX_ImageRenderer { |
634 public: | 634 public: |
635 CFX_ImageRenderer(); | 635 CFX_ImageRenderer(); |
636 ~CFX_ImageRenderer(); | 636 ~CFX_ImageRenderer(); |
637 | 637 |
638 FX_BOOL Start(CFX_DIBitmap* pDevice, | 638 FX_BOOL Start(CFX_DIBitmap* pDevice, |
639 const CFX_ClipRgn* pClipRgn, | 639 const CFX_ClipRgn* pClipRgn, |
640 const CFX_DIBSource* pSource, | 640 const CFX_DIBSource* pSource, |
641 int bitmap_alpha, | 641 int bitmap_alpha, |
642 FX_DWORD mask_color, | 642 uint32_t mask_color, |
643 const CFX_Matrix* pMatrix, | 643 const CFX_Matrix* pMatrix, |
644 FX_DWORD dib_flags, | 644 uint32_t dib_flags, |
645 FX_BOOL bRgbByteOrder = FALSE, | 645 FX_BOOL bRgbByteOrder = FALSE, |
646 int alpha_flag = 0, | 646 int alpha_flag = 0, |
647 void* pIccTransform = NULL, | 647 void* pIccTransform = NULL, |
648 int blend_type = FXDIB_BLEND_NORMAL); | 648 int blend_type = FXDIB_BLEND_NORMAL); |
649 | 649 |
650 FX_BOOL Continue(IFX_Pause* pPause); | 650 FX_BOOL Continue(IFX_Pause* pPause); |
651 | 651 |
652 protected: | 652 protected: |
653 CFX_DIBitmap* m_pDevice; | 653 CFX_DIBitmap* m_pDevice; |
654 const CFX_ClipRgn* m_pClipRgn; | 654 const CFX_ClipRgn* m_pClipRgn; |
655 int m_BitmapAlpha; | 655 int m_BitmapAlpha; |
656 FX_DWORD m_MaskColor; | 656 uint32_t m_MaskColor; |
657 CFX_Matrix m_Matrix; | 657 CFX_Matrix m_Matrix; |
658 CFX_ImageTransformer* m_pTransformer; | 658 CFX_ImageTransformer* m_pTransformer; |
659 CFX_ImageStretcher m_Stretcher; | 659 CFX_ImageStretcher m_Stretcher; |
660 CFX_BitmapComposer m_Composer; | 660 CFX_BitmapComposer m_Composer; |
661 int m_Status; | 661 int m_Status; |
662 FX_RECT m_ClipBox; | 662 FX_RECT m_ClipBox; |
663 FX_DWORD m_Flags; | 663 uint32_t m_Flags; |
664 int m_AlphaFlag; | 664 int m_AlphaFlag; |
665 void* m_pIccTransform; | 665 void* m_pIccTransform; |
666 FX_BOOL m_bRgbByteOrder; | 666 FX_BOOL m_bRgbByteOrder; |
667 int m_BlendType; | 667 int m_BlendType; |
668 }; | 668 }; |
669 | 669 |
670 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ | 670 #endif // CORE_INCLUDE_FXGE_FX_DIB_H_ |
OLD | NEW |