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 #include "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "dib_int.h" | 9 #include "dib_int.h" |
10 const uint8_t g_GammaRamp[256] = { | 10 const uint8_t g_GammaRamp[256] = { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 mid = &color.green; | 220 mid = &color.green; |
221 } | 221 } |
222 } | 222 } |
223 if (*max > *min) { | 223 if (*max > *min) { |
224 *mid = (*mid - *min) * s / (*max - *min); | 224 *mid = (*mid - *min) * s / (*max - *min); |
225 *max = s; | 225 *max = s; |
226 *min = 0; | 226 *min = 0; |
227 } | 227 } |
228 return color; | 228 return color; |
229 } | 229 } |
230 void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int res
ults[3]) | 230 void _RGB_Blend(int blend_mode, const uint8_t* src_scan, uint8_t* dest_scan, int
results[3]) |
231 { | 231 { |
232 _RGB src, back, result; | 232 _RGB src, back, result; |
233 src.red = src_scan[2]; | 233 src.red = src_scan[2]; |
234 src.green = src_scan[1]; | 234 src.green = src_scan[1]; |
235 src.blue = src_scan[0]; | 235 src.blue = src_scan[0]; |
236 back.red = dest_scan[2]; | 236 back.red = dest_scan[2]; |
237 back.green = dest_scan[1]; | 237 back.green = dest_scan[1]; |
238 back.blue = dest_scan[0]; | 238 back.blue = dest_scan[0]; |
239 switch (blend_mode) { | 239 switch (blend_mode) { |
240 case FXDIB_BLEND_HUE: | 240 case FXDIB_BLEND_HUE: |
241 result = _SetLum(_SetSat(src, _Sat(back)), _Lum(back)); | 241 result = _SetLum(_SetSat(src, _Sat(back)), _Lum(back)); |
242 break; | 242 break; |
243 case FXDIB_BLEND_SATURATION: | 243 case FXDIB_BLEND_SATURATION: |
244 result = _SetLum(_SetSat(back, _Sat(src)), _Lum(back)); | 244 result = _SetLum(_SetSat(back, _Sat(src)), _Lum(back)); |
245 break; | 245 break; |
246 case FXDIB_BLEND_COLOR: | 246 case FXDIB_BLEND_COLOR: |
247 result = _SetLum(src, _Lum(back)); | 247 result = _SetLum(src, _Lum(back)); |
248 break; | 248 break; |
249 case FXDIB_BLEND_LUMINOSITY: | 249 case FXDIB_BLEND_LUMINOSITY: |
250 result = _SetLum(back, _Lum(src)); | 250 result = _SetLum(back, _Lum(src)); |
251 break; | 251 break; |
252 } | 252 } |
253 results[0] = result.blue; | 253 results[0] = result.blue; |
254 results[1] = result.green; | 254 results[1] = result.green; |
255 results[2] = result.red; | 255 results[2] = result.red; |
256 } | 256 } |
257 inline void _CompositeRow_Argb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in
t pixel_count, FX_LPCBYTE clip_scan) | 257 inline void _CompositeRow_Argb2Mask(uint8_t* dest_scan, const uint8_t* src_scan,
int pixel_count, const uint8_t* clip_scan) |
258 { | 258 { |
259 src_scan += 3; | 259 src_scan += 3; |
260 for (int col = 0; col < pixel_count; col ++) { | 260 for (int col = 0; col < pixel_count; col ++) { |
261 int src_alpha = *src_scan; | 261 int src_alpha = *src_scan; |
262 if (clip_scan) { | 262 if (clip_scan) { |
263 src_alpha = clip_scan[col] * src_alpha / 255; | 263 src_alpha = clip_scan[col] * src_alpha / 255; |
264 } | 264 } |
265 uint8_t back_alpha = *dest_scan; | 265 uint8_t back_alpha = *dest_scan; |
266 if (!back_alpha) { | 266 if (!back_alpha) { |
267 *dest_scan = src_alpha; | 267 *dest_scan = src_alpha; |
268 } else if (src_alpha) { | 268 } else if (src_alpha) { |
269 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 269 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
270 } | 270 } |
271 dest_scan ++; | 271 dest_scan ++; |
272 src_scan += 4; | 272 src_scan += 4; |
273 } | 273 } |
274 } | 274 } |
275 void _CompositeRow_Rgba2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int
pixel_count, FX_LPCBYTE clip_scan) | 275 void _CompositeRow_Rgba2Mask(uint8_t* dest_scan, const uint8_t* src_alpha_scan,
int pixel_count, const uint8_t* clip_scan) |
276 { | 276 { |
277 for (int col = 0; col < pixel_count; col ++) { | 277 for (int col = 0; col < pixel_count; col ++) { |
278 int src_alpha = *src_alpha_scan++; | 278 int src_alpha = *src_alpha_scan++; |
279 if (clip_scan) { | 279 if (clip_scan) { |
280 src_alpha = clip_scan[col] * src_alpha / 255; | 280 src_alpha = clip_scan[col] * src_alpha / 255; |
281 } | 281 } |
282 uint8_t back_alpha = *dest_scan; | 282 uint8_t back_alpha = *dest_scan; |
283 if (!back_alpha) { | 283 if (!back_alpha) { |
284 *dest_scan = src_alpha; | 284 *dest_scan = src_alpha; |
285 } else if (src_alpha) { | 285 } else if (src_alpha) { |
286 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 286 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
287 } | 287 } |
288 dest_scan ++; | 288 dest_scan ++; |
289 } | 289 } |
290 } | 290 } |
291 void _CompositeRow_Rgb2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width,
FX_LPCBYTE clip_scan) | 291 void _CompositeRow_Rgb2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int wid
th, const uint8_t* clip_scan) |
292 { | 292 { |
293 if (clip_scan) { | 293 if (clip_scan) { |
294 for (int i = 0; i < width; i ++) { | 294 for (int i = 0; i < width; i ++) { |
295 *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan); | 295 *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan); |
296 dest_scan ++; | 296 dest_scan ++; |
297 clip_scan ++; | 297 clip_scan ++; |
298 } | 298 } |
299 } else { | 299 } else { |
300 FXSYS_memset8(dest_scan, 0xff, width); | 300 FXSYS_memset8(dest_scan, 0xff, width); |
301 } | 301 } |
302 } | 302 } |
303 void _CompositeRow_Argb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixe
l_count, int blend_type, FX_LPCBYTE clip_scan, | 303 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int p
ixel_count, int blend_type, const uint8_t* clip_scan, |
304 FX_LPCBYTE src_alpha_scan, FX_LPBYTE dst_alpha_sca
n, void* pIccTransform) | 304 const uint8_t* src_alpha_scan, uint8_t* dst_alpha_
scan, void* pIccTransform) |
305 { | 305 { |
306 ICodec_IccModule* pIccModule = NULL; | 306 ICodec_IccModule* pIccModule = NULL; |
307 if (pIccTransform) { | 307 if (pIccTransform) { |
308 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 308 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
309 } | 309 } |
310 if (blend_type) { | 310 if (blend_type) { |
311 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 311 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
312 int blended_color; | 312 int blended_color; |
313 if (src_alpha_scan) { | 313 if (src_alpha_scan) { |
314 for (int col = 0; col < pixel_count; col ++) { | 314 for (int col = 0; col < pixel_count; col ++) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1)
; | 486 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1)
; |
487 } else { | 487 } else { |
488 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 488 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
489 } | 489 } |
490 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 490 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
491 dest_scan ++; | 491 dest_scan ++; |
492 dst_alpha_scan++; | 492 dst_alpha_scan++; |
493 src_scan += 4; | 493 src_scan += 4; |
494 } | 494 } |
495 } | 495 } |
496 inline void _CompositeRow_Argb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in
t pixel_count, | 496 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int pixel_count, |
497 int blend_type, FX_LPCBYTE clip_scan, | 497 int blend_type, const uint8_t* clip_scan, |
498 FX_LPCBYTE src_alpha_scan, void* pIccTransfo
rm) | 498 const uint8_t* src_alpha_scan, void* pIccTra
nsform) |
499 { | 499 { |
500 ICodec_IccModule* pIccModule = NULL; | 500 ICodec_IccModule* pIccModule = NULL; |
501 uint8_t gray; | 501 uint8_t gray; |
502 if (pIccTransform) { | 502 if (pIccTransform) { |
503 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 503 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
504 } | 504 } |
505 if (blend_type) { | 505 if (blend_type) { |
506 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 506 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
507 int blended_color; | 507 int blended_color; |
508 if (src_alpha_scan) { | 508 if (src_alpha_scan) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan
, 1); | 577 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan
, 1); |
578 } else { | 578 } else { |
579 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 579 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
580 } | 580 } |
581 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 581 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
582 } | 582 } |
583 dest_scan ++; | 583 dest_scan ++; |
584 src_scan += 4; | 584 src_scan += 4; |
585 } | 585 } |
586 } | 586 } |
587 inline void _CompositeRow_Rgb2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int
src_Bpp, int pixel_count, | 587 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, const uint8_t* src_scan,
int src_Bpp, int pixel_count, |
588 int blend_type, FX_LPCBYTE clip_scan, | 588 int blend_type, const uint8_t* clip_scan, |
589 void* pIccTransform) | 589 void* pIccTransform) |
590 { | 590 { |
591 ICodec_IccModule* pIccModule = NULL; | 591 ICodec_IccModule* pIccModule = NULL; |
592 uint8_t gray; | 592 uint8_t gray; |
593 if (pIccTransform) { | 593 if (pIccTransform) { |
594 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 594 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
595 } | 595 } |
596 if (blend_type) { | 596 if (blend_type) { |
597 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 597 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
598 int blended_color; | 598 int blended_color; |
(...skipping 25 matching lines...) Expand all Loading... |
624 } | 624 } |
625 if (clip_scan && clip_scan[col] < 255) { | 625 if (clip_scan && clip_scan[col] < 255) { |
626 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 626 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
627 } else { | 627 } else { |
628 *dest_scan = gray; | 628 *dest_scan = gray; |
629 } | 629 } |
630 dest_scan ++; | 630 dest_scan ++; |
631 src_scan += src_Bpp; | 631 src_scan += src_Bpp; |
632 } | 632 } |
633 } | 633 } |
634 void _CompositeRow_Rgb2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_B
pp, int pixel_count, | 634 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, const uint8_t* src_scan, int sr
c_Bpp, int pixel_count, |
635 int blend_type, FX_LPCBYTE clip_scan, | 635 int blend_type, const uint8_t* clip_scan, |
636 FX_LPBYTE dest_alpha_scan, void* pIccTransform) | 636 uint8_t* dest_alpha_scan, void* pIccTransform) |
637 { | 637 { |
638 ICodec_IccModule* pIccModule = NULL; | 638 ICodec_IccModule* pIccModule = NULL; |
639 if (pIccTransform) { | 639 if (pIccTransform) { |
640 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 640 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
641 } | 641 } |
642 if (blend_type) { | 642 if (blend_type) { |
643 int blended_color; | 643 int blended_color; |
644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
645 for (int col = 0; col < pixel_count; col ++) { | 645 for (int col = 0; col < pixel_count; col ++) { |
646 int back_alpha = *dest_alpha_scan; | 646 int back_alpha = *dest_alpha_scan; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 if (pIccTransform) { | 714 if (pIccTransform) { |
715 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 715 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
716 } else { | 716 } else { |
717 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 717 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
718 } | 718 } |
719 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 719 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
720 dest_scan ++; | 720 dest_scan ++; |
721 src_scan += src_Bpp; | 721 src_scan += src_Bpp; |
722 } | 722 } |
723 } | 723 } |
724 void _CompositeRow_Argb2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel
_count, int blend_type, FX_LPCBYTE clip_scan, | 724 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int pi
xel_count, int blend_type, const uint8_t* clip_scan, |
725 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_sca
n) | 725 uint8_t* dest_alpha_scan, const uint8_t* src_alpha_
scan) |
726 { | 726 { |
727 int blended_colors[3]; | 727 int blended_colors[3]; |
728 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 728 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
729 if (dest_alpha_scan == NULL) { | 729 if (dest_alpha_scan == NULL) { |
730 if (src_alpha_scan == NULL) { | 730 if (src_alpha_scan == NULL) { |
731 uint8_t back_alpha = 0; | 731 uint8_t back_alpha = 0; |
732 for (int col = 0; col < pixel_count; col ++) { | 732 for (int col = 0; col < pixel_count; col ++) { |
733 back_alpha = dest_scan[3]; | 733 back_alpha = dest_scan[3]; |
734 if (back_alpha == 0) { | 734 if (back_alpha == 0) { |
735 if (clip_scan) { | 735 if (clip_scan) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al
pha_ratio); | 921 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al
pha_ratio); |
922 } | 922 } |
923 dest_scan ++; | 923 dest_scan ++; |
924 src_scan ++; | 924 src_scan ++; |
925 } | 925 } |
926 src_scan ++; | 926 src_scan ++; |
927 } | 927 } |
928 } | 928 } |
929 } | 929 } |
930 } | 930 } |
931 void _CompositeRow_Rgb2Argb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca
n, int width, int blend_type, int src_Bpp, | 931 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int src_Bpp, |
932 FX_LPBYTE dest_alpha_scan) | 932 uint8_t* dest_alpha_scan) |
933 { | 933 { |
934 int blended_colors[3]; | 934 int blended_colors[3]; |
935 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 935 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
936 int src_gap = src_Bpp - 3; | 936 int src_gap = src_Bpp - 3; |
937 if (dest_alpha_scan == NULL) { | 937 if (dest_alpha_scan == NULL) { |
938 for (int col = 0; col < width; col ++) { | 938 for (int col = 0; col < width; col ++) { |
939 uint8_t back_alpha = dest_scan[3]; | 939 uint8_t back_alpha = dest_scan[3]; |
940 if (back_alpha == 0) { | 940 if (back_alpha == 0) { |
941 if (src_Bpp == 4) { | 941 if (src_Bpp == 4) { |
942 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); | 942 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 int blended = bNonseparableBlend ? blended_colors[color] : | 982 int blended = bNonseparableBlend ? blended_colors[color] : |
983 _BLEND(blend_type, *dest_scan, src_color); | 983 _BLEND(blend_type, *dest_scan, src_color); |
984 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 984 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
985 dest_scan ++; | 985 dest_scan ++; |
986 src_scan ++; | 986 src_scan ++; |
987 } | 987 } |
988 src_scan += src_gap; | 988 src_scan += src_gap; |
989 } | 989 } |
990 } | 990 } |
991 } | 991 } |
992 inline void _CompositeRow_Rgb2Argb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE sr
c_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, | 992 inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip_scan, |
993 FX_LPBYTE dest_alpha_scan) | 993 uint8_t* dest_alpha_scan) |
994 { | 994 { |
995 int blended_colors[3]; | 995 int blended_colors[3]; |
996 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 996 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
997 int src_gap = src_Bpp - 3; | 997 int src_gap = src_Bpp - 3; |
998 if (dest_alpha_scan == NULL) { | 998 if (dest_alpha_scan == NULL) { |
999 for (int col = 0; col < width; col ++) { | 999 for (int col = 0; col < width; col ++) { |
1000 int src_alpha = *clip_scan ++; | 1000 int src_alpha = *clip_scan ++; |
1001 uint8_t back_alpha = dest_scan[3]; | 1001 uint8_t back_alpha = dest_scan[3]; |
1002 if (back_alpha == 0) { | 1002 if (back_alpha == 0) { |
1003 *dest_scan++ = *src_scan++; | 1003 *dest_scan++ = *src_scan++; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 _BLEND(blend_type, *dest_scan, src_color); | 1060 _BLEND(blend_type, *dest_scan, src_color); |
1061 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 1061 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
1062 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio)
; | 1062 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio)
; |
1063 dest_scan ++; | 1063 dest_scan ++; |
1064 src_scan ++; | 1064 src_scan ++; |
1065 } | 1065 } |
1066 src_scan += src_gap; | 1066 src_scan += src_gap; |
1067 } | 1067 } |
1068 } | 1068 } |
1069 } | 1069 } |
1070 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE
src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, | 1070 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan, const uint8_
t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, |
1071 FX_LPBYTE dest_alpha_scan) | 1071 uint8_t* dest_alpha_scan) |
1072 { | 1072 { |
1073 int src_gap = src_Bpp - 3; | 1073 int src_gap = src_Bpp - 3; |
1074 if (dest_alpha_scan == NULL) { | 1074 if (dest_alpha_scan == NULL) { |
1075 for (int col = 0; col < width; col ++) { | 1075 for (int col = 0; col < width; col ++) { |
1076 int src_alpha = clip_scan[col]; | 1076 int src_alpha = clip_scan[col]; |
1077 if (src_alpha == 255) { | 1077 if (src_alpha == 255) { |
1078 *dest_scan++ = *src_scan++; | 1078 *dest_scan++ = *src_scan++; |
1079 *dest_scan++ = *src_scan++; | 1079 *dest_scan++ = *src_scan++; |
1080 *dest_scan++ = *src_scan++; | 1080 *dest_scan++ = *src_scan++; |
1081 *dest_scan++ = 255; | 1081 *dest_scan++ = 255; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1122 int alpha_ratio = src_alpha * 255 / dest_alpha; |
1123 for (int color = 0; color < 3; color ++) { | 1123 for (int color = 0; color < 3; color ++) { |
1124 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_rati
o); | 1124 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_rati
o); |
1125 dest_scan ++; | 1125 dest_scan ++; |
1126 src_scan ++; | 1126 src_scan ++; |
1127 } | 1127 } |
1128 src_scan += src_gap; | 1128 src_scan += src_gap; |
1129 } | 1129 } |
1130 } | 1130 } |
1131 } | 1131 } |
1132 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYT
E src_scan, int width, int src_Bpp, | 1132 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, const uint
8_t* src_scan, int width, int src_Bpp, |
1133 FX_LPBYTE dest_alpha_scan) | 1133 uint8_t* dest_alpha_scan) |
1134 { | 1134 { |
1135 if (dest_alpha_scan == NULL) { | 1135 if (dest_alpha_scan == NULL) { |
1136 for (int col = 0; col < width; col ++) { | 1136 for (int col = 0; col < width; col ++) { |
1137 if (src_Bpp == 4) { | 1137 if (src_Bpp == 4) { |
1138 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 1138 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
1139 } else { | 1139 } else { |
1140 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan
[1], src_scan[0])); | 1140 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan
[1], src_scan[0])); |
1141 } | 1141 } |
1142 dest_scan += 4; | 1142 dest_scan += 4; |
1143 src_scan += src_Bpp; | 1143 src_scan += src_Bpp; |
1144 } | 1144 } |
1145 } else { | 1145 } else { |
1146 int src_gap = src_Bpp - 3; | 1146 int src_gap = src_Bpp - 3; |
1147 for (int col = 0; col < width; col ++) { | 1147 for (int col = 0; col < width; col ++) { |
1148 *dest_scan++ = *src_scan++; | 1148 *dest_scan++ = *src_scan++; |
1149 *dest_scan++ = *src_scan++; | 1149 *dest_scan++ = *src_scan++; |
1150 *dest_scan++ = *src_scan++; | 1150 *dest_scan++ = *src_scan++; |
1151 *dest_alpha_scan++ = 0xff; | 1151 *dest_alpha_scan++ = 0xff; |
1152 src_scan += src_gap; | 1152 src_scan += src_gap; |
1153 } | 1153 } |
1154 } | 1154 } |
1155 } | 1155 } |
1156 inline void _CompositeRow_Argb2Rgb_Blend(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca
n, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, | 1156 inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* src_
scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_scan, |
1157 FX_LPCBYTE src_alpha_scan) | 1157 const uint8_t* src_alpha_scan) |
1158 { | 1158 { |
1159 int blended_colors[3]; | 1159 int blended_colors[3]; |
1160 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1160 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1161 int dest_gap = dest_Bpp - 3; | 1161 int dest_gap = dest_Bpp - 3; |
1162 if (src_alpha_scan == NULL) { | 1162 if (src_alpha_scan == NULL) { |
1163 for (int col = 0; col < width; col ++) { | 1163 for (int col = 0; col < width; col ++) { |
1164 uint8_t src_alpha; | 1164 uint8_t src_alpha; |
1165 if (clip_scan) { | 1165 if (clip_scan) { |
1166 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1166 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
1167 } else { | 1167 } else { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 int blended = bNonseparableBlend ? blended_colors[color] : | 1207 int blended = bNonseparableBlend ? blended_colors[color] : |
1208 _BLEND(blend_type, back_color, *src_scan); | 1208 _BLEND(blend_type, back_color, *src_scan); |
1209 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1209 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
1210 dest_scan ++; | 1210 dest_scan ++; |
1211 src_scan ++; | 1211 src_scan ++; |
1212 } | 1212 } |
1213 dest_scan += dest_gap; | 1213 dest_scan += dest_gap; |
1214 } | 1214 } |
1215 } | 1215 } |
1216 } | 1216 } |
1217 inline void _CompositeRow_Argb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_s
can, int width, int dest_Bpp, FX_LPCBYTE clip_scan, | 1217 inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* sr
c_scan, int width, int dest_Bpp, const uint8_t* clip_scan, |
1218 FX_LPCBYTE src_alpha_scan) | 1218 const uint8_t* src_alpha_scan) |
1219 { | 1219 { |
1220 int dest_gap = dest_Bpp - 3; | 1220 int dest_gap = dest_Bpp - 3; |
1221 if (src_alpha_scan == NULL) { | 1221 if (src_alpha_scan == NULL) { |
1222 for (int col = 0; col < width; col ++) { | 1222 for (int col = 0; col < width; col ++) { |
1223 uint8_t src_alpha; | 1223 uint8_t src_alpha; |
1224 if (clip_scan) { | 1224 if (clip_scan) { |
1225 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1225 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
1226 } else { | 1226 } else { |
1227 src_alpha = src_scan[3]; | 1227 src_alpha = src_scan[3]; |
1228 } | 1228 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 } | 1269 } |
1270 for (int color = 0; color < 3; color ++) { | 1270 for (int color = 0; color < 3; color ++) { |
1271 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha)
; | 1271 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha)
; |
1272 dest_scan ++; | 1272 dest_scan ++; |
1273 src_scan ++; | 1273 src_scan ++; |
1274 } | 1274 } |
1275 dest_scan += dest_gap; | 1275 dest_scan += dest_gap; |
1276 } | 1276 } |
1277 } | 1277 } |
1278 } | 1278 } |
1279 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE s
rc_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) | 1279 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, const uint8_t
* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) |
1280 { | 1280 { |
1281 int blended_colors[3]; | 1281 int blended_colors[3]; |
1282 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1282 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1283 int dest_gap = dest_Bpp - 3; | 1283 int dest_gap = dest_Bpp - 3; |
1284 int src_gap = src_Bpp - 3; | 1284 int src_gap = src_Bpp - 3; |
1285 for (int col = 0; col < width; col ++) { | 1285 for (int col = 0; col < width; col ++) { |
1286 if (bNonseparableBlend) { | 1286 if (bNonseparableBlend) { |
1287 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1287 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
1288 } | 1288 } |
1289 for (int color = 0; color < 3; color ++) { | 1289 for (int color = 0; color < 3; color ++) { |
1290 int back_color = *dest_scan; | 1290 int back_color = *dest_scan; |
1291 int src_color = *src_scan; | 1291 int src_color = *src_scan; |
1292 int blended = bNonseparableBlend ? blended_colors[color] : | 1292 int blended = bNonseparableBlend ? blended_colors[color] : |
1293 _BLEND(blend_type, back_color, src_color); | 1293 _BLEND(blend_type, back_color, src_color); |
1294 *dest_scan = blended; | 1294 *dest_scan = blended; |
1295 dest_scan ++; | 1295 dest_scan ++; |
1296 src_scan ++; | 1296 src_scan ++; |
1297 } | 1297 } |
1298 dest_scan += dest_gap; | 1298 dest_scan += dest_gap; |
1299 src_scan += src_gap; | 1299 src_scan += src_gap; |
1300 } | 1300 } |
1301 } | 1301 } |
1302 inline void _CompositeRow_Rgb2Rgb_Blend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE src
_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_sca
n) | 1302 inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, const uint8_t*
src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const uint8_t* c
lip_scan) |
1303 { | 1303 { |
1304 int blended_colors[3]; | 1304 int blended_colors[3]; |
1305 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1305 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1306 int dest_gap = dest_Bpp - 3; | 1306 int dest_gap = dest_Bpp - 3; |
1307 int src_gap = src_Bpp - 3; | 1307 int src_gap = src_Bpp - 3; |
1308 for (int col = 0; col < width; col ++) { | 1308 for (int col = 0; col < width; col ++) { |
1309 uint8_t src_alpha = *clip_scan ++; | 1309 uint8_t src_alpha = *clip_scan ++; |
1310 if (src_alpha == 0) { | 1310 if (src_alpha == 0) { |
1311 dest_scan += dest_Bpp; | 1311 dest_scan += dest_Bpp; |
1312 src_scan += src_Bpp; | 1312 src_scan += src_Bpp; |
1313 continue; | 1313 continue; |
1314 } | 1314 } |
1315 if (bNonseparableBlend) { | 1315 if (bNonseparableBlend) { |
1316 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1316 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
1317 } | 1317 } |
1318 for (int color = 0; color < 3; color ++) { | 1318 for (int color = 0; color < 3; color ++) { |
1319 int src_color = *src_scan; | 1319 int src_color = *src_scan; |
1320 int back_color = *dest_scan; | 1320 int back_color = *dest_scan; |
1321 int blended = bNonseparableBlend ? blended_colors[color] : | 1321 int blended = bNonseparableBlend ? blended_colors[color] : |
1322 _BLEND(blend_type, back_color, src_color); | 1322 _BLEND(blend_type, back_color, src_color); |
1323 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1323 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
1324 dest_scan ++; | 1324 dest_scan ++; |
1325 src_scan ++; | 1325 src_scan ++; |
1326 } | 1326 } |
1327 dest_scan += dest_gap; | 1327 dest_scan += dest_gap; |
1328 src_scan += src_gap; | 1328 src_scan += src_gap; |
1329 } | 1329 } |
1330 } | 1330 } |
1331 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(FX_LPBYTE dest_scan, FX_LPCBYTE
src_scan, int width, int dest_Bpp, int src_Bpp) | 1331 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, const uint8
_t* src_scan, int width, int dest_Bpp, int src_Bpp) |
1332 { | 1332 { |
1333 if (dest_Bpp == src_Bpp) { | 1333 if (dest_Bpp == src_Bpp) { |
1334 FXSYS_memcpy32(dest_scan, src_scan, width * dest_Bpp); | 1334 FXSYS_memcpy32(dest_scan, src_scan, width * dest_Bpp); |
1335 return; | 1335 return; |
1336 } | 1336 } |
1337 for (int col = 0; col < width; col ++) { | 1337 for (int col = 0; col < width; col ++) { |
1338 dest_scan[0] = src_scan[0]; | 1338 dest_scan[0] = src_scan[0]; |
1339 dest_scan[1] = src_scan[1]; | 1339 dest_scan[1] = src_scan[1]; |
1340 dest_scan[2] = src_scan[2]; | 1340 dest_scan[2] = src_scan[2]; |
1341 dest_scan += dest_Bpp; | 1341 dest_scan += dest_Bpp; |
1342 src_scan += src_Bpp; | 1342 src_scan += src_Bpp; |
1343 } | 1343 } |
1344 } | 1344 } |
1345 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(FX_LPBYTE dest_scan, FX_LPCBYTE s
rc_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan) | 1345 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan, const uint8_t
* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_scan) |
1346 { | 1346 { |
1347 for (int col = 0; col < width; col ++) { | 1347 for (int col = 0; col < width; col ++) { |
1348 int src_alpha = clip_scan[col]; | 1348 int src_alpha = clip_scan[col]; |
1349 if (src_alpha == 255) { | 1349 if (src_alpha == 255) { |
1350 dest_scan[0] = src_scan[0]; | 1350 dest_scan[0] = src_scan[0]; |
1351 dest_scan[1] = src_scan[1]; | 1351 dest_scan[1] = src_scan[1]; |
1352 dest_scan[2] = src_scan[2]; | 1352 dest_scan[2] = src_scan[2]; |
1353 } else if (src_alpha) { | 1353 } else if (src_alpha) { |
1354 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1354 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
1355 dest_scan ++; | 1355 dest_scan ++; |
1356 src_scan ++; | 1356 src_scan ++; |
1357 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1357 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
1358 dest_scan ++; | 1358 dest_scan ++; |
1359 src_scan ++; | 1359 src_scan ++; |
1360 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1360 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
1361 dest_scan += dest_Bpp - 2; | 1361 dest_scan += dest_Bpp - 2; |
1362 src_scan += src_Bpp - 2; | 1362 src_scan += src_Bpp - 2; |
1363 continue; | 1363 continue; |
1364 } | 1364 } |
1365 dest_scan += dest_Bpp; | 1365 dest_scan += dest_Bpp; |
1366 src_scan += src_Bpp; | 1366 src_scan += src_Bpp; |
1367 } | 1367 } |
1368 } | 1368 } |
1369 void _CompositeRow_Argb2Argb_Transform(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan,
int pixel_count, int blend_type, FX_LPCBYTE clip_scan, | 1369 void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, const uint8_t* src_sc
an, int pixel_count, int blend_type, const uint8_t* clip_scan, |
1370 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src
_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform) | 1370 uint8_t* dest_alpha_scan, const uint8_t*
src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) |
1371 { | 1371 { |
1372 FX_LPBYTE dp = src_cache_scan; | 1372 uint8_t* dp = src_cache_scan; |
1373 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1373 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1374 if (src_alpha_scan) { | 1374 if (src_alpha_scan) { |
1375 if (dest_alpha_scan == NULL) { | 1375 if (dest_alpha_scan == NULL) { |
1376 for (int col = 0; col < pixel_count; col ++) { | 1376 for (int col = 0; col < pixel_count; col ++) { |
1377 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1377 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1378 dp[3] = *src_alpha_scan++; | 1378 dp[3] = *src_alpha_scan++; |
1379 src_scan += 3; | 1379 src_scan += 3; |
1380 dp += 4; | 1380 dp += 4; |
1381 } | 1381 } |
1382 src_alpha_scan = NULL; | 1382 src_alpha_scan = NULL; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 } | 1444 } |
1445 dest_scan ++; | 1445 dest_scan ++; |
1446 src_cache_scan ++; | 1446 src_cache_scan ++; |
1447 } | 1447 } |
1448 } | 1448 } |
1449 return; | 1449 return; |
1450 } | 1450 } |
1451 } | 1451 } |
1452 _CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type,
clip_scan, dest_alpha_scan, src_alpha_scan); | 1452 _CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type,
clip_scan, dest_alpha_scan, src_alpha_scan); |
1453 } | 1453 } |
1454 void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX_LPCBY
TE src_scan, int width, int blend_type, int src_Bpp, | 1454 void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, const uin
t8_t* src_scan, int width, int blend_type, int src_Bpp, |
1455 FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1455 uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) |
1456 { | 1456 { |
1457 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1457 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1458 if (src_Bpp == 3) { | 1458 if (src_Bpp == 3) { |
1459 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1459 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1460 } else { | 1460 } else { |
1461 FX_LPBYTE dp = src_cache_scan; | 1461 uint8_t* dp = src_cache_scan; |
1462 for (int col = 0; col < width; col ++) { | 1462 for (int col = 0; col < width; col ++) { |
1463 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1463 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1464 src_scan += 4; | 1464 src_scan += 4; |
1465 dp += 3; | 1465 dp += 3; |
1466 } | 1466 } |
1467 } | 1467 } |
1468 _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_
type, 3, dest_alpha_scan); | 1468 _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_
type, 3, dest_alpha_scan); |
1469 } | 1469 } |
1470 inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_
LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan, | 1470 inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform(uint8_t* dest_scan, cons
t uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* clip
_scan, |
1471 FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1471 uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) |
1472 { | 1472 { |
1473 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1473 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1474 if (src_Bpp == 3) { | 1474 if (src_Bpp == 3) { |
1475 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1475 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1476 } else { | 1476 } else { |
1477 FX_LPBYTE dp = src_cache_scan; | 1477 uint8_t* dp = src_cache_scan; |
1478 for (int col = 0; col < width; col ++) { | 1478 for (int col = 0; col < width; col ++) { |
1479 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1479 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1480 src_scan += 4; | 1480 src_scan += 4; |
1481 dp += 3; | 1481 dp += 3; |
1482 } | 1482 } |
1483 } | 1483 } |
1484 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_ty
pe, 3, clip_scan, dest_alpha_scan); | 1484 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_ty
pe, 3, clip_scan, dest_alpha_scan); |
1485 } | 1485 } |
1486 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, F
X_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan, | 1486 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(uint8_t* dest_scan, co
nst uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan, |
1487 FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1487 uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) |
1488 { | 1488 { |
1489 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1489 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1490 if (src_Bpp == 3) { | 1490 if (src_Bpp == 3) { |
1491 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1491 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1492 } else { | 1492 } else { |
1493 FX_LPBYTE dp = src_cache_scan; | 1493 uint8_t* dp = src_cache_scan; |
1494 for (int col = 0; col < width; col ++) { | 1494 for (int col = 0; col < width; col ++) { |
1495 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1495 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1496 src_scan += 4; | 1496 src_scan += 4; |
1497 dp += 3; | 1497 dp += 3; |
1498 } | 1498 } |
1499 } | 1499 } |
1500 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, cli
p_scan, dest_alpha_scan); | 1500 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, cli
p_scan, dest_alpha_scan); |
1501 } | 1501 } |
1502 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, int src_Bpp, | 1502 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int src_Bpp, |
1503 FX_LPBYTE dest_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1503 uint8_t* dest_alpha_scan, uint8_t* src_cache_scan, void* pIccTransform) |
1504 { | 1504 { |
1505 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1505 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1506 if (src_Bpp == 3) { | 1506 if (src_Bpp == 3) { |
1507 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1507 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1508 } else { | 1508 } else { |
1509 FX_LPBYTE dp = src_cache_scan; | 1509 uint8_t* dp = src_cache_scan; |
1510 for (int col = 0; col < width; col ++) { | 1510 for (int col = 0; col < width; col ++) { |
1511 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1511 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1512 src_scan += 4; | 1512 src_scan += 4; |
1513 dp += 3; | 1513 dp += 3; |
1514 } | 1514 } |
1515 } | 1515 } |
1516 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d
est_alpha_scan); | 1516 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, d
est_alpha_scan); |
1517 } | 1517 } |
1518 inline void _CompositeRow_Argb2Rgb_Blend_Transform(FX_LPBYTE dest_scan, FX_LPCBY
TE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan, | 1518 inline void _CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, const uin
t8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_sca
n, |
1519 FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1519 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf
orm) |
1520 { | 1520 { |
1521 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1521 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1522 if (src_alpha_scan) { | 1522 if (src_alpha_scan) { |
1523 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1523 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1524 } else { | 1524 } else { |
1525 int blended_colors[3]; | 1525 int blended_colors[3]; |
1526 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1526 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1527 int dest_gap = dest_Bpp - 3; | 1527 int dest_gap = dest_Bpp - 3; |
1528 for (int col = 0; col < width; col ++) { | 1528 for (int col = 0; col < width; col ++) { |
1529 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); | 1529 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); |
(...skipping 19 matching lines...) Expand all Loading... |
1549 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1549 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
1550 dest_scan ++; | 1550 dest_scan ++; |
1551 src_cache_scan ++; | 1551 src_cache_scan ++; |
1552 } | 1552 } |
1553 dest_scan += dest_gap; | 1553 dest_scan += dest_gap; |
1554 } | 1554 } |
1555 return; | 1555 return; |
1556 } | 1556 } |
1557 _CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, d
est_Bpp, clip_scan, src_alpha_scan); | 1557 _CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, d
est_Bpp, clip_scan, src_alpha_scan); |
1558 } | 1558 } |
1559 inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(FX_LPBYTE dest_scan, FX_LPC
BYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan, | 1559 inline void _CompositeRow_Argb2Rgb_NoBlend_Transform(uint8_t* dest_scan, const u
int8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan, |
1560 FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform
) | 1560 const uint8_t* src_alpha_scan, uint8_t* src_cache_scan, void* pIccTransf
orm) |
1561 { | 1561 { |
1562 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1562 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1563 if (src_alpha_scan) { | 1563 if (src_alpha_scan) { |
1564 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1564 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1565 } else { | 1565 } else { |
1566 int dest_gap = dest_Bpp - 3; | 1566 int dest_gap = dest_Bpp - 3; |
1567 for (int col = 0; col < width; col ++) { | 1567 for (int col = 0; col < width; col ++) { |
1568 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); | 1568 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_sca
n, 1); |
1569 uint8_t src_alpha; | 1569 uint8_t src_alpha; |
1570 if (clip_scan) { | 1570 if (clip_scan) { |
(...skipping 18 matching lines...) Expand all Loading... |
1589 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, src_
alpha); | 1589 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, src_
alpha); |
1590 dest_scan ++; | 1590 dest_scan ++; |
1591 src_cache_scan ++; | 1591 src_cache_scan ++; |
1592 } | 1592 } |
1593 dest_scan += dest_gap; | 1593 dest_scan += dest_gap; |
1594 } | 1594 } |
1595 return; | 1595 return; |
1596 } | 1596 } |
1597 _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, c
lip_scan, src_alpha_scan); | 1597 _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, c
lip_scan, src_alpha_scan); |
1598 } | 1598 } |
1599 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(FX_LPBYTE dest_scan, FX
_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, | 1599 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(uint8_t* dest_scan, con
st uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, |
1600 FX_LPBYTE src_cache_scan, void* pIccTransform) | 1600 uint8_t* src_cache_scan, void* pIccTransform) |
1601 { | 1601 { |
1602 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1602 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1603 if (src_Bpp == 3) { | 1603 if (src_Bpp == 3) { |
1604 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1604 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1605 } else { | 1605 } else { |
1606 FX_LPBYTE dp = src_cache_scan; | 1606 uint8_t* dp = src_cache_scan; |
1607 for (int col = 0; col < width; col ++) { | 1607 for (int col = 0; col < width; col ++) { |
1608 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1608 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1609 src_scan += 4; | 1609 src_scan += 4; |
1610 dp += 3; | 1610 dp += 3; |
1611 } | 1611 } |
1612 } | 1612 } |
1613 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_t
ype, dest_Bpp, 3); | 1613 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, blend_t
ype, dest_Bpp, 3); |
1614 } | 1614 } |
1615 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(FX_LPBYTE dest_scan, FX_L
PCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYT
E clip_scan, | 1615 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, const
uint8_t* clip_scan, |
1616 FX_LPBYTE src_cache_scan, void* pIccTransform) | 1616 uint8_t* src_cache_scan, void* pIccTransform) |
1617 { | 1617 { |
1618 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1618 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1619 if (src_Bpp == 3) { | 1619 if (src_Bpp == 3) { |
1620 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1620 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1621 } else { | 1621 } else { |
1622 FX_LPBYTE dp = src_cache_scan; | 1622 uint8_t* dp = src_cache_scan; |
1623 for (int col = 0; col < width; col ++) { | 1623 for (int col = 0; col < width; col ++) { |
1624 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1624 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1625 src_scan += 4; | 1625 src_scan += 4; |
1626 dp += 3; | 1626 dp += 3; |
1627 } | 1627 } |
1628 } | 1628 } |
1629 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_typ
e, dest_Bpp, 3, clip_scan); | 1629 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_typ
e, dest_Bpp, 3, clip_scan); |
1630 } | 1630 } |
1631 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, | 1631 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(uint8_t* dest_scan, c
onst uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, |
1632 FX_LPBYTE src_cache_scan, void* pIccTransform) | 1632 uint8_t* src_cache_scan, void* pIccTransform) |
1633 { | 1633 { |
1634 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1634 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1635 if (src_Bpp == 3) { | 1635 if (src_Bpp == 3) { |
1636 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1636 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1637 } else { | 1637 } else { |
1638 FX_LPBYTE dp = src_cache_scan; | 1638 uint8_t* dp = src_cache_scan; |
1639 for (int col = 0; col < width; col ++) { | 1639 for (int col = 0; col < width; col ++) { |
1640 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1640 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1641 src_scan += 4; | 1641 src_scan += 4; |
1642 dp += 3; | 1642 dp += 3; |
1643 } | 1643 } |
1644 } | 1644 } |
1645 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, dest_
Bpp, 3); | 1645 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, dest_
Bpp, 3); |
1646 } | 1646 } |
1647 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(FX_LPBYTE dest_scan, FX
_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan, | 1647 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(uint8_t* dest_scan, con
st uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* clip_
scan, |
1648 FX_LPBYTE src_cache_scan, void* pIccTransform) | 1648 uint8_t* src_cache_scan, void* pIccTransform) |
1649 { | 1649 { |
1650 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); | 1650 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIcc
Module(); |
1651 if (src_Bpp == 3) { | 1651 if (src_Bpp == 3) { |
1652 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); | 1652 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, w
idth); |
1653 } else { | 1653 } else { |
1654 FX_LPBYTE dp = src_cache_scan; | 1654 uint8_t* dp = src_cache_scan; |
1655 for (int col = 0; col < width; col ++) { | 1655 for (int col = 0; col < width; col ++) { |
1656 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1656 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
1657 src_scan += 4; | 1657 src_scan += 4; |
1658 dp += 3; | 1658 dp += 3; |
1659 } | 1659 } |
1660 } | 1660 } |
1661 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp
p, 3, clip_scan); | 1661 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bp
p, 3, clip_scan); |
1662 } | 1662 } |
1663 inline void _CompositeRow_8bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan,
FX_LPCBYTE pPalette, int pixel_count, | 1663 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, const uint8_t* pPalette, int pixel_count, |
1664 int blend_type, FX_LPCBYTE clip_scan, | 1664 int blend_type, const uint8_t* clip_scan, |
1665 FX_LPCBYTE src_alpha_scan) | 1665 const uint8_t* src_alpha_scan) |
1666 { | 1666 { |
1667 if (src_alpha_scan) { | 1667 if (src_alpha_scan) { |
1668 if (blend_type) { | 1668 if (blend_type) { |
1669 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1669 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1670 int blended_color; | 1670 int blended_color; |
1671 for (int col = 0; col < pixel_count; col ++) { | 1671 for (int col = 0; col < pixel_count; col ++) { |
1672 uint8_t gray = pPalette[*src_scan]; | 1672 uint8_t gray = pPalette[*src_scan]; |
1673 int src_alpha = *src_alpha_scan++; | 1673 int src_alpha = *src_alpha_scan++; |
1674 if (clip_scan) { | 1674 if (clip_scan) { |
1675 src_alpha = clip_scan[col] * src_alpha / 255; | 1675 src_alpha = clip_scan[col] * src_alpha / 255; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 if (clip_scan && clip_scan[col] < 255) { | 1727 if (clip_scan && clip_scan[col] < 255) { |
1728 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col])
; | 1728 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col])
; |
1729 } else { | 1729 } else { |
1730 *dest_scan = gray; | 1730 *dest_scan = gray; |
1731 } | 1731 } |
1732 dest_scan ++; | 1732 dest_scan ++; |
1733 src_scan ++; | 1733 src_scan ++; |
1734 } | 1734 } |
1735 } | 1735 } |
1736 } | 1736 } |
1737 inline void _CompositeRow_8bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan
, FX_LPCBYTE pPalette, int pixel_count, | 1737 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, const uint8_t* pPalette, int pixel_count, |
1738 int blend_type, FX_LPCBYTE clip_scan, | 1738 int blend_type, const uint8_t* clip_scan
, |
1739 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr
c_alpha_scan) | 1739 uint8_t* dest_alpha_scan, const uint8_t*
src_alpha_scan) |
1740 { | 1740 { |
1741 if (src_alpha_scan) { | 1741 if (src_alpha_scan) { |
1742 if (blend_type) { | 1742 if (blend_type) { |
1743 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1743 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1744 int blended_color; | 1744 int blended_color; |
1745 for (int col = 0; col < pixel_count; col ++) { | 1745 for (int col = 0; col < pixel_count; col ++) { |
1746 uint8_t gray = pPalette[*src_scan]; | 1746 uint8_t gray = pPalette[*src_scan]; |
1747 src_scan ++; | 1747 src_scan ++; |
1748 uint8_t back_alpha = *dest_alpha_scan; | 1748 uint8_t back_alpha = *dest_alpha_scan; |
1749 if (back_alpha == 0) { | 1749 if (back_alpha == 0) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 } | 1859 } |
1860 int back_alpha = *dest_alpha_scan; | 1860 int back_alpha = *dest_alpha_scan; |
1861 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha
/ 255; | 1861 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha
/ 255; |
1862 *dest_alpha_scan ++ = dest_alpha; | 1862 *dest_alpha_scan ++ = dest_alpha; |
1863 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1863 int alpha_ratio = src_alpha * 255 / dest_alpha; |
1864 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 1864 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
1865 dest_scan ++; | 1865 dest_scan ++; |
1866 } | 1866 } |
1867 } | 1867 } |
1868 } | 1868 } |
1869 inline void _CompositeRow_1bppPal2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan,
int src_left, | 1869 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_sc
an, int src_left, |
1870 FX_LPCBYTE pPalette, int pixel_count, int
blend_type, FX_LPCBYTE clip_scan) | 1870 const uint8_t* pPalette, int pixel_count,
int blend_type, const uint8_t* clip_scan) |
1871 { | 1871 { |
1872 int reset_gray = pPalette[0]; | 1872 int reset_gray = pPalette[0]; |
1873 int set_gray = pPalette[1]; | 1873 int set_gray = pPalette[1]; |
1874 if (blend_type) { | 1874 if (blend_type) { |
1875 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1875 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1876 int blended_color; | 1876 int blended_color; |
1877 for (int col = 0; col < pixel_count; col ++) { | 1877 for (int col = 0; col < pixel_count; col ++) { |
1878 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; | 1878 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; |
1879 if (bNonseparableBlend) { | 1879 if (bNonseparableBlend) { |
1880 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; | 1880 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d
est_scan; |
(...skipping 11 matching lines...) Expand all Loading... |
1892 for (int col = 0; col < pixel_count; col ++) { | 1892 for (int col = 0; col < pixel_count; col ++) { |
1893 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_l
eft) % 8))) ? set_gray : reset_gray; | 1893 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_l
eft) % 8))) ? set_gray : reset_gray; |
1894 if (clip_scan && clip_scan[col] < 255) { | 1894 if (clip_scan && clip_scan[col] < 255) { |
1895 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 1895 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
1896 } else { | 1896 } else { |
1897 *dest_scan = gray; | 1897 *dest_scan = gray; |
1898 } | 1898 } |
1899 dest_scan ++; | 1899 dest_scan ++; |
1900 } | 1900 } |
1901 } | 1901 } |
1902 inline void _CompositeRow_1bppPal2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan
, int src_left, | 1902 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_s
can, int src_left, |
1903 FX_LPCBYTE pPalette, int pixel_count, in
t blend_type, FX_LPCBYTE clip_scan, | 1903 const uint8_t* pPalette, int pixel_count
, int blend_type, const uint8_t* clip_scan, |
1904 FX_LPBYTE dest_alpha_scan) | 1904 uint8_t* dest_alpha_scan) |
1905 { | 1905 { |
1906 int reset_gray = pPalette[0]; | 1906 int reset_gray = pPalette[0]; |
1907 int set_gray = pPalette[1]; | 1907 int set_gray = pPalette[1]; |
1908 if (blend_type) { | 1908 if (blend_type) { |
1909 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1909 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
1910 int blended_color; | 1910 int blended_color; |
1911 for (int col = 0; col < pixel_count; col ++) { | 1911 for (int col = 0; col < pixel_count; col ++) { |
1912 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; | 1912 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + s
rc_left) % 8))) ? set_gray : reset_gray; |
1913 if (clip_scan == NULL || clip_scan[col] == 255) { | 1913 if (clip_scan == NULL || clip_scan[col] == 255) { |
1914 *dest_scan++ = gray; | 1914 *dest_scan++ = gray; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 continue; | 1948 continue; |
1949 } | 1949 } |
1950 int back_alpha = *dest_alpha_scan; | 1950 int back_alpha = *dest_alpha_scan; |
1951 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 1951 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
1952 *dest_alpha_scan ++ = dest_alpha; | 1952 *dest_alpha_scan ++ = dest_alpha; |
1953 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1953 int alpha_ratio = src_alpha * 255 / dest_alpha; |
1954 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 1954 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
1955 dest_scan ++; | 1955 dest_scan ++; |
1956 } | 1956 } |
1957 } | 1957 } |
1958 inline void _CompositeRow_8bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr
c_scan, FX_DWORD* pPalette, int pixel_count, | 1958 inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t*
src_scan, FX_DWORD* pPalette, int pixel_count, |
1959 int DestBpp, FX_LPCBYTE clip_scan, | 1959 int DestBpp, const uint8_t* clip_scan, |
1960 FX_LPCBYTE src_alpha_scan) | 1960 const uint8_t* src_alpha_scan) |
1961 { | 1961 { |
1962 if (src_alpha_scan) { | 1962 if (src_alpha_scan) { |
1963 int dest_gap = DestBpp - 3; | 1963 int dest_gap = DestBpp - 3; |
1964 FX_ARGB argb = 0; | 1964 FX_ARGB argb = 0; |
1965 for (int col = 0; col < pixel_count; col ++) { | 1965 for (int col = 0; col < pixel_count; col ++) { |
1966 argb = pPalette[*src_scan]; | 1966 argb = pPalette[*src_scan]; |
1967 int src_r = FXARGB_R(argb); | 1967 int src_r = FXARGB_R(argb); |
1968 int src_g = FXARGB_G(argb); | 1968 int src_g = FXARGB_G(argb); |
1969 int src_b = FXARGB_B(argb); | 1969 int src_b = FXARGB_B(argb); |
1970 src_scan ++; | 1970 src_scan ++; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 *dest_scan++ = src_g; | 2012 *dest_scan++ = src_g; |
2013 *dest_scan++ = src_r; | 2013 *dest_scan++ = src_r; |
2014 } | 2014 } |
2015 if (DestBpp == 4) { | 2015 if (DestBpp == 4) { |
2016 dest_scan++; | 2016 dest_scan++; |
2017 } | 2017 } |
2018 src_scan ++; | 2018 src_scan ++; |
2019 } | 2019 } |
2020 } | 2020 } |
2021 } | 2021 } |
2022 inline void _CompositeRow_1bppRgb2Rgb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE sr
c_scan, int src_left, | 2022 inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t*
src_scan, int src_left, |
2023 FX_DWORD* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) | 2023 FX_DWORD* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_sc
an) |
2024 { | 2024 { |
2025 int reset_r, reset_g, reset_b; | 2025 int reset_r, reset_g, reset_b; |
2026 int set_r, set_g, set_b; | 2026 int set_r, set_g, set_b; |
2027 reset_r = FXARGB_R(pPalette[0]); | 2027 reset_r = FXARGB_R(pPalette[0]); |
2028 reset_g = FXARGB_G(pPalette[0]); | 2028 reset_g = FXARGB_G(pPalette[0]); |
2029 reset_b = FXARGB_B(pPalette[0]); | 2029 reset_b = FXARGB_B(pPalette[0]); |
2030 set_r = FXARGB_R(pPalette[1]); | 2030 set_r = FXARGB_R(pPalette[1]); |
2031 set_g = FXARGB_G(pPalette[1]); | 2031 set_g = FXARGB_G(pPalette[1]); |
2032 set_b = FXARGB_B(pPalette[1]); | 2032 set_b = FXARGB_B(pPalette[1]); |
2033 for (int col = 0; col < pixel_count; col ++) { | 2033 for (int col = 0; col < pixel_count; col ++) { |
(...skipping 17 matching lines...) Expand all Loading... |
2051 } else { | 2051 } else { |
2052 *dest_scan++ = src_b; | 2052 *dest_scan++ = src_b; |
2053 *dest_scan++ = src_g; | 2053 *dest_scan++ = src_g; |
2054 *dest_scan++ = src_r; | 2054 *dest_scan++ = src_r; |
2055 } | 2055 } |
2056 if (DestBpp == 4) { | 2056 if (DestBpp == 4) { |
2057 dest_scan++; | 2057 dest_scan++; |
2058 } | 2058 } |
2059 } | 2059 } |
2060 } | 2060 } |
2061 inline void _CompositeRow_8bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s
rc_scan, int width, | 2061 inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t
* src_scan, int width, |
2062 FX_DWORD* pPalette, FX_LPCBYTE clip_scan, | 2062 FX_DWORD* pPalette, const uint8_t* clip_scan, |
2063 FX_LPCBYTE src_alpha_scan) | 2063 const uint8_t* src_alpha_scan) |
2064 { | 2064 { |
2065 if (src_alpha_scan) { | 2065 if (src_alpha_scan) { |
2066 for (int col = 0; col < width; col ++) { | 2066 for (int col = 0; col < width; col ++) { |
2067 FX_ARGB argb = pPalette[*src_scan]; | 2067 FX_ARGB argb = pPalette[*src_scan]; |
2068 src_scan ++; | 2068 src_scan ++; |
2069 int src_r = FXARGB_R(argb); | 2069 int src_r = FXARGB_R(argb); |
2070 int src_g = FXARGB_G(argb); | 2070 int src_g = FXARGB_G(argb); |
2071 int src_b = FXARGB_B(argb); | 2071 int src_b = FXARGB_B(argb); |
2072 uint8_t back_alpha = dest_scan[3]; | 2072 uint8_t back_alpha = dest_scan[3]; |
2073 if (back_alpha == 0) { | 2073 if (back_alpha == 0) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2129 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2129 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2130 dest_scan ++; | 2130 dest_scan ++; |
2131 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2131 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2132 dest_scan ++; | 2132 dest_scan ++; |
2133 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2133 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2134 dest_scan ++; | 2134 dest_scan ++; |
2135 dest_scan ++; | 2135 dest_scan ++; |
2136 src_scan ++; | 2136 src_scan ++; |
2137 } | 2137 } |
2138 } | 2138 } |
2139 void _CompositeRow_8bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan
, int width, | 2139 void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_s
can, int width, |
2140 FX_DWORD* pPalette, FX_LPCBYTE clip_scan
, | 2140 FX_DWORD* pPalette, const uint8_t* clip_
scan, |
2141 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr
c_alpha_scan) | 2141 uint8_t* dest_alpha_scan, const uint8_t*
src_alpha_scan) |
2142 { | 2142 { |
2143 if (src_alpha_scan) { | 2143 if (src_alpha_scan) { |
2144 for (int col = 0; col < width; col ++) { | 2144 for (int col = 0; col < width; col ++) { |
2145 FX_ARGB argb = pPalette[*src_scan]; | 2145 FX_ARGB argb = pPalette[*src_scan]; |
2146 src_scan ++; | 2146 src_scan ++; |
2147 int src_r = FXARGB_R(argb); | 2147 int src_r = FXARGB_R(argb); |
2148 int src_g = FXARGB_G(argb); | 2148 int src_g = FXARGB_G(argb); |
2149 int src_b = FXARGB_B(argb); | 2149 int src_b = FXARGB_B(argb); |
2150 uint8_t back_alpha = *dest_alpha_scan; | 2150 uint8_t back_alpha = *dest_alpha_scan; |
2151 if (back_alpha == 0) { | 2151 if (back_alpha == 0) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2209 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2210 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2210 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2211 dest_scan ++; | 2211 dest_scan ++; |
2212 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2212 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2213 dest_scan ++; | 2213 dest_scan ++; |
2214 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2214 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2215 dest_scan ++; | 2215 dest_scan ++; |
2216 src_scan ++; | 2216 src_scan ++; |
2217 } | 2217 } |
2218 } | 2218 } |
2219 inline void _CompositeRow_1bppRgb2Argb_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE s
rc_scan, int src_left, int width, | 2219 inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t
* src_scan, int src_left, int width, |
2220 FX_DWORD* pPalette, FX_LPCBYTE clip_scan) | 2220 FX_DWORD* pPalette, const uint8_t* clip_scan) |
2221 { | 2221 { |
2222 int reset_r, reset_g, reset_b; | 2222 int reset_r, reset_g, reset_b; |
2223 int set_r, set_g, set_b; | 2223 int set_r, set_g, set_b; |
2224 reset_r = FXARGB_R(pPalette[0]); | 2224 reset_r = FXARGB_R(pPalette[0]); |
2225 reset_g = FXARGB_G(pPalette[0]); | 2225 reset_g = FXARGB_G(pPalette[0]); |
2226 reset_b = FXARGB_B(pPalette[0]); | 2226 reset_b = FXARGB_B(pPalette[0]); |
2227 set_r = FXARGB_R(pPalette[1]); | 2227 set_r = FXARGB_R(pPalette[1]); |
2228 set_g = FXARGB_G(pPalette[1]); | 2228 set_g = FXARGB_G(pPalette[1]); |
2229 set_b = FXARGB_B(pPalette[1]); | 2229 set_b = FXARGB_B(pPalette[1]); |
2230 for (int col = 0; col < width; col ++) { | 2230 for (int col = 0; col < width; col ++) { |
(...skipping 25 matching lines...) Expand all Loading... |
2256 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2256 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2257 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2257 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2258 dest_scan ++; | 2258 dest_scan ++; |
2259 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2259 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2260 dest_scan ++; | 2260 dest_scan ++; |
2261 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2261 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2262 dest_scan ++; | 2262 dest_scan ++; |
2263 dest_scan ++; | 2263 dest_scan ++; |
2264 } | 2264 } |
2265 } | 2265 } |
2266 void _CompositeRow_1bppRgb2Rgba_NoBlend(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan
, int src_left, int width, | 2266 void _CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_s
can, int src_left, int width, |
2267 FX_DWORD* pPalette, FX_LPCBYTE clip_scan
, | 2267 FX_DWORD* pPalette, const uint8_t* clip_
scan, |
2268 FX_LPBYTE dest_alpha_scan) | 2268 uint8_t* dest_alpha_scan) |
2269 { | 2269 { |
2270 int reset_r, reset_g, reset_b; | 2270 int reset_r, reset_g, reset_b; |
2271 int set_r, set_g, set_b; | 2271 int set_r, set_g, set_b; |
2272 reset_r = FXARGB_R(pPalette[0]); | 2272 reset_r = FXARGB_R(pPalette[0]); |
2273 reset_g = FXARGB_G(pPalette[0]); | 2273 reset_g = FXARGB_G(pPalette[0]); |
2274 reset_b = FXARGB_B(pPalette[0]); | 2274 reset_b = FXARGB_B(pPalette[0]); |
2275 set_r = FXARGB_R(pPalette[1]); | 2275 set_r = FXARGB_R(pPalette[1]); |
2276 set_g = FXARGB_G(pPalette[1]); | 2276 set_g = FXARGB_G(pPalette[1]); |
2277 set_b = FXARGB_B(pPalette[1]); | 2277 set_b = FXARGB_B(pPalette[1]); |
2278 for (int col = 0; col < width; col ++) { | 2278 for (int col = 0; col < width; col ++) { |
(...skipping 25 matching lines...) Expand all Loading... |
2304 *dest_alpha_scan ++ = dest_alpha; | 2304 *dest_alpha_scan ++ = dest_alpha; |
2305 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2305 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2306 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2306 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2307 dest_scan ++; | 2307 dest_scan ++; |
2308 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2308 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2309 dest_scan ++; | 2309 dest_scan ++; |
2310 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2310 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2311 dest_scan ++; | 2311 dest_scan ++; |
2312 } | 2312 } |
2313 } | 2313 } |
2314 void _CompositeRow_ByteMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m
ask_alpha, int src_r, int src_g, int src_b, int pixel_count, | 2314 void _CompositeRow_ByteMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, in
t mask_alpha, int src_r, int src_g, int src_b, int pixel_count, |
2315 int blend_type, FX_LPCBYTE clip_scan) | 2315 int blend_type, const uint8_t* clip_scan) |
2316 { | 2316 { |
2317 for (int col = 0; col < pixel_count; col ++) { | 2317 for (int col = 0; col < pixel_count; col ++) { |
2318 int src_alpha; | 2318 int src_alpha; |
2319 if (clip_scan) { | 2319 if (clip_scan) { |
2320 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2320 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2321 } else { | 2321 } else { |
2322 src_alpha = mask_alpha * src_scan[col] / 255; | 2322 src_alpha = mask_alpha * src_scan[col] / 255; |
2323 } | 2323 } |
2324 uint8_t back_alpha = dest_scan[3]; | 2324 uint8_t back_alpha = dest_scan[3]; |
2325 if (back_alpha == 0) { | 2325 if (back_alpha == 0) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2361 } else { | 2361 } else { |
2362 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2362 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2363 dest_scan ++; | 2363 dest_scan ++; |
2364 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2364 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2365 dest_scan ++; | 2365 dest_scan ++; |
2366 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2366 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2367 } | 2367 } |
2368 dest_scan += 2; | 2368 dest_scan += 2; |
2369 } | 2369 } |
2370 } | 2370 } |
2371 void _CompositeRow_ByteMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m
ask_alpha, int src_r, int src_g, int src_b, int pixel_count, | 2371 void _CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, in
t mask_alpha, int src_r, int src_g, int src_b, int pixel_count, |
2372 int blend_type, FX_LPCBYTE clip_scan, | 2372 int blend_type, const uint8_t* clip_scan, |
2373 FX_LPBYTE dest_alpha_scan) | 2373 uint8_t* dest_alpha_scan) |
2374 { | 2374 { |
2375 for (int col = 0; col < pixel_count; col ++) { | 2375 for (int col = 0; col < pixel_count; col ++) { |
2376 int src_alpha; | 2376 int src_alpha; |
2377 if (clip_scan) { | 2377 if (clip_scan) { |
2378 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2378 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2379 } else { | 2379 } else { |
2380 src_alpha = mask_alpha * src_scan[col] / 255; | 2380 src_alpha = mask_alpha * src_scan[col] / 255; |
2381 } | 2381 } |
2382 uint8_t back_alpha = *dest_alpha_scan; | 2382 uint8_t back_alpha = *dest_alpha_scan; |
2383 if (back_alpha == 0) { | 2383 if (back_alpha == 0) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 } else { | 2424 } else { |
2425 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2425 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2426 dest_scan ++; | 2426 dest_scan ++; |
2427 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2427 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2428 dest_scan ++; | 2428 dest_scan ++; |
2429 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2429 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2430 dest_scan ++; | 2430 dest_scan ++; |
2431 } | 2431 } |
2432 } | 2432 } |
2433 } | 2433 } |
2434 void _CompositeRow_ByteMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma
sk_alpha, int src_r, int src_g, int src_b, int pixel_count, | 2434 void _CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_r, int src_g, int src_b, int pixel_count, |
2435 int blend_type, int Bpp, FX_LPCBYTE clip_scan) | 2435 int blend_type, int Bpp, const uint8_t* clip_sca
n) |
2436 { | 2436 { |
2437 for (int col = 0; col < pixel_count; col ++) { | 2437 for (int col = 0; col < pixel_count; col ++) { |
2438 int src_alpha; | 2438 int src_alpha; |
2439 if (clip_scan) { | 2439 if (clip_scan) { |
2440 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2440 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2441 } else { | 2441 } else { |
2442 src_alpha = mask_alpha * src_scan[col] / 255; | 2442 src_alpha = mask_alpha * src_scan[col] / 255; |
2443 } | 2443 } |
2444 if (src_alpha == 0) { | 2444 if (src_alpha == 0) { |
2445 dest_scan += Bpp; | 2445 dest_scan += Bpp; |
(...skipping 23 matching lines...) Expand all Loading... |
2469 } else { | 2469 } else { |
2470 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); | 2470 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); |
2471 dest_scan ++; | 2471 dest_scan ++; |
2472 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); | 2472 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); |
2473 dest_scan ++; | 2473 dest_scan ++; |
2474 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); | 2474 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); |
2475 } | 2475 } |
2476 dest_scan += Bpp - 2; | 2476 dest_scan += Bpp - 2; |
2477 } | 2477 } |
2478 } | 2478 } |
2479 void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m
ask_alpha, int pixel_count, | 2479 void _CompositeRow_ByteMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, in
t mask_alpha, int pixel_count, |
2480 FX_LPCBYTE clip_scan) | 2480 const uint8_t* clip_scan) |
2481 { | 2481 { |
2482 for (int col = 0; col < pixel_count; col ++) { | 2482 for (int col = 0; col < pixel_count; col ++) { |
2483 int src_alpha; | 2483 int src_alpha; |
2484 if (clip_scan) { | 2484 if (clip_scan) { |
2485 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2485 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2486 } else { | 2486 } else { |
2487 src_alpha = mask_alpha * src_scan[col] / 255; | 2487 src_alpha = mask_alpha * src_scan[col] / 255; |
2488 } | 2488 } |
2489 uint8_t back_alpha = *dest_scan; | 2489 uint8_t back_alpha = *dest_scan; |
2490 if (!back_alpha) { | 2490 if (!back_alpha) { |
2491 *dest_scan = src_alpha; | 2491 *dest_scan = src_alpha; |
2492 } else if (src_alpha) { | 2492 } else if (src_alpha) { |
2493 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2493 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
2494 } | 2494 } |
2495 dest_scan ++; | 2495 dest_scan ++; |
2496 } | 2496 } |
2497 } | 2497 } |
2498 void _CompositeRow_ByteMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m
ask_alpha, int src_gray, | 2498 void _CompositeRow_ByteMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, in
t mask_alpha, int src_gray, |
2499 int pixel_count, FX_LPCBYTE clip_scan) | 2499 int pixel_count, const uint8_t* clip_scan) |
2500 { | 2500 { |
2501 for (int col = 0; col < pixel_count; col ++) { | 2501 for (int col = 0; col < pixel_count; col ++) { |
2502 int src_alpha; | 2502 int src_alpha; |
2503 if (clip_scan) { | 2503 if (clip_scan) { |
2504 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2504 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2505 } else { | 2505 } else { |
2506 src_alpha = mask_alpha * src_scan[col] / 255; | 2506 src_alpha = mask_alpha * src_scan[col] / 255; |
2507 } | 2507 } |
2508 if (src_alpha) { | 2508 if (src_alpha) { |
2509 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); | 2509 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); |
2510 } | 2510 } |
2511 dest_scan ++; | 2511 dest_scan ++; |
2512 } | 2512 } |
2513 } | 2513 } |
2514 void _CompositeRow_ByteMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int
mask_alpha, int src_gray, | 2514 void _CompositeRow_ByteMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, i
nt mask_alpha, int src_gray, |
2515 int pixel_count, FX_LPCBYTE clip_scan, | 2515 int pixel_count, const uint8_t* clip_scan, |
2516 FX_LPBYTE dest_alpha_scan) | 2516 uint8_t* dest_alpha_scan) |
2517 { | 2517 { |
2518 for (int col = 0; col < pixel_count; col ++) { | 2518 for (int col = 0; col < pixel_count; col ++) { |
2519 int src_alpha; | 2519 int src_alpha; |
2520 if (clip_scan) { | 2520 if (clip_scan) { |
2521 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2521 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
2522 } else { | 2522 } else { |
2523 src_alpha = mask_alpha * src_scan[col] / 255; | 2523 src_alpha = mask_alpha * src_scan[col] / 255; |
2524 } | 2524 } |
2525 uint8_t back_alpha = *dest_alpha_scan; | 2525 uint8_t back_alpha = *dest_alpha_scan; |
2526 if (back_alpha == 0) { | 2526 if (back_alpha == 0) { |
2527 *dest_scan ++ = src_gray; | 2527 *dest_scan ++ = src_gray; |
2528 *dest_alpha_scan ++ = src_alpha; | 2528 *dest_alpha_scan ++ = src_alpha; |
2529 continue; | 2529 continue; |
2530 } | 2530 } |
2531 if (src_alpha == 0) { | 2531 if (src_alpha == 0) { |
2532 dest_scan ++; | 2532 dest_scan ++; |
2533 dest_alpha_scan ++; | 2533 dest_alpha_scan ++; |
2534 continue; | 2534 continue; |
2535 } | 2535 } |
2536 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 2536 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
2537 *dest_alpha_scan++ = dest_alpha; | 2537 *dest_alpha_scan++ = dest_alpha; |
2538 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2538 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2539 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); | 2539 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); |
2540 dest_scan ++; | 2540 dest_scan ++; |
2541 } | 2541 } |
2542 } | 2542 } |
2543 void _CompositeRow_BitMask2Argb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma
sk_alpha, int src_r, int src_g, int src_b, | 2543 void _CompositeRow_BitMask2Argb(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_r, int src_g, int src_b, |
2544 int src_left, int pixel_count, int blend_type, F
X_LPCBYTE clip_scan) | 2544 int src_left, int pixel_count, int blend_type, c
onst uint8_t* clip_scan) |
2545 { | 2545 { |
2546 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { | 2546 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { |
2547 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); | 2547 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); |
2548 for (int col = 0; col < pixel_count; col ++) { | 2548 for (int col = 0; col < pixel_count; col ++) { |
2549 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { | 2549 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { |
2550 FXARGB_SETDIB(dest_scan, argb); | 2550 FXARGB_SETDIB(dest_scan, argb); |
2551 } | 2551 } |
2552 dest_scan += 4; | 2552 dest_scan += 4; |
2553 } | 2553 } |
2554 return; | 2554 return; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 } else { | 2600 } else { |
2601 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2601 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2602 dest_scan ++; | 2602 dest_scan ++; |
2603 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2603 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2604 dest_scan ++; | 2604 dest_scan ++; |
2605 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2605 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2606 } | 2606 } |
2607 dest_scan += 2; | 2607 dest_scan += 2; |
2608 } | 2608 } |
2609 } | 2609 } |
2610 void _CompositeRow_BitMask2Rgba(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma
sk_alpha, int src_r, int src_g, int src_b, | 2610 void _CompositeRow_BitMask2Rgba(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_r, int src_g, int src_b, |
2611 int src_left, int pixel_count, int blend_type, F
X_LPCBYTE clip_scan, | 2611 int src_left, int pixel_count, int blend_type, c
onst uint8_t* clip_scan, |
2612 FX_LPBYTE dest_alpha_scan) | 2612 uint8_t* dest_alpha_scan) |
2613 { | 2613 { |
2614 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { | 2614 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { |
2615 for (int col = 0; col < pixel_count; col ++) { | 2615 for (int col = 0; col < pixel_count; col ++) { |
2616 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { | 2616 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { |
2617 dest_scan[0] = src_b; | 2617 dest_scan[0] = src_b; |
2618 dest_scan[1] = src_g; | 2618 dest_scan[1] = src_g; |
2619 dest_scan[2] = src_r; | 2619 dest_scan[2] = src_r; |
2620 *dest_alpha_scan = mask_alpha; | 2620 *dest_alpha_scan = mask_alpha; |
2621 } | 2621 } |
2622 dest_scan += 3; | 2622 dest_scan += 3; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2676 } else { | 2676 } else { |
2677 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2677 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
2678 dest_scan ++; | 2678 dest_scan ++; |
2679 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2679 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
2680 dest_scan ++; | 2680 dest_scan ++; |
2681 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2681 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
2682 dest_scan ++; | 2682 dest_scan ++; |
2683 } | 2683 } |
2684 } | 2684 } |
2685 } | 2685 } |
2686 void _CompositeRow_BitMask2Rgb(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int mas
k_alpha, int src_r, int src_g, int src_b, | 2686 void _CompositeRow_BitMask2Rgb(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_r, int src_g, int src_b, |
2687 int src_left, int pixel_count, int blend_type, in
t Bpp, FX_LPCBYTE clip_scan) | 2687 int src_left, int pixel_count, int blend_type, in
t Bpp, const uint8_t* clip_scan) |
2688 { | 2688 { |
2689 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { | 2689 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { |
2690 for (int col = 0; col < pixel_count; col ++) { | 2690 for (int col = 0; col < pixel_count; col ++) { |
2691 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { | 2691 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { |
2692 dest_scan[2] = src_r; | 2692 dest_scan[2] = src_r; |
2693 dest_scan[1] = src_g; | 2693 dest_scan[1] = src_g; |
2694 dest_scan[0] = src_b; | 2694 dest_scan[0] = src_b; |
2695 } | 2695 } |
2696 dest_scan += Bpp; | 2696 dest_scan += Bpp; |
2697 } | 2697 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 } else { | 2736 } else { |
2737 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); | 2737 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); |
2738 dest_scan ++; | 2738 dest_scan ++; |
2739 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); | 2739 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); |
2740 dest_scan ++; | 2740 dest_scan ++; |
2741 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); | 2741 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); |
2742 } | 2742 } |
2743 dest_scan += Bpp - 2; | 2743 dest_scan += Bpp - 2; |
2744 } | 2744 } |
2745 } | 2745 } |
2746 void _CompositeRow_BitMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma
sk_alpha, int src_left, | 2746 void _CompositeRow_BitMask2Mask(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_left, |
2747 int pixel_count, FX_LPCBYTE clip_scan) | 2747 int pixel_count, const uint8_t* clip_scan) |
2748 { | 2748 { |
2749 for (int col = 0; col < pixel_count; col ++) { | 2749 for (int col = 0; col < pixel_count; col ++) { |
2750 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { | 2750 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { |
2751 dest_scan ++; | 2751 dest_scan ++; |
2752 continue; | 2752 continue; |
2753 } | 2753 } |
2754 int src_alpha; | 2754 int src_alpha; |
2755 if (clip_scan) { | 2755 if (clip_scan) { |
2756 src_alpha = mask_alpha * clip_scan[col] / 255; | 2756 src_alpha = mask_alpha * clip_scan[col] / 255; |
2757 } else { | 2757 } else { |
2758 src_alpha = mask_alpha; | 2758 src_alpha = mask_alpha; |
2759 } | 2759 } |
2760 uint8_t back_alpha = *dest_scan; | 2760 uint8_t back_alpha = *dest_scan; |
2761 if (!back_alpha) { | 2761 if (!back_alpha) { |
2762 *dest_scan = src_alpha; | 2762 *dest_scan = src_alpha; |
2763 } else if (src_alpha) { | 2763 } else if (src_alpha) { |
2764 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2764 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
2765 } | 2765 } |
2766 dest_scan ++; | 2766 dest_scan ++; |
2767 } | 2767 } |
2768 } | 2768 } |
2769 void _CompositeRow_BitMask2Gray(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma
sk_alpha, int src_gray, | 2769 void _CompositeRow_BitMask2Gray(uint8_t* dest_scan, const uint8_t* src_scan, int
mask_alpha, int src_gray, |
2770 int src_left, int pixel_count, FX_LPCBYTE clip_s
can) | 2770 int src_left, int pixel_count, const uint8_t* cl
ip_scan) |
2771 { | 2771 { |
2772 for (int col = 0; col < pixel_count; col ++) { | 2772 for (int col = 0; col < pixel_count; col ++) { |
2773 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { | 2773 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { |
2774 dest_scan ++; | 2774 dest_scan ++; |
2775 continue; | 2775 continue; |
2776 } | 2776 } |
2777 int src_alpha; | 2777 int src_alpha; |
2778 if (clip_scan) { | 2778 if (clip_scan) { |
2779 src_alpha = mask_alpha * clip_scan[col] / 255; | 2779 src_alpha = mask_alpha * clip_scan[col] / 255; |
2780 } else { | 2780 } else { |
2781 src_alpha = mask_alpha; | 2781 src_alpha = mask_alpha; |
2782 } | 2782 } |
2783 if (src_alpha) { | 2783 if (src_alpha) { |
2784 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); | 2784 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); |
2785 } | 2785 } |
2786 dest_scan ++; | 2786 dest_scan ++; |
2787 } | 2787 } |
2788 } | 2788 } |
2789 void _CompositeRow_BitMask2Graya(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m
ask_alpha, int src_gray, | 2789 void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, const uint8_t* src_scan, in
t mask_alpha, int src_gray, |
2790 int src_left, int pixel_count, FX_LPCBYTE clip_
scan, | 2790 int src_left, int pixel_count, const uint8_t* c
lip_scan, |
2791 FX_LPBYTE dest_alpha_scan) | 2791 uint8_t* dest_alpha_scan) |
2792 { | 2792 { |
2793 for (int col = 0; col < pixel_count; col ++) { | 2793 for (int col = 0; col < pixel_count; col ++) { |
2794 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { | 2794 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))
)) { |
2795 dest_scan ++; | 2795 dest_scan ++; |
2796 dest_alpha_scan ++; | 2796 dest_alpha_scan ++; |
2797 continue; | 2797 continue; |
2798 } | 2798 } |
2799 int src_alpha; | 2799 int src_alpha; |
2800 if (clip_scan) { | 2800 if (clip_scan) { |
2801 src_alpha = mask_alpha * clip_scan[col] / 255; | 2801 src_alpha = mask_alpha * clip_scan[col] / 255; |
(...skipping 11 matching lines...) Expand all Loading... |
2813 dest_alpha_scan ++; | 2813 dest_alpha_scan ++; |
2814 continue; | 2814 continue; |
2815 } | 2815 } |
2816 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 2816 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
2817 *dest_alpha_scan++ = dest_alpha; | 2817 *dest_alpha_scan++ = dest_alpha; |
2818 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2818 int alpha_ratio = src_alpha * 255 / dest_alpha; |
2819 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); | 2819 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); |
2820 dest_scan ++; | 2820 dest_scan ++; |
2821 } | 2821 } |
2822 } | 2822 } |
2823 void _CompositeRow_Argb2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc
an, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) | 2823 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* src
_scan, int pixel_count, int blend_type, const uint8_t* clip_scan) |
2824 { | 2824 { |
2825 int blended_colors[3]; | 2825 int blended_colors[3]; |
2826 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2826 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2827 for (int col = 0; col < pixel_count; col ++) { | 2827 for (int col = 0; col < pixel_count; col ++) { |
2828 uint8_t back_alpha = dest_scan[3]; | 2828 uint8_t back_alpha = dest_scan[3]; |
2829 if (back_alpha == 0) { | 2829 if (back_alpha == 0) { |
2830 if (clip_scan) { | 2830 if (clip_scan) { |
2831 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 2831 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
2832 dest_scan[3] = src_alpha; | 2832 dest_scan[3] = src_alpha; |
2833 dest_scan[0] = src_scan[2]; | 2833 dest_scan[0] = src_scan[2]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended,
alpha_ratio); | 2870 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended,
alpha_ratio); |
2871 } else { | 2871 } else { |
2872 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan
, alpha_ratio); | 2872 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan
, alpha_ratio); |
2873 } | 2873 } |
2874 src_scan ++; | 2874 src_scan ++; |
2875 } | 2875 } |
2876 dest_scan += 4; | 2876 dest_scan += 4; |
2877 src_scan++; | 2877 src_scan++; |
2878 } | 2878 } |
2879 } | 2879 } |
2880 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP
CBYTE src_scan, int width, int blend_type, int src_Bpp) | 2880 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int src_Bpp) |
2881 { | 2881 { |
2882 int blended_colors[3]; | 2882 int blended_colors[3]; |
2883 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2883 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2884 int src_gap = src_Bpp - 3; | 2884 int src_gap = src_Bpp - 3; |
2885 for (int col = 0; col < width; col ++) { | 2885 for (int col = 0; col < width; col ++) { |
2886 uint8_t back_alpha = dest_scan[3]; | 2886 uint8_t back_alpha = dest_scan[3]; |
2887 if (back_alpha == 0) { | 2887 if (back_alpha == 0) { |
2888 if (src_Bpp == 4) { | 2888 if (src_Bpp == 4) { |
2889 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_
scan)); | 2889 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_
scan)); |
2890 } else { | 2890 } else { |
(...skipping 16 matching lines...) Expand all Loading... |
2907 int src_color = FX_GAMMA(*src_scan); | 2907 int src_color = FX_GAMMA(*src_scan); |
2908 int blended = bNonseparableBlend ? blended_colors[color] : | 2908 int blended = bNonseparableBlend ? blended_colors[color] : |
2909 _BLEND(blend_type, dest_scan[index], src_color); | 2909 _BLEND(blend_type, dest_scan[index], src_color); |
2910 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha)
; | 2910 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha)
; |
2911 src_scan ++; | 2911 src_scan ++; |
2912 } | 2912 } |
2913 dest_scan += 4; | 2913 dest_scan += 4; |
2914 src_scan += src_gap; | 2914 src_scan += src_gap; |
2915 } | 2915 } |
2916 } | 2916 } |
2917 inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(FX_LPBYTE dest_scan, FX_LP
CBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan) | 2917 inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, const
uint8_t* src_scan, int width, int blend_type, int dest_Bpp, const uint8_t* clip_
scan) |
2918 { | 2918 { |
2919 int blended_colors[3]; | 2919 int blended_colors[3]; |
2920 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2920 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2921 for (int col = 0; col < width; col ++) { | 2921 for (int col = 0; col < width; col ++) { |
2922 uint8_t src_alpha; | 2922 uint8_t src_alpha; |
2923 if (clip_scan) { | 2923 if (clip_scan) { |
2924 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 2924 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
2925 } else { | 2925 } else { |
2926 src_alpha = src_scan[3]; | 2926 src_alpha = src_scan[3]; |
2927 } | 2927 } |
(...skipping 14 matching lines...) Expand all Loading... |
2942 int back_color = FX_GAMMA(dest_scan[index]); | 2942 int back_color = FX_GAMMA(dest_scan[index]); |
2943 int blended = bNonseparableBlend ? blended_colors[color] : | 2943 int blended = bNonseparableBlend ? blended_colors[color] : |
2944 _BLEND(blend_type, back_color, *src_scan); | 2944 _BLEND(blend_type, back_color, *src_scan); |
2945 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, bl
ended, src_alpha)); | 2945 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, bl
ended, src_alpha)); |
2946 src_scan ++; | 2946 src_scan ++; |
2947 } | 2947 } |
2948 dest_scan += dest_Bpp; | 2948 dest_scan += dest_Bpp; |
2949 src_scan ++; | 2949 src_scan ++; |
2950 } | 2950 } |
2951 } | 2951 } |
2952 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sc
an, FX_LPCBYTE src_scan, int width, int src_Bpp) | 2952 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_sca
n, const uint8_t* src_scan, int width, int src_Bpp) |
2953 { | 2953 { |
2954 for (int col = 0; col < width; col ++) { | 2954 for (int col = 0; col < width; col ++) { |
2955 if (src_Bpp == 4) { | 2955 if (src_Bpp == 4) { |
2956 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); | 2956 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan
)); |
2957 } else { | 2957 } else { |
2958 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); | 2958 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_
scan[1], src_scan[0])); |
2959 } | 2959 } |
2960 dest_scan += 4; | 2960 dest_scan += 4; |
2961 src_scan += src_Bpp; | 2961 src_scan += src_Bpp; |
2962 } | 2962 } |
2963 } | 2963 } |
2964 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) | 2964 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp) |
2965 { | 2965 { |
2966 int blended_colors[3]; | 2966 int blended_colors[3]; |
2967 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2967 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
2968 int src_gap = src_Bpp - 3; | 2968 int src_gap = src_Bpp - 3; |
2969 for (int col = 0; col < width; col ++) { | 2969 for (int col = 0; col < width; col ++) { |
2970 if (bNonseparableBlend) { | 2970 if (bNonseparableBlend) { |
2971 uint8_t dest_scan_o[3]; | 2971 uint8_t dest_scan_o[3]; |
2972 dest_scan_o[0] = dest_scan[2]; | 2972 dest_scan_o[0] = dest_scan[2]; |
2973 dest_scan_o[1] = dest_scan[1]; | 2973 dest_scan_o[1] = dest_scan[1]; |
2974 dest_scan_o[2] = dest_scan[0]; | 2974 dest_scan_o[2] = dest_scan[0]; |
2975 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 2975 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
2976 } | 2976 } |
2977 for (int color = 0; color < 3; color ++) { | 2977 for (int color = 0; color < 3; color ++) { |
2978 int index = 2 - color; | 2978 int index = 2 - color; |
2979 int back_color = FX_GAMMA(dest_scan[index]); | 2979 int back_color = FX_GAMMA(dest_scan[index]); |
2980 int src_color = FX_GAMMA(*src_scan); | 2980 int src_color = FX_GAMMA(*src_scan); |
2981 int blended = bNonseparableBlend ? blended_colors[color] : | 2981 int blended = bNonseparableBlend ? blended_colors[color] : |
2982 _BLEND(blend_type, back_color, src_color); | 2982 _BLEND(blend_type, back_color, src_color); |
2983 dest_scan[index] = FX_GAMMA_INVERSE(blended); | 2983 dest_scan[index] = FX_GAMMA_INVERSE(blended); |
2984 src_scan ++; | 2984 src_scan ++; |
2985 } | 2985 } |
2986 dest_scan += dest_Bpp; | 2986 dest_scan += dest_Bpp; |
2987 src_scan += src_gap; | 2987 src_scan += src_gap; |
2988 } | 2988 } |
2989 } | 2989 } |
2990 inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan, FX_
LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan) | 2990 inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, cons
t uint8_t* src_scan, int width, int dest_Bpp, const uint8_t* clip_scan) |
2991 { | 2991 { |
2992 for (int col = 0; col < width; col ++) { | 2992 for (int col = 0; col < width; col ++) { |
2993 uint8_t src_alpha; | 2993 uint8_t src_alpha; |
2994 if (clip_scan) { | 2994 if (clip_scan) { |
2995 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 2995 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
2996 } else { | 2996 } else { |
2997 src_alpha = src_scan[3]; | 2997 src_alpha = src_scan[3]; |
2998 } | 2998 } |
2999 if (src_alpha == 255) { | 2999 if (src_alpha == 255) { |
3000 dest_scan[2] = FX_GAMMA_INVERSE(*src_scan++); | 3000 dest_scan[2] = FX_GAMMA_INVERSE(*src_scan++); |
(...skipping 10 matching lines...) Expand all Loading... |
3011 } | 3011 } |
3012 for (int color = 0; color < 3; color ++) { | 3012 for (int color = 0; color < 3; color ++) { |
3013 int index = 2 - color; | 3013 int index = 2 - color; |
3014 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_
scan[index]), *src_scan, src_alpha)); | 3014 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_
scan[index]), *src_scan, src_alpha)); |
3015 src_scan ++; | 3015 src_scan ++; |
3016 } | 3016 } |
3017 dest_scan += dest_Bpp; | 3017 dest_scan += dest_Bpp; |
3018 src_scan ++; | 3018 src_scan ++; |
3019 } | 3019 } |
3020 } | 3020 } |
3021 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(FX_LPBYTE dest_sca
n, FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp) | 3021 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan
, const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp) |
3022 { | 3022 { |
3023 for (int col = 0; col < width; col ++) { | 3023 for (int col = 0; col < width; col ++) { |
3024 dest_scan[2] = src_scan[0]; | 3024 dest_scan[2] = src_scan[0]; |
3025 dest_scan[1] = src_scan[1]; | 3025 dest_scan[1] = src_scan[1]; |
3026 dest_scan[0] = src_scan[2]; | 3026 dest_scan[0] = src_scan[2]; |
3027 dest_scan += dest_Bpp; | 3027 dest_scan += dest_Bpp; |
3028 src_scan += src_Bpp; | 3028 src_scan += src_Bpp; |
3029 } | 3029 } |
3030 } | 3030 } |
3031 inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_sca
n) | 3031 inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, c
onst uint8_t* src_scan, int width, int blend_type, int src_Bpp, const uint8_t* c
lip_scan) |
3032 { | 3032 { |
3033 int blended_colors[3]; | 3033 int blended_colors[3]; |
3034 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3034 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
3035 int src_gap = src_Bpp - 3; | 3035 int src_gap = src_Bpp - 3; |
3036 for (int col = 0; col < width; col ++) { | 3036 for (int col = 0; col < width; col ++) { |
3037 int src_alpha = *clip_scan ++; | 3037 int src_alpha = *clip_scan ++; |
3038 uint8_t back_alpha = dest_scan[3]; | 3038 uint8_t back_alpha = dest_scan[3]; |
3039 if (back_alpha == 0) { | 3039 if (back_alpha == 0) { |
3040 dest_scan[2] = FX_GAMMA(*src_scan++); | 3040 dest_scan[2] = FX_GAMMA(*src_scan++); |
3041 dest_scan[1] = FX_GAMMA(*src_scan++); | 3041 dest_scan[1] = FX_GAMMA(*src_scan++); |
(...skipping 23 matching lines...) Expand all Loading... |
3065 int blended = bNonseparableBlend ? blended_colors[color] : | 3065 int blended = bNonseparableBlend ? blended_colors[color] : |
3066 _BLEND(blend_type, dest_scan[index], src_color); | 3066 _BLEND(blend_type, dest_scan[index], src_color); |
3067 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 3067 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
3068 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph
a_ratio); | 3068 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], blended, alph
a_ratio); |
3069 src_scan ++; | 3069 src_scan ++; |
3070 } | 3070 } |
3071 dest_scan += 4; | 3071 dest_scan += 4; |
3072 src_scan += src_gap; | 3072 src_scan += src_gap; |
3073 } | 3073 } |
3074 } | 3074 } |
3075 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(FX_LPBYTE dest_scan, F
X_LPCBYTE src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPC
BYTE clip_scan) | 3075 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, co
nst uint8_t* src_scan, int width, int blend_type, int dest_Bpp, int src_Bpp, con
st uint8_t* clip_scan) |
3076 { | 3076 { |
3077 int blended_colors[3]; | 3077 int blended_colors[3]; |
3078 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3078 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
3079 int src_gap = src_Bpp - 3; | 3079 int src_gap = src_Bpp - 3; |
3080 for (int col = 0; col < width; col ++) { | 3080 for (int col = 0; col < width; col ++) { |
3081 uint8_t src_alpha = *clip_scan ++; | 3081 uint8_t src_alpha = *clip_scan ++; |
3082 if (src_alpha == 0) { | 3082 if (src_alpha == 0) { |
3083 dest_scan += dest_Bpp; | 3083 dest_scan += dest_Bpp; |
3084 src_scan += src_Bpp; | 3084 src_scan += src_Bpp; |
3085 continue; | 3085 continue; |
(...skipping 11 matching lines...) Expand all Loading... |
3097 int back_color = FX_GAMMA(dest_scan[index]); | 3097 int back_color = FX_GAMMA(dest_scan[index]); |
3098 int blended = bNonseparableBlend ? blended_colors[color] : | 3098 int blended = bNonseparableBlend ? blended_colors[color] : |
3099 _BLEND(blend_type, back_color, src_color); | 3099 _BLEND(blend_type, back_color, src_color); |
3100 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, bl
ended, src_alpha)); | 3100 dest_scan[index] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, bl
ended, src_alpha)); |
3101 src_scan ++; | 3101 src_scan ++; |
3102 } | 3102 } |
3103 dest_scan += dest_Bpp; | 3103 dest_scan += dest_Bpp; |
3104 src_scan += src_gap; | 3104 src_scan += src_gap; |
3105 } | 3105 } |
3106 } | 3106 } |
3107 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan
, FX_LPCBYTE src_scan, int width, int src_Bpp, FX_LPCBYTE clip_scan) | 3107 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int src_Bpp, const uint8_t* clip_scan) |
3108 { | 3108 { |
3109 int src_gap = src_Bpp - 3; | 3109 int src_gap = src_Bpp - 3; |
3110 for (int col = 0; col < width; col ++) { | 3110 for (int col = 0; col < width; col ++) { |
3111 int src_alpha = clip_scan[col]; | 3111 int src_alpha = clip_scan[col]; |
3112 if (src_alpha == 255) { | 3112 if (src_alpha == 255) { |
3113 dest_scan[2] = FX_GAMMA(*src_scan++); | 3113 dest_scan[2] = FX_GAMMA(*src_scan++); |
3114 dest_scan[1] = FX_GAMMA(*src_scan++); | 3114 dest_scan[1] = FX_GAMMA(*src_scan++); |
3115 dest_scan[0] = FX_GAMMA(*src_scan++); | 3115 dest_scan[0] = FX_GAMMA(*src_scan++); |
3116 dest_scan[3] = 255; | 3116 dest_scan[3] = 255; |
3117 dest_scan += 4; | 3117 dest_scan += 4; |
(...skipping 11 matching lines...) Expand all Loading... |
3129 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3129 int alpha_ratio = src_alpha * 255 / dest_alpha; |
3130 for (int color = 0; color < 3; color ++) { | 3130 for (int color = 0; color < 3; color ++) { |
3131 int index = 2 - color; | 3131 int index = 2 - color; |
3132 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], FX_GAMMA(*src
_scan), alpha_ratio); | 3132 dest_scan[index] = FXDIB_ALPHA_MERGE(dest_scan[index], FX_GAMMA(*src
_scan), alpha_ratio); |
3133 src_scan ++; | 3133 src_scan ++; |
3134 } | 3134 } |
3135 dest_scan += 4; | 3135 dest_scan += 4; |
3136 src_scan += src_gap; | 3136 src_scan += src_gap; |
3137 } | 3137 } |
3138 } | 3138 } |
3139 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_scan
) | 3139 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, int dest_Bpp, int src_Bpp, const uint8_t* cl
ip_scan) |
3140 { | 3140 { |
3141 for (int col = 0; col < width; col ++) { | 3141 for (int col = 0; col < width; col ++) { |
3142 int src_alpha = clip_scan[col]; | 3142 int src_alpha = clip_scan[col]; |
3143 if (src_alpha == 255) { | 3143 if (src_alpha == 255) { |
3144 dest_scan[2] = src_scan[0]; | 3144 dest_scan[2] = src_scan[0]; |
3145 dest_scan[1] = src_scan[1]; | 3145 dest_scan[1] = src_scan[1]; |
3146 dest_scan[0] = src_scan[2]; | 3146 dest_scan[0] = src_scan[2]; |
3147 } else if (src_alpha) { | 3147 } else if (src_alpha) { |
3148 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[2]), FX_GAMMA(*src_scan), src_alpha)); | 3148 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[2]), FX_GAMMA(*src_scan), src_alpha)); |
3149 src_scan ++; | 3149 src_scan ++; |
3150 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[1]), FX_GAMMA(*src_scan), src_alpha)); | 3150 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[1]), FX_GAMMA(*src_scan), src_alpha)); |
3151 src_scan ++; | 3151 src_scan ++; |
3152 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[0]), FX_GAMMA(*src_scan), src_alpha)); | 3152 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan
[0]), FX_GAMMA(*src_scan), src_alpha)); |
3153 dest_scan += dest_Bpp; | 3153 dest_scan += dest_Bpp; |
3154 src_scan += src_Bpp - 2; | 3154 src_scan += src_Bpp - 2; |
3155 continue; | 3155 continue; |
3156 } | 3156 } |
3157 dest_scan += dest_Bpp; | 3157 dest_scan += dest_Bpp; |
3158 src_scan += src_Bpp; | 3158 src_scan += src_Bpp; |
3159 } | 3159 } |
3160 } | 3160 } |
3161 inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, FX_ARGB* pPalette, int pixel_count, | 3161 inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, c
onst uint8_t* src_scan, FX_ARGB* pPalette, int pixel_count, |
3162 int DestBpp, FX_LPCBYTE clip_scan) | 3162 int DestBpp, const uint8_t* clip_scan) |
3163 { | 3163 { |
3164 for (int col = 0; col < pixel_count; col ++) { | 3164 for (int col = 0; col < pixel_count; col ++) { |
3165 FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; | 3165 FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; |
3166 int src_r = FXARGB_R(argb); | 3166 int src_r = FXARGB_R(argb); |
3167 int src_g = FXARGB_G(argb); | 3167 int src_g = FXARGB_G(argb); |
3168 int src_b = FXARGB_B(argb); | 3168 int src_b = FXARGB_B(argb); |
3169 if (clip_scan && clip_scan[col] < 255) { | 3169 if (clip_scan && clip_scan[col] < 255) { |
3170 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]
); | 3170 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]
); |
3171 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]
); | 3171 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]
); |
3172 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]
); | 3172 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]
); |
3173 } else { | 3173 } else { |
3174 dest_scan[2] = src_b; | 3174 dest_scan[2] = src_b; |
3175 dest_scan[1] = src_g; | 3175 dest_scan[1] = src_g; |
3176 dest_scan[0] = src_r; | 3176 dest_scan[0] = src_r; |
3177 } | 3177 } |
3178 dest_scan += DestBpp; | 3178 dest_scan += DestBpp; |
3179 src_scan ++; | 3179 src_scan ++; |
3180 } | 3180 } |
3181 } | 3181 } |
3182 inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int src_left, | 3182 inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, c
onst uint8_t* src_scan, int src_left, |
3183 FX_ARGB* pPalette, int pixel_count, int DestBpp, FX_LPCBYTE clip_scan) | 3183 FX_ARGB* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_sca
n) |
3184 { | 3184 { |
3185 int reset_r, reset_g, reset_b; | 3185 int reset_r, reset_g, reset_b; |
3186 int set_r, set_g, set_b; | 3186 int set_r, set_g, set_b; |
3187 if (pPalette) { | 3187 if (pPalette) { |
3188 reset_r = FXARGB_R(pPalette[0]); | 3188 reset_r = FXARGB_R(pPalette[0]); |
3189 reset_g = FXARGB_G(pPalette[0]); | 3189 reset_g = FXARGB_G(pPalette[0]); |
3190 reset_b = FXARGB_B(pPalette[0]); | 3190 reset_b = FXARGB_B(pPalette[0]); |
3191 set_r = FXARGB_R(pPalette[1]); | 3191 set_r = FXARGB_R(pPalette[1]); |
3192 set_g = FXARGB_G(pPalette[1]); | 3192 set_g = FXARGB_G(pPalette[1]); |
3193 set_b = FXARGB_B(pPalette[1]); | 3193 set_b = FXARGB_B(pPalette[1]); |
(...skipping 17 matching lines...) Expand all Loading... |
3211 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]
); | 3211 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]
); |
3212 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]
); | 3212 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]
); |
3213 } else { | 3213 } else { |
3214 dest_scan[2] = src_b; | 3214 dest_scan[2] = src_b; |
3215 dest_scan[1] = src_g; | 3215 dest_scan[1] = src_g; |
3216 dest_scan[0] = src_r; | 3216 dest_scan[0] = src_r; |
3217 } | 3217 } |
3218 dest_scan += DestBpp; | 3218 dest_scan += DestBpp; |
3219 } | 3219 } |
3220 } | 3220 } |
3221 inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int width, | 3221 inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int width, |
3222 FX_ARGB* pPalette, FX_LPCBYTE clip_scan) | 3222 FX_ARGB* pPalette, const uint8_t* clip_scan) |
3223 { | 3223 { |
3224 for (int col = 0; col < width; col ++) { | 3224 for (int col = 0; col < width; col ++) { |
3225 int src_r, src_g, src_b; | 3225 int src_r, src_g, src_b; |
3226 if (pPalette) { | 3226 if (pPalette) { |
3227 FX_ARGB argb = pPalette[*src_scan]; | 3227 FX_ARGB argb = pPalette[*src_scan]; |
3228 src_r = FXARGB_R(argb); | 3228 src_r = FXARGB_R(argb); |
3229 src_g = FXARGB_G(argb); | 3229 src_g = FXARGB_G(argb); |
3230 src_b = FXARGB_B(argb); | 3230 src_b = FXARGB_B(argb); |
3231 } else { | 3231 } else { |
3232 src_r = src_g = src_b = *src_scan; | 3232 src_r = src_g = src_b = *src_scan; |
(...skipping 17 matching lines...) Expand all Loading... |
3250 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 3250 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
3251 dest_scan[3] = dest_alpha; | 3251 dest_scan[3] = dest_alpha; |
3252 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3252 int alpha_ratio = src_alpha * 255 / dest_alpha; |
3253 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ra
tio); | 3253 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ra
tio); |
3254 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ra
tio); | 3254 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ra
tio); |
3255 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ra
tio); | 3255 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ra
tio); |
3256 dest_scan += 4; | 3256 dest_scan += 4; |
3257 src_scan ++; | 3257 src_scan ++; |
3258 } | 3258 } |
3259 } | 3259 } |
3260 inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(FX_LPBYTE dest_scan,
FX_LPCBYTE src_scan, int src_left, int width, | 3260 inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan,
const uint8_t* src_scan, int src_left, int width, |
3261 FX_ARGB* pPalette, FX_LPCBYTE clip_scan) | 3261 FX_ARGB* pPalette, const uint8_t* clip_scan) |
3262 { | 3262 { |
3263 int reset_r, reset_g, reset_b; | 3263 int reset_r, reset_g, reset_b; |
3264 int set_r, set_g, set_b; | 3264 int set_r, set_g, set_b; |
3265 if (pPalette) { | 3265 if (pPalette) { |
3266 reset_r = FXARGB_R(pPalette[0]); | 3266 reset_r = FXARGB_R(pPalette[0]); |
3267 reset_g = FXARGB_G(pPalette[0]); | 3267 reset_g = FXARGB_G(pPalette[0]); |
3268 reset_b = FXARGB_B(pPalette[0]); | 3268 reset_b = FXARGB_B(pPalette[0]); |
3269 set_r = FXARGB_R(pPalette[1]); | 3269 set_r = FXARGB_R(pPalette[1]); |
3270 set_g = FXARGB_G(pPalette[1]); | 3270 set_g = FXARGB_G(pPalette[1]); |
3271 set_b = FXARGB_B(pPalette[1]); | 3271 set_b = FXARGB_B(pPalette[1]); |
(...skipping 28 matching lines...) Expand all Loading... |
3300 int back_alpha = dest_scan[3]; | 3300 int back_alpha = dest_scan[3]; |
3301 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; | 3301 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2
55; |
3302 dest_scan[3] = dest_alpha; | 3302 dest_scan[3] = dest_alpha; |
3303 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3303 int alpha_ratio = src_alpha * 255 / dest_alpha; |
3304 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ra
tio); | 3304 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ra
tio); |
3305 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ra
tio); | 3305 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ra
tio); |
3306 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ra
tio); | 3306 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ra
tio); |
3307 dest_scan += 4; | 3307 dest_scan += 4; |
3308 } | 3308 } |
3309 } | 3309 } |
3310 void _CompositeRow_ByteMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE sr
c_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, | 3310 void _CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t*
src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, |
3311 int blend_type, FX_LPCBYTE clip_scan) | 3311 int blend_type, const uint8_t* clip_scan) |
3312 { | 3312 { |
3313 for (int col = 0; col < pixel_count; col ++) { | 3313 for (int col = 0; col < pixel_count; col ++) { |
3314 int src_alpha; | 3314 int src_alpha; |
3315 if (clip_scan) { | 3315 if (clip_scan) { |
3316 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 3316 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
3317 } else { | 3317 } else { |
3318 src_alpha = mask_alpha * src_scan[col] / 255; | 3318 src_alpha = mask_alpha * src_scan[col] / 255; |
3319 } | 3319 } |
3320 uint8_t back_alpha = dest_scan[3]; | 3320 uint8_t back_alpha = dest_scan[3]; |
3321 if (back_alpha == 0) { | 3321 if (back_alpha == 0) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 3355 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
3356 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio)
; | 3356 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio)
; |
3357 } else { | 3357 } else { |
3358 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); | 3358 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
3359 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); | 3359 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
3360 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); | 3360 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
3361 } | 3361 } |
3362 dest_scan += 4; | 3362 dest_scan += 4; |
3363 } | 3363 } |
3364 } | 3364 } |
3365 void _CompositeRow_ByteMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src
_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, | 3365 void _CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t*
src_scan, int mask_alpha, int src_r, int src_g, int src_b, int pixel_count, |
3366 int blend_type, int Bpp, FX_LPCBYTE clip_scan) | 3366 int blend_type, int Bpp, const uint8_t* clip_scan) |
3367 { | 3367 { |
3368 for (int col = 0; col < pixel_count; col ++) { | 3368 for (int col = 0; col < pixel_count; col ++) { |
3369 int src_alpha; | 3369 int src_alpha; |
3370 if (clip_scan) { | 3370 if (clip_scan) { |
3371 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 3371 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
3372 } else { | 3372 } else { |
3373 src_alpha = mask_alpha * src_scan[col] / 255; | 3373 src_alpha = mask_alpha * src_scan[col] / 255; |
3374 } | 3374 } |
3375 if (src_alpha == 0) { | 3375 if (src_alpha == 0) { |
3376 dest_scan += Bpp; | 3376 dest_scan += Bpp; |
(...skipping 21 matching lines...) Expand all Loading... |
3398 blended = _BLEND(blend_type, dest_scan[0], src_r); | 3398 blended = _BLEND(blend_type, dest_scan[0], src_r); |
3399 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha); | 3399 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha); |
3400 } else { | 3400 } else { |
3401 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); | 3401 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); |
3402 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); | 3402 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); |
3403 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); | 3403 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); |
3404 } | 3404 } |
3405 dest_scan += Bpp; | 3405 dest_scan += Bpp; |
3406 } | 3406 } |
3407 } | 3407 } |
3408 void _CompositeRow_BitMask2Argb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src
_scan, int mask_alpha, int src_r, int src_g, int src_b, | 3408 void _CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, const uint8_t*
src_scan, int mask_alpha, int src_r, int src_g, int src_b, |
3409 int src_left, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) | 3409 int src_left, int pixel_count, int blend_type, const uint8_t* clip_scan) |
3410 { | 3410 { |
3411 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { | 3411 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { |
3412 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); | 3412 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); |
3413 for (int col = 0; col < pixel_count; col ++) { | 3413 for (int col = 0; col < pixel_count; col ++) { |
3414 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { | 3414 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { |
3415 FXARGB_SETRGBORDERDIB(dest_scan, argb); | 3415 FXARGB_SETRGBORDERDIB(dest_scan, argb); |
3416 } | 3416 } |
3417 dest_scan += 4; | 3417 dest_scan += 4; |
3418 } | 3418 } |
3419 return; | 3419 return; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 3463 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
3464 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio)
; | 3464 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio)
; |
3465 } else { | 3465 } else { |
3466 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); | 3466 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
3467 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); | 3467 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
3468 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); | 3468 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
3469 } | 3469 } |
3470 dest_scan += 4; | 3470 dest_scan += 4; |
3471 } | 3471 } |
3472 } | 3472 } |
3473 void _CompositeRow_BitMask2Rgb_RgbByteOrder(FX_LPBYTE dest_scan, FX_LPCBYTE src_
scan, int mask_alpha, int src_r, int src_g, int src_b, | 3473 void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, const uint8_t* s
rc_scan, int mask_alpha, int src_r, int src_g, int src_b, |
3474 int src_left, int pixel_count, int blend_type, int Bpp, FX_LPCBYTE clip_
scan) | 3474 int src_left, int pixel_count, int blend_type, int Bpp, const uint8_t* c
lip_scan) |
3475 { | 3475 { |
3476 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { | 3476 if (blend_type == FXDIB_BLEND_NORMAL && clip_scan == NULL && mask_alpha == 2
55) { |
3477 for (int col = 0; col < pixel_count; col ++) { | 3477 for (int col = 0; col < pixel_count; col ++) { |
3478 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { | 3478 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8
))) { |
3479 dest_scan[2] = src_b; | 3479 dest_scan[2] = src_b; |
3480 dest_scan[1] = src_g; | 3480 dest_scan[1] = src_g; |
3481 dest_scan[0] = src_r; | 3481 dest_scan[0] = src_r; |
3482 } | 3482 } |
3483 dest_scan += Bpp; | 3483 dest_scan += Bpp; |
3484 } | 3484 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 mask_red = FXARGB_R(mask_color); | 3547 mask_red = FXARGB_R(mask_color); |
3548 mask_green = FXARGB_G(mask_color); | 3548 mask_green = FXARGB_G(mask_color); |
3549 mask_blue = FXARGB_B(mask_color); | 3549 mask_blue = FXARGB_B(mask_color); |
3550 } | 3550 } |
3551 if (dest_format == FXDIB_8bppMask) { | 3551 if (dest_format == FXDIB_8bppMask) { |
3552 return TRUE; | 3552 return TRUE; |
3553 } | 3553 } |
3554 if ((dest_format & 0xff) == 8) { | 3554 if ((dest_format & 0xff) == 8) { |
3555 if (pIccTransform) { | 3555 if (pIccTransform) { |
3556 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T
ODIB(mask_color); | 3556 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_T
ODIB(mask_color); |
3557 FX_LPBYTE gray_p = (FX_LPBYTE)&mask_color; | 3557 uint8_t* gray_p = (uint8_t*)&mask_color; |
3558 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); | 3558 pIccModule->TranslateScanline(pIccTransform, gray_p, gray_p, 1); |
3559 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; | 3559 mask_red = dest_format & 0x0400 ? FX_CCOLOR(gray_p[0]) : gray_p[0]; |
3560 } else { | 3560 } else { |
3561 if (alpha_flag >> 8) { | 3561 if (alpha_flag >> 8) { |
3562 uint8_t r, g, b; | 3562 uint8_t r, g, b; |
3563 AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, | 3563 AdobeCMYK_to_sRGB1(mask_red, mask_green, mask_blue, mask_black, |
3564 r, g, b); | 3564 r, g, b); |
3565 mask_red = FXRGB2GRAY(r, g, b); | 3565 mask_red = FXRGB2GRAY(r, g, b); |
3566 } else { | 3566 } else { |
3567 mask_red = FXRGB2GRAY(mask_red, mask_green, mask_blue); | 3567 mask_red = FXRGB2GRAY(mask_red, mask_green, mask_blue); |
3568 } | 3568 } |
3569 if (dest_format & 0x0400) { | 3569 if (dest_format & 0x0400) { |
3570 mask_red = FX_CCOLOR(mask_red); | 3570 mask_red = FX_CCOLOR(mask_red); |
3571 } | 3571 } |
3572 } | 3572 } |
3573 } else { | 3573 } else { |
3574 FX_LPBYTE mask_color_p = (FX_LPBYTE)&mask_color; | 3574 uint8_t* mask_color_p = (uint8_t*)&mask_color; |
3575 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB
(mask_color); | 3575 mask_color = (alpha_flag >> 8) ? FXCMYK_TODIB(mask_color) : FXARGB_TODIB
(mask_color); |
3576 if (pIccTransform) { | 3576 if (pIccTransform) { |
3577 pIccModule->TranslateScanline(pIccTransform, mask_color_p, mask_colo
r_p, 1); | 3577 pIccModule->TranslateScanline(pIccTransform, mask_color_p, mask_colo
r_p, 1); |
3578 mask_red = mask_color_p[2]; | 3578 mask_red = mask_color_p[2]; |
3579 mask_green = mask_color_p[1]; | 3579 mask_green = mask_color_p[1]; |
3580 mask_blue = mask_color_p[0]; | 3580 mask_blue = mask_color_p[0]; |
3581 } else if (alpha_flag >> 8) { | 3581 } else if (alpha_flag >> 8) { |
3582 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2]
, mask_color_p[3], | 3582 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2]
, mask_color_p[3], |
3583 mask_color_p[2], mask_color_p[1], mask_color_p[0]
); | 3583 mask_color_p[2], mask_color_p[1], mask_color_p[0]
); |
3584 mask_red = mask_color_p[2]; | 3584 mask_red = mask_color_p[2]; |
3585 mask_green = mask_color_p[1]; | 3585 mask_green = mask_color_p[1]; |
3586 mask_blue = mask_color_p[0]; | 3586 mask_blue = mask_color_p[0]; |
3587 } | 3587 } |
3588 } | 3588 } |
3589 return TRUE; | 3589 return TRUE; |
3590 } | 3590 } |
3591 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
_Format dest_format, | 3591 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB
_Format dest_format, |
3592 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, | 3592 FX_DWORD*& pDestPalette, FX_DWORD* pSrcPalette, |
3593 void* icc_module, void* pIccTransform) | 3593 void* icc_module, void* pIccTransform) |
3594 { | 3594 { |
3595 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; | 3595 ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; |
3596 FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; | 3596 FX_BOOL isSrcCmyk = src_format & 0x0400 ? TRUE : FALSE; |
3597 FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; | 3597 FX_BOOL isDstCmyk = dest_format & 0x0400 ? TRUE : FALSE; |
3598 pDestPalette = NULL; | 3598 pDestPalette = NULL; |
3599 if (pIccTransform) { | 3599 if (pIccTransform) { |
3600 if (pSrcPalette) { | 3600 if (pSrcPalette) { |
3601 if ((dest_format & 0xff) == 8) { | 3601 if ((dest_format & 0xff) == 8) { |
3602 int pal_count = 1 << (src_format & 0xff); | 3602 int pal_count = 1 << (src_format & 0xff); |
3603 FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); | 3603 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
3604 pDestPalette = (FX_DWORD*)gray_pal; | 3604 pDestPalette = (FX_DWORD*)gray_pal; |
3605 for (int i = 0; i < pal_count; i ++) { | 3605 for (int i = 0; i < pal_count; i ++) { |
3606 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); | 3606 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); |
3607 pIccModule->TranslateScanline(pIccTransform, gray_pal, (FX_L
PCBYTE)&color, 1); | 3607 pIccModule->TranslateScanline(pIccTransform, gray_pal, (cons
t uint8_t*)&color, 1); |
3608 gray_pal ++; | 3608 gray_pal ++; |
3609 } | 3609 } |
3610 } else { | 3610 } else { |
3611 int palsize = 1 << (src_format & 0xff); | 3611 int palsize = 1 << (src_format & 0xff); |
3612 pDestPalette = FX_Alloc(FX_DWORD, palsize); | 3612 pDestPalette = FX_Alloc(FX_DWORD, palsize); |
3613 for (int i = 0; i < palsize; i ++) { | 3613 for (int i = 0; i < palsize; i ++) { |
3614 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); | 3614 FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) :
FXARGB_TODIB(pSrcPalette[i]); |
3615 pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&col
or, (FX_LPCBYTE)&color, 1); | 3615 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&colo
r, (const uint8_t*)&color, 1); |
3616 pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(color) : FXARGB_T
ODIB(color); | 3616 pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(color) : FXARGB_T
ODIB(color); |
3617 } | 3617 } |
3618 } | 3618 } |
3619 } else { | 3619 } else { |
3620 int pal_count = 1 << (src_format & 0xff); | 3620 int pal_count = 1 << (src_format & 0xff); |
3621 FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); | 3621 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
3622 if (pal_count == 2) { | 3622 if (pal_count == 2) { |
3623 gray_pal[0] = 0; | 3623 gray_pal[0] = 0; |
3624 gray_pal[1] = 255; | 3624 gray_pal[1] = 255; |
3625 } else { | 3625 } else { |
3626 for (int i = 0; i < pal_count; i++) { | 3626 for (int i = 0; i < pal_count; i++) { |
3627 gray_pal[i] = i; | 3627 gray_pal[i] = i; |
3628 } | 3628 } |
3629 } | 3629 } |
3630 if ((dest_format & 0xff) == 8) { | 3630 if ((dest_format & 0xff) == 8) { |
3631 pIccModule->TranslateScanline(pIccTransform, gray_pal, gray_pal,
pal_count); | 3631 pIccModule->TranslateScanline(pIccTransform, gray_pal, gray_pal,
pal_count); |
3632 pDestPalette = (FX_DWORD*)gray_pal; | 3632 pDestPalette = (FX_DWORD*)gray_pal; |
3633 } else { | 3633 } else { |
3634 pDestPalette = FX_Alloc(FX_DWORD, pal_count); | 3634 pDestPalette = FX_Alloc(FX_DWORD, pal_count); |
3635 for (int i = 0; i < pal_count; i ++) { | 3635 for (int i = 0; i < pal_count; i ++) { |
3636 pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&pDe
stPalette[i], &gray_pal[i], 1); | 3636 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&pDes
tPalette[i], &gray_pal[i], 1); |
3637 pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i])
: FXARGB_TODIB(pDestPalette[i]); | 3637 pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i])
: FXARGB_TODIB(pDestPalette[i]); |
3638 } | 3638 } |
3639 FX_Free(gray_pal); | 3639 FX_Free(gray_pal); |
3640 } | 3640 } |
3641 } | 3641 } |
3642 } else { | 3642 } else { |
3643 if (pSrcPalette) { | 3643 if (pSrcPalette) { |
3644 if ((dest_format & 0xff) == 8) { | 3644 if ((dest_format & 0xff) == 8) { |
3645 int pal_count = 1 << (src_format & 0xff); | 3645 int pal_count = 1 << (src_format & 0xff); |
3646 FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); | 3646 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
3647 pDestPalette = (FX_DWORD*)gray_pal; | 3647 pDestPalette = (FX_DWORD*)gray_pal; |
3648 if (isSrcCmyk) { | 3648 if (isSrcCmyk) { |
3649 for (int i = 0; i < pal_count; i ++) { | 3649 for (int i = 0; i < pal_count; i ++) { |
3650 FX_CMYK cmyk = pSrcPalette[i]; | 3650 FX_CMYK cmyk = pSrcPalette[i]; |
3651 uint8_t r, g, b; | 3651 uint8_t r, g, b; |
3652 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu
e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), | 3652 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu
e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), |
3653 r, g, b); | 3653 r, g, b); |
3654 *gray_pal ++ = FXRGB2GRAY(r, g, b); | 3654 *gray_pal ++ = FXRGB2GRAY(r, g, b); |
3655 } | 3655 } |
3656 } else | 3656 } else |
(...skipping 12 matching lines...) Expand all Loading... |
3669 uint8_t r, g, b; | 3669 uint8_t r, g, b; |
3670 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu
e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), | 3670 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu
e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), |
3671 r, g, b); | 3671 r, g, b); |
3672 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); | 3672 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); |
3673 } | 3673 } |
3674 } | 3674 } |
3675 } | 3675 } |
3676 } else { | 3676 } else { |
3677 if ((dest_format & 0xff) == 8) { | 3677 if ((dest_format & 0xff) == 8) { |
3678 int pal_count = 1 << (src_format & 0xff); | 3678 int pal_count = 1 << (src_format & 0xff); |
3679 FX_LPBYTE gray_pal = FX_Alloc(uint8_t, pal_count); | 3679 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
3680 if (pal_count == 2) { | 3680 if (pal_count == 2) { |
3681 gray_pal[0] = 0; | 3681 gray_pal[0] = 0; |
3682 gray_pal[1] = 255; | 3682 gray_pal[1] = 255; |
3683 } else { | 3683 } else { |
3684 for (int i = 0; i < pal_count; i++) { | 3684 for (int i = 0; i < pal_count; i++) { |
3685 gray_pal[i] = i; | 3685 gray_pal[i] = i; |
3686 } | 3686 } |
3687 } | 3687 } |
3688 pDestPalette = (FX_DWORD*)gray_pal; | 3688 pDestPalette = (FX_DWORD*)gray_pal; |
3689 } else { | 3689 } else { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 } | 3767 } |
3768 m_Transparency = (src_format & 0x0200 ? 0 : 1) | 3768 m_Transparency = (src_format & 0x0200 ? 0 : 1) |
3769 + (dest_format & 0x0200 ? 0 : 2) | 3769 + (dest_format & 0x0200 ? 0 : 2) |
3770 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) | 3770 + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) |
3771 + (bClip ? 8 : 0) | 3771 + (bClip ? 8 : 0) |
3772 + (src_format & 0x0400 ? 16 : 0) | 3772 + (src_format & 0x0400 ? 16 : 0) |
3773 + (dest_format & 0x0400 ? 32 : 0) | 3773 + (dest_format & 0x0400 ? 32 : 0) |
3774 + (pIccTransform ? 64 : 0); | 3774 + (pIccTransform ? 64 : 0); |
3775 return TRUE; | 3775 return TRUE; |
3776 } | 3776 } |
3777 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(FX_LPBYTE dest_scan, FX_LPCB
YTE src_scan, int width, FX_LPCBYTE clip_scan, | 3777 void CFX_ScanlineCompositor::CompositeRgbBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int width, const uint8_t* clip_scan, |
3778 FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) | 3778 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) |
3779 { | 3779 { |
3780 int src_Bpp = (m_SrcFormat & 0xff) >> 3; | 3780 int src_Bpp = (m_SrcFormat & 0xff) >> 3; |
3781 int dest_Bpp = (m_DestFormat & 0xff) >> 3; | 3781 int dest_Bpp = (m_DestFormat & 0xff) >> 3; |
3782 if (m_bRgbByteOrder) { | 3782 if (m_bRgbByteOrder) { |
3783 switch (m_Transparency) { | 3783 switch (m_Transparency) { |
3784 case 0: | 3784 case 0: |
3785 case 4: | 3785 case 4: |
3786 case 8: | 3786 case 8: |
3787 case 12: | 3787 case 12: |
3788 _CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width,
m_BlendType, clip_scan); | 3788 _CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width,
m_BlendType, clip_scan); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3960 case 1+2+4+8: | 3960 case 1+2+4+8: |
3961 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, d
est_Bpp, src_Bpp, clip_scan); | 3961 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, d
est_Bpp, src_Bpp, clip_scan); |
3962 break; | 3962 break; |
3963 case 1+2+4+8+64: | 3963 case 1+2+4+8+64: |
3964 _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(dest_scan, src_scan
, width, dest_Bpp, src_Bpp, clip_scan, | 3964 _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(dest_scan, src_scan
, width, dest_Bpp, src_Bpp, clip_scan, |
3965 m_pCacheScanline, m_pIccTransform); | 3965 m_pCacheScanline, m_pIccTransform); |
3966 break; | 3966 break; |
3967 } | 3967 } |
3968 } | 3968 } |
3969 } | 3969 } |
3970 void CFX_ScanlineCompositor::CompositePalBitmapLine(FX_LPBYTE dest_scan, FX_LPCB
YTE src_scan, int src_left, int width, FX_LPCBYTE clip_scan, | 3970 void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
nt8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, |
3971 FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_extra_alpha) | 3971 const uint8_t* src_extra_alpha, uint8_t* dst_extra_alpha) |
3972 { | 3972 { |
3973 if (m_bRgbByteOrder) { | 3973 if (m_bRgbByteOrder) { |
3974 if (m_SrcFormat == FXDIB_1bppRgb) { | 3974 if (m_SrcFormat == FXDIB_1bppRgb) { |
3975 if (m_DestFormat == FXDIB_8bppRgb) { | 3975 if (m_DestFormat == FXDIB_8bppRgb) { |
3976 return; | 3976 return; |
3977 } else if(m_DestFormat == FXDIB_Argb) { | 3977 } else if(m_DestFormat == FXDIB_Argb) { |
3978 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); | 3978 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, src_left, width, m_pSrcPalette, clip_scan); |
3979 } else { | 3979 } else { |
3980 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3980 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
3981 } | 3981 } |
3982 } else { | 3982 } else { |
3983 if (m_DestFormat == FXDIB_8bppRgb) { | 3983 if (m_DestFormat == FXDIB_8bppRgb) { |
3984 return; | 3984 return; |
3985 } else if (m_DestFormat == FXDIB_Argb) { | 3985 } else if (m_DestFormat == FXDIB_Argb) { |
3986 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); | 3986 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_s
can, width, m_pSrcPalette, clip_scan); |
3987 } else { | 3987 } else { |
3988 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); | 3988 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_sc
an, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan); |
3989 } | 3989 } |
3990 } | 3990 } |
3991 return; | 3991 return; |
3992 } | 3992 } |
3993 if (m_DestFormat == FXDIB_8bppMask) { | 3993 if (m_DestFormat == FXDIB_8bppMask) { |
3994 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); | 3994 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); |
3995 return; | 3995 return; |
3996 } else if ((m_DestFormat & 0xff) == 8) { | 3996 } else if ((m_DestFormat & 0xff) == 8) { |
3997 if (m_Transparency & 8) { | 3997 if (m_Transparency & 8) { |
3998 if (m_DestFormat & 0x0200) { | 3998 if (m_DestFormat & 0x0200) { |
3999 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (FX_L
PCBYTE)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); | 3999 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (cons
t uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha); |
4000 } else { | 4000 } else { |
4001 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (FX_LP
CBYTE)m_pSrcPalette, width, m_BlendType, clip_scan); | 4001 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, (const
uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan); |
4002 } | 4002 } |
4003 } else { | 4003 } else { |
4004 if (m_DestFormat & 0x0200) | 4004 if (m_DestFormat & 0x0200) |
4005 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (FX_LPCBYTE)m_p
SrcPalette, width, m_BlendType, clip_scan, | 4005 _CompositeRow_8bppPal2Graya(dest_scan, src_scan, (const uint8_t*
)m_pSrcPalette, width, m_BlendType, clip_scan, |
4006 dst_extra_alpha, src_extra_alpha); | 4006 dst_extra_alpha, src_extra_alpha); |
4007 else | 4007 else |
4008 _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (FX_LPCBYTE)m_pS
rcPalette, width, m_BlendType, clip_scan, | 4008 _CompositeRow_8bppPal2Gray(dest_scan, src_scan, (const uint8_t*)
m_pSrcPalette, width, m_BlendType, clip_scan, |
4009 src_extra_alpha); | 4009 src_extra_alpha); |
4010 } | 4010 } |
4011 } else { | 4011 } else { |
4012 switch (m_Transparency) { | 4012 switch (m_Transparency) { |
4013 case 1+2: | 4013 case 1+2: |
4014 _CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width, m
_pSrcPalette, clip_scan, | 4014 _CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width, m
_pSrcPalette, clip_scan, |
4015 src_extra_alpha); | 4015 src_extra_alpha); |
4016 break; | 4016 break; |
4017 case 1+2+8: | 4017 case 1+2+8: |
4018 _CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left
, width, m_pSrcPalette, clip_scan); | 4018 _CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left
, width, m_pSrcPalette, clip_scan); |
(...skipping 10 matching lines...) Expand all Loading... |
4029 src_extra_alpha); | 4029 src_extra_alpha); |
4030 break; | 4030 break; |
4031 case 0+2+8: | 4031 case 0+2+8: |
4032 _CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left
, width, m_pSrcPalette, clip_scan, | 4032 _CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left
, width, m_pSrcPalette, clip_scan, |
4033 dst_extra_alpha); | 4033 dst_extra_alpha); |
4034 break; | 4034 break; |
4035 break; | 4035 break; |
4036 } | 4036 } |
4037 } | 4037 } |
4038 } | 4038 } |
4039 void CFX_ScanlineCompositor::CompositeByteMaskLine(FX_LPBYTE dest_scan, FX_LPCBY
TE src_scan, int width, FX_LPCBYTE clip_scan, | 4039 void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan, const uin
t8_t* src_scan, int width, const uint8_t* clip_scan, |
4040 FX_LPBYTE dst_extra_alpha) | 4040 uint8_t* dst_extra_alpha) |
4041 { | 4041 { |
4042 if (m_DestFormat == FXDIB_8bppMask) { | 4042 if (m_DestFormat == FXDIB_8bppMask) { |
4043 _CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, cli
p_scan); | 4043 _CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, cli
p_scan); |
4044 } else if ((m_DestFormat & 0xff) == 8) { | 4044 } else if ((m_DestFormat & 0xff) == 8) { |
4045 if (m_DestFormat & 0x0200) { | 4045 if (m_DestFormat & 0x0200) { |
4046 _CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_Mas
kRed, width, clip_scan, dst_extra_alpha); | 4046 _CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_Mas
kRed, width, clip_scan, dst_extra_alpha); |
4047 } else { | 4047 } else { |
4048 _CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_Mask
Red, width, clip_scan); | 4048 _CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_Mask
Red, width, clip_scan); |
4049 } | 4049 } |
4050 } else if (m_bRgbByteOrder) { | 4050 } else if (m_bRgbByteOrder) { |
4051 if (m_DestFormat == FXDIB_Argb) | 4051 if (m_DestFormat == FXDIB_Argb) |
4052 _CompositeRow_ByteMask2Argb_RgbByteOrder(dest_scan, src_scan, m_Mask
Alpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4052 _CompositeRow_ByteMask2Argb_RgbByteOrder(dest_scan, src_scan, m_Mask
Alpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
4053 width, m_BlendType, clip_scan); | 4053 width, m_BlendType, clip_scan); |
4054 else | 4054 else |
4055 _CompositeRow_ByteMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskA
lpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4055 _CompositeRow_ByteMask2Rgb_RgbByteOrder(dest_scan, src_scan, m_MaskA
lpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
4056 width, m_BlendType, (m_DestF
ormat & 0xff) >> 3, clip_scan); | 4056 width, m_BlendType, (m_DestF
ormat & 0xff) >> 3, clip_scan); |
4057 return; | 4057 return; |
4058 } else if (m_DestFormat == FXDIB_Argb) | 4058 } else if (m_DestFormat == FXDIB_Argb) |
4059 _CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, | 4059 _CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, |
4060 width, m_BlendType, clip_scan); | 4060 width, m_BlendType, clip_scan); |
4061 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) | 4061 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) |
4062 _CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, | 4062 _CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, |
4063 width, m_BlendType, (m_DestFormat & 0xff) >>
3, clip_scan); | 4063 width, m_BlendType, (m_DestFormat & 0xff) >>
3, clip_scan); |
4064 else if (m_DestFormat == FXDIB_Rgba) | 4064 else if (m_DestFormat == FXDIB_Rgba) |
4065 _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, | 4065 _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, |
4066 width, m_BlendType, clip_scan, dst_extra_alp
ha); | 4066 width, m_BlendType, clip_scan, dst_extra_alp
ha); |
4067 } | 4067 } |
4068 void CFX_ScanlineCompositor::CompositeBitMaskLine(FX_LPBYTE dest_scan, FX_LPCBYT
E src_scan, int src_left, int width, FX_LPCBYTE clip_scan, | 4068 void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, const uint
8_t* src_scan, int src_left, int width, const uint8_t* clip_scan, |
4069 FX_LPBYTE dst_extra_alpha) | 4069 uint8_t* dst_extra_alpha) |
4070 { | 4070 { |
4071 if (m_DestFormat == FXDIB_8bppMask) { | 4071 if (m_DestFormat == FXDIB_8bppMask) { |
4072 _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, w
idth, clip_scan); | 4072 _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, w
idth, clip_scan); |
4073 } else if ((m_DestFormat & 0xff) == 8) { | 4073 } else if ((m_DestFormat & 0xff) == 8) { |
4074 if (m_DestFormat & 0x0200) | 4074 if (m_DestFormat & 0x0200) |
4075 _CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_Mask
Red, src_left, width, clip_scan, | 4075 _CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_Mask
Red, src_left, width, clip_scan, |
4076 dst_extra_alpha); | 4076 dst_extra_alpha); |
4077 else { | 4077 else { |
4078 _CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskR
ed, src_left, width, clip_scan); | 4078 _CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskR
ed, src_left, width, clip_scan); |
4079 } | 4079 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 CFX_ScanlineCompositor compositor; | 4119 CFX_ScanlineCompositor compositor; |
4120 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, | 4120 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap
->GetPalette(), 0, blend_type, |
4121 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { | 4121 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { |
4122 return FALSE; | 4122 return FALSE; |
4123 } | 4123 } |
4124 int dest_Bpp = m_bpp / 8; | 4124 int dest_Bpp = m_bpp / 8; |
4125 int src_Bpp = pSrcBitmap->GetBPP() / 8; | 4125 int src_Bpp = pSrcBitmap->GetBPP() / 8; |
4126 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); | 4126 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); |
4127 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; | 4127 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; |
4128 for (int row = 0; row < height; row ++) { | 4128 for (int row = 0; row < height; row ++) { |
4129 FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; | 4129 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* dest_Bpp; |
4130 FX_LPCBYTE src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left
* src_Bpp; | 4130 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_l
eft * src_Bpp; |
4131 FX_LPCBYTE src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->GetScan
line(src_top + row) + src_left : NULL; | 4131 const uint8_t* src_scan_extra_alpha = pSrcAlphaMask ? pSrcAlphaMask->Get
Scanline(src_top + row) + src_left : NULL; |
4132 FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask-
>GetScanline(dest_top + row) + dest_left : NULL; | 4132 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; |
4133 FX_LPCBYTE clip_scan = NULL; | 4133 const uint8_t* clip_scan = NULL; |
4134 if (pClipMask) { | 4134 if (pClipMask) { |
4135 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); | 4135 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); |
4136 } | 4136 } |
4137 if (bRgb) { | 4137 if (bRgb) { |
4138 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s
can, src_scan_extra_alpha, dst_scan_extra_alpha); | 4138 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_s
can, src_scan_extra_alpha, dst_scan_extra_alpha); |
4139 } else { | 4139 } else { |
4140 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid
th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); | 4140 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, wid
th, clip_scan, src_scan_extra_alpha, dst_scan_extra_alpha); |
4141 } | 4141 } |
4142 } | 4142 } |
4143 return TRUE; | 4143 return TRUE; |
(...skipping 25 matching lines...) Expand all Loading... |
4169 pClipMask = pClipRgn->GetMask(); | 4169 pClipMask = pClipRgn->GetMask(); |
4170 clip_box = pClipRgn->GetBox(); | 4170 clip_box = pClipRgn->GetBox(); |
4171 } | 4171 } |
4172 int src_bpp = pMask->GetBPP(); | 4172 int src_bpp = pMask->GetBPP(); |
4173 int Bpp = GetBPP() / 8; | 4173 int Bpp = GetBPP() / 8; |
4174 CFX_ScanlineCompositor compositor; | 4174 CFX_ScanlineCompositor compositor; |
4175 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl
end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { | 4175 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, bl
end_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, pIccTransform)) { |
4176 return FALSE; | 4176 return FALSE; |
4177 } | 4177 } |
4178 for (int row = 0; row < height; row ++) { | 4178 for (int row = 0; row < height; row ++) { |
4179 FX_LPBYTE dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* Bpp; | 4179 uint8_t* dest_scan = m_pBuffer + (dest_top + row) * m_Pitch + dest_left
* Bpp; |
4180 FX_LPCBYTE src_scan = pMask->GetScanline(src_top + row); | 4180 const uint8_t* src_scan = pMask->GetScanline(src_top + row); |
4181 FX_LPBYTE dst_scan_extra_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask-
>GetScanline(dest_top + row) + dest_left : NULL; | 4181 uint8_t* dst_scan_extra_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->G
etScanline(dest_top + row) + dest_left : NULL; |
4182 FX_LPCBYTE clip_scan = NULL; | 4182 const uint8_t* clip_scan = NULL; |
4183 if (pClipMask) { | 4183 if (pClipMask) { |
4184 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); | 4184 clip_scan = pClipMask->m_pBuffer + (dest_top + row - clip_box.top) *
pClipMask->m_Pitch + (dest_left - clip_box.left); |
4185 } | 4185 } |
4186 if (src_bpp == 1) { | 4186 if (src_bpp == 1) { |
4187 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width
, clip_scan, dst_scan_extra_alpha); | 4187 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width
, clip_scan, dst_scan_extra_alpha); |
4188 } else { | 4188 } else { |
4189 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid
th, clip_scan, dst_scan_extra_alpha); | 4189 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, wid
th, clip_scan, dst_scan_extra_alpha); |
4190 } | 4190 } |
4191 } | 4191 } |
4192 return TRUE; | 4192 return TRUE; |
(...skipping 12 matching lines...) Expand all Loading... |
4205 if (rect.IsEmpty()) { | 4205 if (rect.IsEmpty()) { |
4206 return TRUE; | 4206 return TRUE; |
4207 } | 4207 } |
4208 width = rect.Width(); | 4208 width = rect.Width(); |
4209 FX_DWORD dst_color; | 4209 FX_DWORD dst_color; |
4210 if (alpha_flag >> 8) { | 4210 if (alpha_flag >> 8) { |
4211 dst_color = FXCMYK_TODIB(color); | 4211 dst_color = FXCMYK_TODIB(color); |
4212 } else { | 4212 } else { |
4213 dst_color = FXARGB_TODIB(color); | 4213 dst_color = FXARGB_TODIB(color); |
4214 } | 4214 } |
4215 FX_LPBYTE color_p = (FX_LPBYTE)&dst_color; | 4215 uint8_t* color_p = (uint8_t*)&dst_color; |
4216 if (m_bpp == 8) { | 4216 if (m_bpp == 8) { |
4217 uint8_t gray = 255; | 4217 uint8_t gray = 255; |
4218 if (!IsAlphaMask()) { | 4218 if (!IsAlphaMask()) { |
4219 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GE
Module::Get()->GetCodecModule()->GetIccModule()) { | 4219 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule() && CFX_GE
Module::Get()->GetCodecModule()->GetIccModule()) { |
4220 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModu
le()->GetIccModule(); | 4220 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModu
le()->GetIccModule(); |
4221 pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); | 4221 pIccModule->TranslateScanline(pIccTransform, &gray, color_p, 1); |
4222 } else { | 4222 } else { |
4223 if (alpha_flag >> 8) { | 4223 if (alpha_flag >> 8) { |
4224 uint8_t r, g, b; | 4224 uint8_t r, g, b; |
4225 AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color
_p[3], | 4225 AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color
_p[3], |
4226 r, g, b); | 4226 r, g, b); |
4227 gray = FXRGB2GRAY(r, g, b); | 4227 gray = FXRGB2GRAY(r, g, b); |
4228 } else { | 4228 } else { |
4229 gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], colo
r_p[0]); | 4229 gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], colo
r_p[0]); |
4230 } | 4230 } |
4231 } | 4231 } |
4232 if (IsCmykImage()) { | 4232 if (IsCmykImage()) { |
4233 gray = ~gray; | 4233 gray = ~gray; |
4234 } | 4234 } |
4235 } | 4235 } |
4236 for (int row = rect.top; row < rect.bottom; row ++) { | 4236 for (int row = rect.top; row < rect.bottom; row ++) { |
4237 FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left; | 4237 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; |
4238 if (src_alpha == 255) { | 4238 if (src_alpha == 255) { |
4239 FXSYS_memset8(dest_scan, gray, width); | 4239 FXSYS_memset8(dest_scan, gray, width); |
4240 } else | 4240 } else |
4241 for (int col = 0; col < width; col ++) { | 4241 for (int col = 0; col < width; col ++) { |
4242 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 4242 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
4243 dest_scan ++; | 4243 dest_scan ++; |
4244 } | 4244 } |
4245 } | 4245 } |
4246 return TRUE; | 4246 return TRUE; |
4247 } else if (m_bpp == 1) { | 4247 } else if (m_bpp == 1) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 } | 4298 } |
4299 } | 4299 } |
4300 if(!IsCmykImage()) { | 4300 if(!IsCmykImage()) { |
4301 color_p[3] = (uint8_t)src_alpha; | 4301 color_p[3] = (uint8_t)src_alpha; |
4302 } | 4302 } |
4303 int Bpp = m_bpp / 8; | 4303 int Bpp = m_bpp / 8; |
4304 FX_BOOL bAlpha = HasAlpha(); | 4304 FX_BOOL bAlpha = HasAlpha(); |
4305 FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; | 4305 FX_BOOL bArgb = GetFormat() == FXDIB_Argb ? TRUE : FALSE; |
4306 if (src_alpha == 255) { | 4306 if (src_alpha == 255) { |
4307 for (int row = rect.top; row < rect.bottom; row ++) { | 4307 for (int row = rect.top; row < rect.bottom; row ++) { |
4308 FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4308 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
4309 FX_LPBYTE dest_scan_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask->
GetScanline(row) + rect.left : NULL; | 4309 uint8_t* dest_scan_alpha = m_pAlphaMask ? (uint8_t*)m_pAlphaMask->Ge
tScanline(row) + rect.left : NULL; |
4310 if (dest_scan_alpha) { | 4310 if (dest_scan_alpha) { |
4311 FXSYS_memset8(dest_scan_alpha, 0xff, width); | 4311 FXSYS_memset8(dest_scan_alpha, 0xff, width); |
4312 } | 4312 } |
4313 if (Bpp == 4) { | 4313 if (Bpp == 4) { |
4314 FX_DWORD* scan = (FX_DWORD*)dest_scan; | 4314 FX_DWORD* scan = (FX_DWORD*)dest_scan; |
4315 for (int col = 0; col < width; col ++) { | 4315 for (int col = 0; col < width; col ++) { |
4316 *scan ++ = dst_color; | 4316 *scan ++ = dst_color; |
4317 } | 4317 } |
4318 } else { | 4318 } else { |
4319 for (int col = 0; col < width; col ++) { | 4319 for (int col = 0; col < width; col ++) { |
4320 *dest_scan ++ = color_p[0]; | 4320 *dest_scan ++ = color_p[0]; |
4321 *dest_scan ++ = color_p[1]; | 4321 *dest_scan ++ = color_p[1]; |
4322 *dest_scan ++ = color_p[2]; | 4322 *dest_scan ++ = color_p[2]; |
4323 } | 4323 } |
4324 } | 4324 } |
4325 } | 4325 } |
4326 return TRUE; | 4326 return TRUE; |
4327 } | 4327 } |
4328 for (int row = rect.top; row < rect.bottom; row ++) { | 4328 for (int row = rect.top; row < rect.bottom; row ++) { |
4329 FX_LPBYTE dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4329 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
4330 if (bAlpha) { | 4330 if (bAlpha) { |
4331 if (bArgb) { | 4331 if (bArgb) { |
4332 for (int col = 0; col < width; col ++) { | 4332 for (int col = 0; col < width; col ++) { |
4333 uint8_t back_alpha = dest_scan[3]; | 4333 uint8_t back_alpha = dest_scan[3]; |
4334 if (back_alpha == 0) { | 4334 if (back_alpha == 0) { |
4335 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[
2], color_p[1], color_p[0])); | 4335 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, color_p[
2], color_p[1], color_p[0])); |
4336 dest_scan += 4; | 4336 dest_scan += 4; |
4337 continue; | 4337 continue; |
4338 } | 4338 } |
4339 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * s
rc_alpha / 255; | 4339 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * s
rc_alpha / 255; |
4340 int alpha_ratio = src_alpha * 255 / dest_alpha; | 4340 int alpha_ratio = src_alpha * 255 / dest_alpha; |
4341 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha
_ratio); | 4341 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[0], alpha
_ratio); |
4342 dest_scan ++; | 4342 dest_scan ++; |
4343 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[1], alpha
_ratio); | 4343 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[1], alpha
_ratio); |
4344 dest_scan ++; | 4344 dest_scan ++; |
4345 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[2], alpha
_ratio); | 4345 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[2], alpha
_ratio); |
4346 dest_scan ++; | 4346 dest_scan ++; |
4347 *dest_scan++ = dest_alpha; | 4347 *dest_scan++ = dest_alpha; |
4348 } | 4348 } |
4349 } else { | 4349 } else { |
4350 FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline
(row) + rect.left; | 4350 uint8_t* dest_scan_alpha = (uint8_t*)m_pAlphaMask->GetScanline(r
ow) + rect.left; |
4351 for (int col = 0; col < width; col ++) { | 4351 for (int col = 0; col < width; col ++) { |
4352 uint8_t back_alpha = *dest_scan_alpha; | 4352 uint8_t back_alpha = *dest_scan_alpha; |
4353 if (back_alpha == 0) { | 4353 if (back_alpha == 0) { |
4354 *dest_scan_alpha++ = src_alpha; | 4354 *dest_scan_alpha++ = src_alpha; |
4355 FXSYS_memcpy32(dest_scan, color_p, Bpp); | 4355 FXSYS_memcpy32(dest_scan, color_p, Bpp); |
4356 dest_scan += Bpp; | 4356 dest_scan += Bpp; |
4357 continue; | 4357 continue; |
4358 } | 4358 } |
4359 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * s
rc_alpha / 255; | 4359 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * s
rc_alpha / 255; |
4360 *dest_scan_alpha ++ = dest_alpha; | 4360 *dest_scan_alpha ++ = dest_alpha; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4441 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); | 4441 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); |
4442 if (m_pBitmap->m_pAlphaMask) { | 4442 if (m_pBitmap->m_pAlphaMask) { |
4443 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); | 4443 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); |
4444 } | 4444 } |
4445 } | 4445 } |
4446 if (m_BitmapAlpha < 255) { | 4446 if (m_BitmapAlpha < 255) { |
4447 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight()
: m_pBitmap->GetWidth()); | 4447 m_pAddClipScan = FX_Alloc(uint8_t, m_bVertical ? m_pBitmap->GetHeight()
: m_pBitmap->GetWidth()); |
4448 } | 4448 } |
4449 return TRUE; | 4449 return TRUE; |
4450 } | 4450 } |
4451 void CFX_BitmapComposer::DoCompose(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int
dest_width, FX_LPCBYTE clip_scan, | 4451 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, const uint8_t* src_scan,
int dest_width, const uint8_t* clip_scan, |
4452 FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_ext
ra_alpha) | 4452 const uint8_t* src_extra_alpha, uint8_t* dst_
extra_alpha) |
4453 { | 4453 { |
4454 if (m_BitmapAlpha < 255) { | 4454 if (m_BitmapAlpha < 255) { |
4455 if (clip_scan) { | 4455 if (clip_scan) { |
4456 for (int i = 0; i < dest_width; i ++) { | 4456 for (int i = 0; i < dest_width; i ++) { |
4457 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; | 4457 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; |
4458 } | 4458 } |
4459 } else { | 4459 } else { |
4460 FXSYS_memset8(m_pAddClipScan, m_BitmapAlpha, dest_width); | 4460 FXSYS_memset8(m_pAddClipScan, m_BitmapAlpha, dest_width); |
4461 } | 4461 } |
4462 clip_scan = m_pAddClipScan; | 4462 clip_scan = m_pAddClipScan; |
4463 } | 4463 } |
4464 if (m_SrcFormat == FXDIB_8bppMask) { | 4464 if (m_SrcFormat == FXDIB_8bppMask) { |
4465 m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width, clip
_scan, dst_extra_alpha); | 4465 m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width, clip
_scan, dst_extra_alpha); |
4466 } else if ((m_SrcFormat & 0xff) == 8) { | 4466 } else if ((m_SrcFormat & 0xff) == 8) { |
4467 m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width,
clip_scan, src_extra_alpha, dst_extra_alpha); | 4467 m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width,
clip_scan, src_extra_alpha, dst_extra_alpha); |
4468 } else { | 4468 } else { |
4469 m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, cli
p_scan, src_extra_alpha, dst_extra_alpha); | 4469 m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, cli
p_scan, src_extra_alpha, dst_extra_alpha); |
4470 } | 4470 } |
4471 } | 4471 } |
4472 void CFX_BitmapComposer::ComposeScanline(int line, FX_LPCBYTE scanline, FX_LPCBY
TE scan_extra_alpha) | 4472 void CFX_BitmapComposer::ComposeScanline(int line, const uint8_t* scanline, cons
t uint8_t* scan_extra_alpha) |
4473 { | 4473 { |
4474 if (m_bVertical) { | 4474 if (m_bVertical) { |
4475 ComposeScanlineV(line, scanline, scan_extra_alpha); | 4475 ComposeScanlineV(line, scanline, scan_extra_alpha); |
4476 return; | 4476 return; |
4477 } | 4477 } |
4478 FX_LPCBYTE clip_scan = NULL; | 4478 const uint8_t* clip_scan = NULL; |
4479 if (m_pClipMask) | 4479 if (m_pClipMask) |
4480 clip_scan = m_pClipMask->GetBuffer() + (m_DestTop + line - m_pClipRgn->G
etBox().top) * | 4480 clip_scan = m_pClipMask->GetBuffer() + (m_DestTop + line - m_pClipRgn->G
etBox().top) * |
4481 m_pClipMask->GetPitch() + (m_DestLeft - m_pClipRgn->GetBox()
.left); | 4481 m_pClipMask->GetPitch() + (m_DestLeft - m_pClipRgn->GetBox()
.left); |
4482 FX_LPBYTE dest_scan = (FX_LPBYTE)m_pBitmap->GetScanline(line + m_DestTop) + | 4482 uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) + |
4483 m_DestLeft * m_pBitmap->GetBPP() / 8; | 4483 m_DestLeft * m_pBitmap->GetBPP() / 8; |
4484 FX_LPBYTE dest_alpha_scan = m_pBitmap->m_pAlphaMask ? | 4484 uint8_t* dest_alpha_scan = m_pBitmap->m_pAlphaMask ? |
4485 (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(
line + m_DestTop) + m_DestLeft : NULL; | 4485 (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(l
ine + m_DestTop) + m_DestLeft : NULL; |
4486 DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, des
t_alpha_scan); | 4486 DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, des
t_alpha_scan); |
4487 } | 4487 } |
4488 void CFX_BitmapComposer::ComposeScanlineV(int line, FX_LPCBYTE scanline, FX_LPCB
YTE scan_extra_alpha) | 4488 void CFX_BitmapComposer::ComposeScanlineV(int line, const uint8_t* scanline, con
st uint8_t* scan_extra_alpha) |
4489 { | 4489 { |
4490 int i; | 4490 int i; |
4491 int Bpp = m_pBitmap->GetBPP() / 8; | 4491 int Bpp = m_pBitmap->GetBPP() / 8; |
4492 int dest_pitch = m_pBitmap->GetPitch(); | 4492 int dest_pitch = m_pBitmap->GetPitch(); |
4493 int dest_alpha_pitch = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->Ge
tPitch() : 0; | 4493 int dest_alpha_pitch = m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->Ge
tPitch() : 0; |
4494 int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); | 4494 int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); |
4495 FX_LPBYTE dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * des
t_pitch; | 4495 uint8_t* dest_buf = m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest
_pitch; |
4496 FX_LPBYTE dest_alpha_buf = m_pBitmap->m_pAlphaMask ? | 4496 uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask ? |
4497 m_pBitmap->m_pAlphaMask->GetBuffer() + dest_x + m
_DestTop * dest_alpha_pitch : NULL; | 4497 m_pBitmap->m_pAlphaMask->GetBuffer() + dest_x + m
_DestTop * dest_alpha_pitch : NULL; |
4498 if (m_bFlipY) { | 4498 if (m_bFlipY) { |
4499 dest_buf += dest_pitch * (m_DestHeight - 1); | 4499 dest_buf += dest_pitch * (m_DestHeight - 1); |
4500 dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1); | 4500 dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1); |
4501 } | 4501 } |
4502 int y_step = dest_pitch; | 4502 int y_step = dest_pitch; |
4503 int y_alpha_step = dest_alpha_pitch; | 4503 int y_alpha_step = dest_alpha_pitch; |
4504 if (m_bFlipY) { | 4504 if (m_bFlipY) { |
4505 y_step = -y_step; | 4505 y_step = -y_step; |
4506 y_alpha_step = -y_alpha_step; | 4506 y_alpha_step = -y_alpha_step; |
4507 } | 4507 } |
4508 FX_LPBYTE src_scan = m_pScanlineV; | 4508 uint8_t* src_scan = m_pScanlineV; |
4509 FX_LPBYTE dest_scan = dest_buf; | 4509 uint8_t* dest_scan = dest_buf; |
4510 for (i = 0; i < m_DestHeight; i ++) { | 4510 for (i = 0; i < m_DestHeight; i ++) { |
4511 for (int j = 0; j < Bpp; j ++) { | 4511 for (int j = 0; j < Bpp; j ++) { |
4512 *src_scan++ = dest_scan[j]; | 4512 *src_scan++ = dest_scan[j]; |
4513 } | 4513 } |
4514 dest_scan += y_step; | 4514 dest_scan += y_step; |
4515 } | 4515 } |
4516 FX_LPBYTE src_alpha_scan = m_pScanlineAlphaV; | 4516 uint8_t* src_alpha_scan = m_pScanlineAlphaV; |
4517 FX_LPBYTE dest_alpha_scan = dest_alpha_buf; | 4517 uint8_t* dest_alpha_scan = dest_alpha_buf; |
4518 if (dest_alpha_scan) { | 4518 if (dest_alpha_scan) { |
4519 for (i = 0; i < m_DestHeight; i ++) { | 4519 for (i = 0; i < m_DestHeight; i ++) { |
4520 *src_alpha_scan++ = *dest_alpha_scan; | 4520 *src_alpha_scan++ = *dest_alpha_scan; |
4521 dest_alpha_scan += y_alpha_step; | 4521 dest_alpha_scan += y_alpha_step; |
4522 } | 4522 } |
4523 } | 4523 } |
4524 FX_LPBYTE clip_scan = NULL; | 4524 uint8_t* clip_scan = NULL; |
4525 if (m_pClipMask) { | 4525 if (m_pClipMask) { |
4526 clip_scan = m_pClipScanV; | 4526 clip_scan = m_pClipScanV; |
4527 int clip_pitch = m_pClipMask->GetPitch(); | 4527 int clip_pitch = m_pClipMask->GetPitch(); |
4528 FX_LPCBYTE src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pClipRgn
->GetBox().top) * | 4528 const uint8_t* src_clip = m_pClipMask->GetBuffer() + (m_DestTop - m_pCli
pRgn->GetBox().top) * |
4529 clip_pitch + (dest_x - m_pClipRgn->GetBox().left); | 4529 clip_pitch + (dest_x - m_pClipRgn->GetBox().left); |
4530 if (m_bFlipY) { | 4530 if (m_bFlipY) { |
4531 src_clip += clip_pitch * (m_DestHeight - 1); | 4531 src_clip += clip_pitch * (m_DestHeight - 1); |
4532 clip_pitch = -clip_pitch; | 4532 clip_pitch = -clip_pitch; |
4533 } | 4533 } |
4534 for (i = 0; i < m_DestHeight; i ++) { | 4534 for (i = 0; i < m_DestHeight; i ++) { |
4535 clip_scan[i] = *src_clip; | 4535 clip_scan[i] = *src_clip; |
4536 src_clip += clip_pitch; | 4536 src_clip += clip_pitch; |
4537 } | 4537 } |
4538 } | 4538 } |
4539 DoCompose(m_pScanlineV, scanline, m_DestHeight, clip_scan, scan_extra_alpha,
m_pScanlineAlphaV); | 4539 DoCompose(m_pScanlineV, scanline, m_DestHeight, clip_scan, scan_extra_alpha,
m_pScanlineAlphaV); |
4540 src_scan = m_pScanlineV; | 4540 src_scan = m_pScanlineV; |
4541 dest_scan = dest_buf; | 4541 dest_scan = dest_buf; |
4542 for (i = 0; i < m_DestHeight; i ++) { | 4542 for (i = 0; i < m_DestHeight; i ++) { |
4543 for (int j = 0; j < Bpp; j ++) { | 4543 for (int j = 0; j < Bpp; j ++) { |
4544 dest_scan[j] = *src_scan++; | 4544 dest_scan[j] = *src_scan++; |
4545 } | 4545 } |
4546 dest_scan += y_step; | 4546 dest_scan += y_step; |
4547 } | 4547 } |
4548 src_alpha_scan = m_pScanlineAlphaV; | 4548 src_alpha_scan = m_pScanlineAlphaV; |
4549 dest_alpha_scan = dest_alpha_buf; | 4549 dest_alpha_scan = dest_alpha_buf; |
4550 if (dest_alpha_scan) { | 4550 if (dest_alpha_scan) { |
4551 for (i = 0; i < m_DestHeight; i ++) { | 4551 for (i = 0; i < m_DestHeight; i ++) { |
4552 *dest_alpha_scan = *src_alpha_scan++; | 4552 *dest_alpha_scan = *src_alpha_scan++; |
4553 dest_alpha_scan += y_alpha_step; | 4553 dest_alpha_scan += y_alpha_step; |
4554 } | 4554 } |
4555 } | 4555 } |
4556 } | 4556 } |
OLD | NEW |