Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: core/src/fxge/dib/fx_dib_composite.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/apple/fx_quartz_device.cpp ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 FX_BYTE g_GammaRamp[256] = { 10 const uint8_t g_GammaRamp[256] = {
11 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 , 11 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 ,
12 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 , 12 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3 ,
13 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7 , 13 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7 ,
14 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13 , 14 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13 ,
15 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 2 0, 15 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 2 0,
16 20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 2 9, 16 20, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 2 9,
17 30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 4 1, 17 30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 4 1,
18 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 5 4, 18 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 5 4,
19 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7 0, 19 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7 0,
20 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 8 8, 20 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 8 8,
21 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 10 9, 21 90, 91, 92, 93, 95, 96, 97, 99, 100, 101, 103, 104, 105, 107, 108, 10 9,
22 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 130, 131, 1 33, 22 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, 125, 127, 128, 130, 131, 1 33,
23 134, 136, 138, 139, 141, 142, 144, 146, 147, 149, 151, 152, 154, 156, 157, 1 59, 23 134, 136, 138, 139, 141, 142, 144, 146, 147, 149, 151, 152, 154, 156, 157, 1 59,
24 161, 163, 164, 166, 168, 170, 171, 173, 175, 177, 179, 181, 183, 184, 186, 1 88, 24 161, 163, 164, 166, 168, 170, 171, 173, 175, 177, 179, 181, 183, 184, 186, 1 88,
25 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 2 20, 25 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 2 20,
26 222, 224, 226, 229, 231, 233, 235, 237, 239, 242, 244, 246, 248, 250, 253, 2 55, 26 222, 224, 226, 229, 231, 233, 235, 237, 239, 242, 244, 246, 248, 250, 253, 2 55,
27 }; 27 };
28 const FX_BYTE g_GammaInverse[256] = { 28 const uint8_t g_GammaInverse[256] = {
29 0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69 , 29 0, 13, 22, 28, 34, 38, 42, 46, 50, 53, 56, 59, 61, 64, 66, 69 ,
30 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 9 8, 30 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 96, 9 8,
31 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 11 9, 31 99, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 115, 117, 118, 11 9,
32 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 1 36, 32 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 1 36,
33 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 1 51, 33 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, 150, 1 51,
34 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 1 64, 34 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 1 64,
35 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 175, 1 76, 35 165, 166, 167, 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 175, 1 76,
36 177, 178, 178, 179, 180, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 1 87, 36 177, 178, 178, 179, 180, 180, 181, 182, 182, 183, 184, 185, 185, 186, 187, 1 87,
37 188, 189, 189, 190, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 1 97, 37 188, 189, 189, 190, 190, 191, 192, 192, 193, 194, 194, 195, 196, 196, 197, 1 97,
38 198, 199, 199, 200, 200, 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 2 07, 38 198, 199, 199, 200, 200, 201, 202, 202, 203, 203, 204, 205, 205, 206, 206, 2 07,
39 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, 2 16, 39 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215, 2 16,
40 216, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 2 24, 40 216, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224, 2 24,
41 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 2 33, 41 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 2 33,
42 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 2 40, 42 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 2 40,
43 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 2 48, 43 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 2 48,
44 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 2 55, 44 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 2 55,
45 }; 45 };
46 const FX_BYTE _color_sqrt[256] = { 46 const uint8_t _color_sqrt[256] = {
47 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, 0x29 , 0x2C, 0x2F, 0x32, 47 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, 0x29 , 0x2C, 0x2F, 0x32,
48 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50 , 0x52, 0x54, 0x56, 48 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50 , 0x52, 0x54, 0x56,
49 0x57, 0x59, 0x5B, 0x5C, 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69 , 0x6B, 0x6C, 0x6D, 49 0x57, 0x59, 0x5B, 0x5C, 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69 , 0x6B, 0x6C, 0x6D,
50 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B , 0x7C, 0x7D, 0x7E, 50 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B , 0x7C, 0x7D, 0x7E,
51 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x87, 0x88, 0x89, 0x8A, 0x8B , 0x8C, 0x8D, 0x8E, 51 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x87, 0x88, 0x89, 0x8A, 0x8B , 0x8C, 0x8D, 0x8E,
52 0x8F, 0x90, 0x91, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99 , 0x9A, 0x9B, 0x9C, 52 0x8F, 0x90, 0x91, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99 , 0x9A, 0x9B, 0x9C,
53 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5, 0xA6 , 0xA7, 0xA7, 0xA8, 53 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5, 0xA6 , 0xA7, 0xA7, 0xA8,
54 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE, 0xAF, 0xB0, 0xB0, 0xB1, 0xB2 , 0xB3, 0xB3, 0xB4, 54 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE, 0xAF, 0xB0, 0xB0, 0xB1, 0xB2 , 0xB3, 0xB3, 0xB4,
55 0xB5, 0xB5, 0xB6, 0xB7, 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD , 0xBE, 0xBE, 0xBF, 55 0xB5, 0xB5, 0xB6, 0xB7, 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD , 0xBE, 0xBE, 0xBF,
56 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7, 0xC7 , 0xC8, 0xC9, 0xC9, 56 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7, 0xC7 , 0xC8, 0xC9, 0xC9,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, FX_BYTE* dest_scan, int res ults[3]) 230 void _RGB_Blend(int blend_mode, FX_LPCBYTE src_scan, uint8_t* dest_scan, int res ults[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:
(...skipping 14 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in t pixel_count, FX_LPCBYTE 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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_alpha_scan, int pixel_count, FX_LPCBYTE 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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, FX_LPCBYTE clip_scan)
292 { 292 {
(...skipping 12 matching lines...) Expand all
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 ++) {
315 FX_BYTE back_alpha = *dst_alpha_scan; 315 uint8_t back_alpha = *dst_alpha_scan;
316 if (back_alpha == 0) { 316 if (back_alpha == 0) {
317 int src_alpha = *src_alpha_scan++; 317 int src_alpha = *src_alpha_scan++;
318 if (clip_scan) { 318 if (clip_scan) {
319 src_alpha = clip_scan[col] * src_alpha / 255; 319 src_alpha = clip_scan[col] * src_alpha / 255;
320 } 320 }
321 if (src_alpha) { 321 if (src_alpha) {
322 if (pIccTransform) { 322 if (pIccTransform) {
323 pIccModule->TranslateScanline(pIccTransform, dest_sc an, src_scan, 1); 323 pIccModule->TranslateScanline(pIccTransform, dest_sc an, src_scan, 1);
324 } else { 324 } else {
325 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], * src_scan); 325 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], * src_scan);
326 } 326 }
327 *dst_alpha_scan = src_alpha; 327 *dst_alpha_scan = src_alpha;
328 } 328 }
329 dest_scan ++; 329 dest_scan ++;
330 dst_alpha_scan ++; 330 dst_alpha_scan ++;
331 src_scan += 3; 331 src_scan += 3;
332 continue; 332 continue;
333 } 333 }
334 FX_BYTE src_alpha = *src_alpha_scan++; 334 uint8_t src_alpha = *src_alpha_scan++;
335 if (clip_scan) { 335 if (clip_scan) {
336 src_alpha = clip_scan[col] * src_alpha / 255; 336 src_alpha = clip_scan[col] * src_alpha / 255;
337 } 337 }
338 if (src_alpha == 0) { 338 if (src_alpha == 0) {
339 dest_scan ++; 339 dest_scan ++;
340 dst_alpha_scan ++; 340 dst_alpha_scan ++;
341 src_scan += 3; 341 src_scan += 3;
342 continue; 342 continue;
343 } 343 }
344 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 344 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
345 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 345 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
346 FX_BYTE gray; 346 uint8_t gray;
347 if (pIccTransform) { 347 if (pIccTransform) {
348 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan , 1); 348 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan , 1);
349 } else { 349 } else {
350 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 350 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
351 } 351 }
352 if (bNonseparableBlend) { 352 if (bNonseparableBlend) {
353 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 353 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
354 } 354 }
355 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 355 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
356 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 356 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
357 dest_scan ++; 357 dest_scan ++;
358 dst_alpha_scan++; 358 dst_alpha_scan++;
359 src_scan += 3; 359 src_scan += 3;
360 } 360 }
361 } else 361 } else
362 for (int col = 0; col < pixel_count; col ++) { 362 for (int col = 0; col < pixel_count; col ++) {
363 FX_BYTE back_alpha = *dst_alpha_scan; 363 uint8_t back_alpha = *dst_alpha_scan;
364 if (back_alpha == 0) { 364 if (back_alpha == 0) {
365 int src_alpha = src_scan[3]; 365 int src_alpha = src_scan[3];
366 if (clip_scan) { 366 if (clip_scan) {
367 src_alpha = clip_scan[col] * src_alpha / 255; 367 src_alpha = clip_scan[col] * src_alpha / 255;
368 } 368 }
369 if (src_alpha) { 369 if (src_alpha) {
370 if (pIccTransform) { 370 if (pIccTransform) {
371 pIccModule->TranslateScanline(pIccTransform, dest_sc an, src_scan, 1); 371 pIccModule->TranslateScanline(pIccTransform, dest_sc an, src_scan, 1);
372 } else { 372 } else {
373 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], * src_scan); 373 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], * src_scan);
374 } 374 }
375 *dst_alpha_scan = src_alpha; 375 *dst_alpha_scan = src_alpha;
376 } 376 }
377 dest_scan ++; 377 dest_scan ++;
378 dst_alpha_scan ++; 378 dst_alpha_scan ++;
379 src_scan += 4; 379 src_scan += 4;
380 continue; 380 continue;
381 } 381 }
382 FX_BYTE src_alpha = src_scan[3]; 382 uint8_t src_alpha = src_scan[3];
383 if (clip_scan) { 383 if (clip_scan) {
384 src_alpha = clip_scan[col] * src_alpha / 255; 384 src_alpha = clip_scan[col] * src_alpha / 255;
385 } 385 }
386 if (src_alpha == 0) { 386 if (src_alpha == 0) {
387 dest_scan ++; 387 dest_scan ++;
388 dst_alpha_scan ++; 388 dst_alpha_scan ++;
389 src_scan += 4; 389 src_scan += 4;
390 continue; 390 continue;
391 } 391 }
392 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 392 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
393 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 393 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
394 FX_BYTE gray; 394 uint8_t gray;
395 if (pIccTransform) { 395 if (pIccTransform) {
396 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan , 1); 396 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan , 1);
397 } else { 397 } else {
398 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 398 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
399 } 399 }
400 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 400 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
401 dest_scan ++; 401 dest_scan ++;
402 dst_alpha_scan++; 402 dst_alpha_scan++;
403 src_scan += 4; 403 src_scan += 4;
404 } 404 }
405 return; 405 return;
406 } 406 }
407 if (src_alpha_scan) { 407 if (src_alpha_scan) {
408 for (int col = 0; col < pixel_count; col ++) { 408 for (int col = 0; col < pixel_count; col ++) {
409 FX_BYTE back_alpha = *dst_alpha_scan; 409 uint8_t back_alpha = *dst_alpha_scan;
410 if (back_alpha == 0) { 410 if (back_alpha == 0) {
411 int src_alpha = *src_alpha_scan++; 411 int src_alpha = *src_alpha_scan++;
412 if (clip_scan) { 412 if (clip_scan) {
413 src_alpha = clip_scan[col] * src_alpha / 255; 413 src_alpha = clip_scan[col] * src_alpha / 255;
414 } 414 }
415 if (src_alpha) { 415 if (src_alpha) {
416 if (pIccTransform) { 416 if (pIccTransform) {
417 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); 417 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
418 } else { 418 } else {
419 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_ scan); 419 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_ scan);
420 } 420 }
421 *dst_alpha_scan = src_alpha; 421 *dst_alpha_scan = src_alpha;
422 } 422 }
423 dest_scan ++; 423 dest_scan ++;
424 dst_alpha_scan ++; 424 dst_alpha_scan ++;
425 src_scan += 3; 425 src_scan += 3;
426 continue; 426 continue;
427 } 427 }
428 FX_BYTE src_alpha = *src_alpha_scan++; 428 uint8_t src_alpha = *src_alpha_scan++;
429 if (clip_scan) { 429 if (clip_scan) {
430 src_alpha = clip_scan[col] * src_alpha / 255; 430 src_alpha = clip_scan[col] * src_alpha / 255;
431 } 431 }
432 if (src_alpha == 0) { 432 if (src_alpha == 0) {
433 dest_scan ++; 433 dest_scan ++;
434 dst_alpha_scan ++; 434 dst_alpha_scan ++;
435 src_scan += 3; 435 src_scan += 3;
436 continue; 436 continue;
437 } 437 }
438 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 438 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
439 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 439 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
440 FX_BYTE gray; 440 uint8_t gray;
441 if (pIccTransform) { 441 if (pIccTransform) {
442 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ; 442 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ;
443 } else { 443 } else {
444 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 444 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
445 } 445 }
446 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 446 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
447 dest_scan ++; 447 dest_scan ++;
448 dst_alpha_scan++; 448 dst_alpha_scan++;
449 src_scan += 3; 449 src_scan += 3;
450 } 450 }
451 } else 451 } else
452 for (int col = 0; col < pixel_count; col ++) { 452 for (int col = 0; col < pixel_count; col ++) {
453 FX_BYTE back_alpha = *dst_alpha_scan; 453 uint8_t back_alpha = *dst_alpha_scan;
454 if (back_alpha == 0) { 454 if (back_alpha == 0) {
455 int src_alpha = src_scan[3]; 455 int src_alpha = src_scan[3];
456 if (clip_scan) { 456 if (clip_scan) {
457 src_alpha = clip_scan[col] * src_alpha / 255; 457 src_alpha = clip_scan[col] * src_alpha / 255;
458 } 458 }
459 if (src_alpha) { 459 if (src_alpha) {
460 if (pIccTransform) { 460 if (pIccTransform) {
461 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); 461 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
462 } else { 462 } else {
463 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_ scan); 463 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_ scan);
464 } 464 }
465 *dst_alpha_scan = src_alpha; 465 *dst_alpha_scan = src_alpha;
466 } 466 }
467 dest_scan ++; 467 dest_scan ++;
468 dst_alpha_scan ++; 468 dst_alpha_scan ++;
469 src_scan += 4; 469 src_scan += 4;
470 continue; 470 continue;
471 } 471 }
472 FX_BYTE src_alpha = src_scan[3]; 472 uint8_t src_alpha = src_scan[3];
473 if (clip_scan) { 473 if (clip_scan) {
474 src_alpha = clip_scan[col] * src_alpha / 255; 474 src_alpha = clip_scan[col] * src_alpha / 255;
475 } 475 }
476 if (src_alpha == 0) { 476 if (src_alpha == 0) {
477 dest_scan ++; 477 dest_scan ++;
478 dst_alpha_scan ++; 478 dst_alpha_scan ++;
479 src_scan += 4; 479 src_scan += 4;
480 continue; 480 continue;
481 } 481 }
482 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 482 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
483 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 483 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
484 FX_BYTE gray; 484 uint8_t gray;
485 if (pIccTransform) { 485 if (pIccTransform) {
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, in t pixel_count,
497 int blend_type, FX_LPCBYTE clip_scan, 497 int blend_type, FX_LPCBYTE clip_scan,
498 FX_LPCBYTE src_alpha_scan, void* pIccTransfo rm) 498 FX_LPCBYTE src_alpha_scan, void* pIccTransfo rm)
499 { 499 {
500 ICodec_IccModule* pIccModule = NULL; 500 ICodec_IccModule* pIccModule = NULL;
501 FX_BYTE 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) {
509 for (int col = 0; col < pixel_count; col ++) { 509 for (int col = 0; col < pixel_count; col ++) {
510 int src_alpha = *src_alpha_scan++; 510 int src_alpha = *src_alpha_scan++;
511 if (clip_scan) { 511 if (clip_scan) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_Bpp, int pixel_count,
588 int blend_type, FX_LPCBYTE clip_scan, 588 int blend_type, FX_LPCBYTE clip_scan,
589 void* pIccTransform) 589 void* pIccTransform)
590 { 590 {
591 ICodec_IccModule* pIccModule = NULL; 591 ICodec_IccModule* pIccModule = NULL;
592 FX_BYTE 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;
599 for (int col = 0; col < pixel_count; col ++) { 599 for (int col = 0; col < pixel_count; col ++) {
600 if (pIccTransform) { 600 if (pIccTransform) {
601 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ; 601 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ;
602 } else { 602 } else {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 int src_alpha = 255; 658 int src_alpha = 255;
659 if (clip_scan) { 659 if (clip_scan) {
660 src_alpha = clip_scan[col]; 660 src_alpha = clip_scan[col];
661 } 661 }
662 if (src_alpha == 0) { 662 if (src_alpha == 0) {
663 dest_scan ++; 663 dest_scan ++;
664 dest_alpha_scan ++; 664 dest_alpha_scan ++;
665 src_scan += src_Bpp; 665 src_scan += src_Bpp;
666 continue; 666 continue;
667 } 667 }
668 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 668 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
669 *dest_alpha_scan++ = dest_alpha; 669 *dest_alpha_scan++ = dest_alpha;
670 int alpha_ratio = src_alpha * 255 / dest_alpha; 670 int alpha_ratio = src_alpha * 255 / dest_alpha;
671 FX_BYTE gray; 671 uint8_t gray;
672 if (pIccTransform) { 672 if (pIccTransform) {
673 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ; 673 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1) ;
674 } else { 674 } else {
675 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 675 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
676 } 676 }
677 if (bNonseparableBlend) { 677 if (bNonseparableBlend) {
678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan; 678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan;
679 } 679 }
680 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray); 680 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray);
681 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 681 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
(...skipping 18 matching lines...) Expand all
700 src_scan += src_Bpp; 700 src_scan += src_Bpp;
701 continue; 701 continue;
702 } 702 }
703 if (src_alpha == 0) { 703 if (src_alpha == 0) {
704 dest_scan ++; 704 dest_scan ++;
705 dest_alpha_scan ++; 705 dest_alpha_scan ++;
706 src_scan += src_Bpp; 706 src_scan += src_Bpp;
707 continue; 707 continue;
708 } 708 }
709 int back_alpha = *dest_alpha_scan; 709 int back_alpha = *dest_alpha_scan;
710 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 710 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
711 *dest_alpha_scan++ = dest_alpha; 711 *dest_alpha_scan++ = dest_alpha;
712 int alpha_ratio = src_alpha * 255 / dest_alpha; 712 int alpha_ratio = src_alpha * 255 / dest_alpha;
713 FX_BYTE gray; 713 uint8_t gray;
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int pixel _count, int blend_type, FX_LPCBYTE clip_scan,
725 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_sca n) 725 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE src_alpha_sca n)
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 FX_BYTE 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) {
736 int src_alpha = clip_scan[col] * src_scan[3] / 255; 736 int src_alpha = clip_scan[col] * src_scan[3] / 255;
737 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff ffff) | (src_alpha << 24)); 737 FXARGB_SETDIB(dest_scan, (FXARGB_GETDIB(src_scan) & 0xff ffff) | (src_alpha << 24));
738 } else { 738 } else {
739 FXARGB_COPY(dest_scan, src_scan); 739 FXARGB_COPY(dest_scan, src_scan);
740 } 740 }
741 dest_scan += 4; 741 dest_scan += 4;
742 src_scan += 4; 742 src_scan += 4;
743 continue; 743 continue;
744 } 744 }
745 FX_BYTE src_alpha; 745 uint8_t src_alpha;
746 if (clip_scan == NULL) { 746 if (clip_scan == NULL) {
747 src_alpha = src_scan[3]; 747 src_alpha = src_scan[3];
748 } else { 748 } else {
749 src_alpha = clip_scan[col] * src_scan[3] / 255; 749 src_alpha = clip_scan[col] * src_scan[3] / 255;
750 } 750 }
751 if (src_alpha == 0) { 751 if (src_alpha == 0) {
752 dest_scan += 4; 752 dest_scan += 4;
753 src_scan += 4; 753 src_scan += 4;
754 continue; 754 continue;
755 } 755 }
756 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 756 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
757 dest_scan[3] = dest_alpha; 757 dest_scan[3] = dest_alpha;
758 int alpha_ratio = src_alpha * 255 / dest_alpha; 758 int alpha_ratio = src_alpha * 255 / dest_alpha;
759 if (bNonseparableBlend) { 759 if (bNonseparableBlend) {
760 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 760 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
761 } 761 }
762 for (int color = 0; color < 3; color ++) { 762 for (int color = 0; color < 3; color ++) {
763 if (blend_type) { 763 if (blend_type) {
764 int blended = bNonseparableBlend ? blended_colors[color] : 764 int blended = bNonseparableBlend ? blended_colors[color] :
765 _BLEND(blend_type, *dest_scan, *src_scan); 765 _BLEND(blend_type, *dest_scan, *src_scan);
766 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha); 766 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha);
767 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio); 767 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio);
768 } else { 768 } else {
769 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio); 769 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio);
770 } 770 }
771 dest_scan ++; 771 dest_scan ++;
772 src_scan ++; 772 src_scan ++;
773 } 773 }
774 dest_scan ++; 774 dest_scan ++;
775 src_scan ++; 775 src_scan ++;
776 } 776 }
777 } else { 777 } else {
778 for (int col = 0; col < pixel_count; col ++) { 778 for (int col = 0; col < pixel_count; col ++) {
779 FX_BYTE back_alpha = dest_scan[3]; 779 uint8_t back_alpha = dest_scan[3];
780 if (back_alpha == 0) { 780 if (back_alpha == 0) {
781 if (clip_scan) { 781 if (clip_scan) {
782 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255 ; 782 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255 ;
783 FXARGB_SETDIB(dest_scan, FXARGB_MAKE((src_alpha << 24), src_scan[2], src_scan[1], *src_scan)); 783 FXARGB_SETDIB(dest_scan, FXARGB_MAKE((src_alpha << 24), src_scan[2], src_scan[1], *src_scan));
784 } else { 784 } else {
785 FXARGB_SETDIB(dest_scan, FXARGB_MAKE((*src_alpha_scan << 24), src_scan[2], src_scan[1], *src_scan)); 785 FXARGB_SETDIB(dest_scan, FXARGB_MAKE((*src_alpha_scan << 24), src_scan[2], src_scan[1], *src_scan));
786 } 786 }
787 dest_scan += 4; 787 dest_scan += 4;
788 src_scan += 3; 788 src_scan += 3;
789 src_alpha_scan ++; 789 src_alpha_scan ++;
790 continue; 790 continue;
791 } 791 }
792 FX_BYTE src_alpha; 792 uint8_t src_alpha;
793 if (clip_scan == NULL) { 793 if (clip_scan == NULL) {
794 src_alpha = *src_alpha_scan ++; 794 src_alpha = *src_alpha_scan ++;
795 } else { 795 } else {
796 src_alpha = clip_scan[col] * (*src_alpha_scan ++) / 255; 796 src_alpha = clip_scan[col] * (*src_alpha_scan ++) / 255;
797 } 797 }
798 if (src_alpha == 0) { 798 if (src_alpha == 0) {
799 dest_scan += 4; 799 dest_scan += 4;
800 src_scan += 3; 800 src_scan += 3;
801 continue; 801 continue;
802 } 802 }
803 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 803 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
804 dest_scan[3] = dest_alpha; 804 dest_scan[3] = dest_alpha;
805 int alpha_ratio = src_alpha * 255 / dest_alpha; 805 int alpha_ratio = src_alpha * 255 / dest_alpha;
806 if (bNonseparableBlend) { 806 if (bNonseparableBlend) {
807 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 807 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
808 } 808 }
809 for (int color = 0; color < 3; color ++) { 809 for (int color = 0; color < 3; color ++) {
810 if (blend_type) { 810 if (blend_type) {
811 int blended = bNonseparableBlend ? blended_colors[color] : 811 int blended = bNonseparableBlend ? blended_colors[color] :
812 _BLEND(blend_type, *dest_scan, *src_scan); 812 _BLEND(blend_type, *dest_scan, *src_scan);
813 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha); 813 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha);
814 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio); 814 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio);
815 } else { 815 } else {
816 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio); 816 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio);
817 } 817 }
818 dest_scan ++; 818 dest_scan ++;
819 src_scan ++; 819 src_scan ++;
820 } 820 }
821 dest_scan ++; 821 dest_scan ++;
822 } 822 }
823 } 823 }
824 } else { 824 } else {
825 if (src_alpha_scan) { 825 if (src_alpha_scan) {
826 for (int col = 0; col < pixel_count; col ++) { 826 for (int col = 0; col < pixel_count; col ++) {
827 FX_BYTE back_alpha = *dest_alpha_scan; 827 uint8_t back_alpha = *dest_alpha_scan;
828 if (back_alpha == 0) { 828 if (back_alpha == 0) {
829 if (clip_scan) { 829 if (clip_scan) {
830 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255 ; 830 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255 ;
831 *dest_alpha_scan = src_alpha; 831 *dest_alpha_scan = src_alpha;
832 *dest_scan++ = *src_scan++; 832 *dest_scan++ = *src_scan++;
833 *dest_scan++ = *src_scan++; 833 *dest_scan++ = *src_scan++;
834 *dest_scan++ = *src_scan++; 834 *dest_scan++ = *src_scan++;
835 } else { 835 } else {
836 *dest_alpha_scan = *src_alpha_scan; 836 *dest_alpha_scan = *src_alpha_scan;
837 *dest_scan++ = *src_scan++; 837 *dest_scan++ = *src_scan++;
838 *dest_scan++ = *src_scan++; 838 *dest_scan++ = *src_scan++;
839 *dest_scan++ = *src_scan++; 839 *dest_scan++ = *src_scan++;
840 } 840 }
841 dest_alpha_scan ++; 841 dest_alpha_scan ++;
842 src_alpha_scan ++; 842 src_alpha_scan ++;
843 continue; 843 continue;
844 } 844 }
845 FX_BYTE src_alpha; 845 uint8_t src_alpha;
846 if (clip_scan == NULL) { 846 if (clip_scan == NULL) {
847 src_alpha = *src_alpha_scan ++; 847 src_alpha = *src_alpha_scan ++;
848 } else { 848 } else {
849 src_alpha = clip_scan[col] * (*src_alpha_scan ++) / 255; 849 src_alpha = clip_scan[col] * (*src_alpha_scan ++) / 255;
850 } 850 }
851 if (src_alpha == 0) { 851 if (src_alpha == 0) {
852 dest_scan += 3; 852 dest_scan += 3;
853 src_scan += 3; 853 src_scan += 3;
854 dest_alpha_scan ++; 854 dest_alpha_scan ++;
855 continue; 855 continue;
856 } 856 }
857 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 857 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
858 *dest_alpha_scan ++ = dest_alpha; 858 *dest_alpha_scan ++ = dest_alpha;
859 int alpha_ratio = src_alpha * 255 / dest_alpha; 859 int alpha_ratio = src_alpha * 255 / dest_alpha;
860 if (bNonseparableBlend) { 860 if (bNonseparableBlend) {
861 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 861 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
862 } 862 }
863 for (int color = 0; color < 3; color ++) { 863 for (int color = 0; color < 3; color ++) {
864 if (blend_type) { 864 if (blend_type) {
865 int blended = bNonseparableBlend ? blended_colors[color] : 865 int blended = bNonseparableBlend ? blended_colors[color] :
866 _BLEND(blend_type, *dest_scan, *src_scan); 866 _BLEND(blend_type, *dest_scan, *src_scan);
867 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha); 867 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha);
868 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio); 868 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alph a_ratio);
869 } else { 869 } else {
870 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio); 870 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, al pha_ratio);
871 } 871 }
872 dest_scan ++; 872 dest_scan ++;
873 src_scan ++; 873 src_scan ++;
874 } 874 }
875 } 875 }
876 } else { 876 } else {
877 for (int col = 0; col < pixel_count; col ++) { 877 for (int col = 0; col < pixel_count; col ++) {
878 FX_BYTE back_alpha = *dest_alpha_scan; 878 uint8_t back_alpha = *dest_alpha_scan;
879 if (back_alpha == 0) { 879 if (back_alpha == 0) {
880 if (clip_scan) { 880 if (clip_scan) {
881 int src_alpha = clip_scan[col] * src_scan[3] / 255; 881 int src_alpha = clip_scan[col] * src_scan[3] / 255;
882 *dest_alpha_scan = src_alpha; 882 *dest_alpha_scan = src_alpha;
883 *dest_scan++ = *src_scan++; 883 *dest_scan++ = *src_scan++;
884 *dest_scan++ = *src_scan++; 884 *dest_scan++ = *src_scan++;
885 *dest_scan++ = *src_scan++; 885 *dest_scan++ = *src_scan++;
886 } else { 886 } else {
887 *dest_alpha_scan = src_scan[3]; 887 *dest_alpha_scan = src_scan[3];
888 *dest_scan++ = *src_scan++; 888 *dest_scan++ = *src_scan++;
889 *dest_scan++ = *src_scan++; 889 *dest_scan++ = *src_scan++;
890 *dest_scan++ = *src_scan++; 890 *dest_scan++ = *src_scan++;
891 } 891 }
892 dest_alpha_scan ++; 892 dest_alpha_scan ++;
893 src_scan ++; 893 src_scan ++;
894 continue; 894 continue;
895 } 895 }
896 FX_BYTE src_alpha; 896 uint8_t src_alpha;
897 if (clip_scan == NULL) { 897 if (clip_scan == NULL) {
898 src_alpha = src_scan[3]; 898 src_alpha = src_scan[3];
899 } else { 899 } else {
900 src_alpha = clip_scan[col] * src_scan[3] / 255; 900 src_alpha = clip_scan[col] * src_scan[3] / 255;
901 } 901 }
902 if (src_alpha == 0) { 902 if (src_alpha == 0) {
903 dest_scan += 3; 903 dest_scan += 3;
904 src_scan += 4; 904 src_scan += 4;
905 dest_alpha_scan ++; 905 dest_alpha_scan ++;
906 continue; 906 continue;
907 } 907 }
908 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 908 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
909 *dest_alpha_scan++ = dest_alpha; 909 *dest_alpha_scan++ = dest_alpha;
910 int alpha_ratio = src_alpha * 255 / dest_alpha; 910 int alpha_ratio = src_alpha * 255 / dest_alpha;
911 if (bNonseparableBlend) { 911 if (bNonseparableBlend) {
912 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 912 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
913 } 913 }
914 for (int color = 0; color < 3; color ++) { 914 for (int color = 0; color < 3; color ++) {
915 if (blend_type) { 915 if (blend_type) {
916 int blended = bNonseparableBlend ? blended_colors[color] : 916 int blended = bNonseparableBlend ? blended_colors[color] :
917 _BLEND(blend_type, *dest_scan, *src_scan); 917 _BLEND(blend_type, *dest_scan, *src_scan);
918 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha); 918 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alp ha);
(...skipping 10 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca n, int width, int blend_type, int src_Bpp,
932 FX_LPBYTE dest_alpha_scan) 932 FX_LPBYTE 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 FX_BYTE 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 ));
943 } else { 943 } else {
944 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0])); 944 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_ scan[1], src_scan[0]));
945 } 945 }
946 dest_scan += 4; 946 dest_scan += 4;
947 src_scan += src_Bpp; 947 src_scan += src_Bpp;
948 continue; 948 continue;
949 } 949 }
950 dest_scan[3] = 0xff; 950 dest_scan[3] = 0xff;
951 if (bNonseparableBlend) { 951 if (bNonseparableBlend) {
952 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 952 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
953 } 953 }
954 for (int color = 0; color < 3; color ++) { 954 for (int color = 0; color < 3; color ++) {
955 int src_color = *src_scan; 955 int src_color = *src_scan;
956 int blended = bNonseparableBlend ? blended_colors[color] : 956 int blended = bNonseparableBlend ? blended_colors[color] :
957 _BLEND(blend_type, *dest_scan, src_color); 957 _BLEND(blend_type, *dest_scan, src_color);
958 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); 958 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
959 dest_scan ++; 959 dest_scan ++;
960 src_scan ++; 960 src_scan ++;
961 } 961 }
962 dest_scan ++; 962 dest_scan ++;
963 src_scan += src_gap; 963 src_scan += src_gap;
964 } 964 }
965 } else { 965 } else {
966 for (int col = 0; col < width; col ++) { 966 for (int col = 0; col < width; col ++) {
967 FX_BYTE back_alpha = *dest_alpha_scan; 967 uint8_t back_alpha = *dest_alpha_scan;
968 if (back_alpha == 0) { 968 if (back_alpha == 0) {
969 *dest_scan++ = *src_scan++; 969 *dest_scan++ = *src_scan++;
970 *dest_scan++ = *src_scan++; 970 *dest_scan++ = *src_scan++;
971 *dest_scan++ = *src_scan++; 971 *dest_scan++ = *src_scan++;
972 *dest_alpha_scan++ = 0xff; 972 *dest_alpha_scan++ = 0xff;
973 src_scan += src_gap; 973 src_scan += src_gap;
974 continue; 974 continue;
975 } 975 }
976 *dest_alpha_scan++ = 0xff; 976 *dest_alpha_scan++ = 0xff;
977 if (bNonseparableBlend) { 977 if (bNonseparableBlend) {
(...skipping 13 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE sr c_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_scan,
993 FX_LPBYTE dest_alpha_scan) 993 FX_LPBYTE 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 FX_BYTE 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++;
1004 *dest_scan++ = *src_scan++; 1004 *dest_scan++ = *src_scan++;
1005 *dest_scan++ = *src_scan++; 1005 *dest_scan++ = *src_scan++;
1006 src_scan += src_gap; 1006 src_scan += src_gap;
1007 dest_scan ++; 1007 dest_scan ++;
1008 continue; 1008 continue;
1009 } 1009 }
1010 if (src_alpha == 0) { 1010 if (src_alpha == 0) {
1011 dest_scan += 4; 1011 dest_scan += 4;
1012 src_scan += src_Bpp; 1012 src_scan += src_Bpp;
1013 continue; 1013 continue;
1014 } 1014 }
1015 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1015 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1016 dest_scan[3] = dest_alpha; 1016 dest_scan[3] = dest_alpha;
1017 int alpha_ratio = src_alpha * 255 / dest_alpha; 1017 int alpha_ratio = src_alpha * 255 / dest_alpha;
1018 if (bNonseparableBlend) { 1018 if (bNonseparableBlend) {
1019 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 1019 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
1020 } 1020 }
1021 for (int color = 0; color < 3; color ++) { 1021 for (int color = 0; color < 3; color ++) {
1022 int src_color = *src_scan; 1022 int src_color = *src_scan;
1023 int blended = bNonseparableBlend ? blended_colors[color] : 1023 int blended = bNonseparableBlend ? blended_colors[color] :
1024 _BLEND(blend_type, *dest_scan, src_color); 1024 _BLEND(blend_type, *dest_scan, src_color);
1025 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); 1025 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha);
1026 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio) ; 1026 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio) ;
1027 dest_scan ++; 1027 dest_scan ++;
1028 src_scan ++; 1028 src_scan ++;
1029 } 1029 }
1030 dest_scan ++; 1030 dest_scan ++;
1031 src_scan += src_gap; 1031 src_scan += src_gap;
1032 } 1032 }
1033 } else { 1033 } else {
1034 for (int col = 0; col < width; col ++) { 1034 for (int col = 0; col < width; col ++) {
1035 int src_alpha = *clip_scan ++; 1035 int src_alpha = *clip_scan ++;
1036 FX_BYTE back_alpha = *dest_alpha_scan; 1036 uint8_t back_alpha = *dest_alpha_scan;
1037 if (back_alpha == 0) { 1037 if (back_alpha == 0) {
1038 *dest_scan++ = *src_scan++; 1038 *dest_scan++ = *src_scan++;
1039 *dest_scan++ = *src_scan++; 1039 *dest_scan++ = *src_scan++;
1040 *dest_scan++ = *src_scan++; 1040 *dest_scan++ = *src_scan++;
1041 src_scan += src_gap; 1041 src_scan += src_gap;
1042 dest_alpha_scan++; 1042 dest_alpha_scan++;
1043 continue; 1043 continue;
1044 } 1044 }
1045 if (src_alpha == 0) { 1045 if (src_alpha == 0) {
1046 dest_scan += 3; 1046 dest_scan += 3;
1047 dest_alpha_scan++; 1047 dest_alpha_scan++;
1048 src_scan += src_Bpp; 1048 src_scan += src_Bpp;
1049 continue; 1049 continue;
1050 } 1050 }
1051 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1051 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1052 *dest_alpha_scan++ = dest_alpha; 1052 *dest_alpha_scan++ = dest_alpha;
1053 int alpha_ratio = src_alpha * 255 / dest_alpha; 1053 int alpha_ratio = src_alpha * 255 / dest_alpha;
1054 if (bNonseparableBlend) { 1054 if (bNonseparableBlend) {
1055 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 1055 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
1056 } 1056 }
1057 for (int color = 0; color < 3; color ++) { 1057 for (int color = 0; color < 3; color ++) {
1058 int src_color = *src_scan; 1058 int src_color = *src_scan;
1059 int blended = bNonseparableBlend ? blended_colors[color] : 1059 int blended = bNonseparableBlend ? blended_colors[color] :
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);
(...skipping 19 matching lines...) Expand all
1081 *dest_scan++ = 255; 1081 *dest_scan++ = 255;
1082 src_scan += src_gap; 1082 src_scan += src_gap;
1083 continue; 1083 continue;
1084 } 1084 }
1085 if (src_alpha == 0) { 1085 if (src_alpha == 0) {
1086 dest_scan += 4; 1086 dest_scan += 4;
1087 src_scan += src_Bpp; 1087 src_scan += src_Bpp;
1088 continue; 1088 continue;
1089 } 1089 }
1090 int back_alpha = dest_scan[3]; 1090 int back_alpha = dest_scan[3];
1091 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1091 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1092 dest_scan[3] = dest_alpha; 1092 dest_scan[3] = dest_alpha;
1093 int alpha_ratio = src_alpha * 255 / dest_alpha; 1093 int alpha_ratio = src_alpha * 255 / dest_alpha;
1094 for (int color = 0; color < 3; color ++) { 1094 for (int color = 0; color < 3; color ++) {
1095 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_rati o); 1095 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_rati o);
1096 dest_scan ++; 1096 dest_scan ++;
1097 src_scan ++; 1097 src_scan ++;
1098 } 1098 }
1099 dest_scan ++; 1099 dest_scan ++;
1100 src_scan += src_gap; 1100 src_scan += src_gap;
1101 } 1101 }
1102 } else { 1102 } else {
1103 for (int col = 0; col < width; col ++) { 1103 for (int col = 0; col < width; col ++) {
1104 int src_alpha = clip_scan[col]; 1104 int src_alpha = clip_scan[col];
1105 if (src_alpha == 255) { 1105 if (src_alpha == 255) {
1106 *dest_scan++ = *src_scan++; 1106 *dest_scan++ = *src_scan++;
1107 *dest_scan++ = *src_scan++; 1107 *dest_scan++ = *src_scan++;
1108 *dest_scan++ = *src_scan++; 1108 *dest_scan++ = *src_scan++;
1109 *dest_alpha_scan++ = 255; 1109 *dest_alpha_scan++ = 255;
1110 src_scan += src_gap; 1110 src_scan += src_gap;
1111 continue; 1111 continue;
1112 } 1112 }
1113 if (src_alpha == 0) { 1113 if (src_alpha == 0) {
1114 dest_scan += 3; 1114 dest_scan += 3;
1115 dest_alpha_scan ++; 1115 dest_alpha_scan ++;
1116 src_scan += src_Bpp; 1116 src_scan += src_Bpp;
1117 continue; 1117 continue;
1118 } 1118 }
1119 int back_alpha = *dest_alpha_scan; 1119 int back_alpha = *dest_alpha_scan;
1120 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1120 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1121 *dest_alpha_scan ++ = dest_alpha; 1121 *dest_alpha_scan ++ = dest_alpha;
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 }
(...skipping 23 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_sca n, int width, int blend_type, int dest_Bpp, FX_LPCBYTE clip_scan,
1157 FX_LPCBYTE src_alpha_scan) 1157 FX_LPCBYTE 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 FX_BYTE 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 {
1168 src_alpha = src_scan[3]; 1168 src_alpha = src_scan[3];
1169 } 1169 }
1170 if (src_alpha == 0) { 1170 if (src_alpha == 0) {
1171 dest_scan += dest_Bpp; 1171 dest_scan += dest_Bpp;
1172 src_scan += 4; 1172 src_scan += 4;
1173 continue; 1173 continue;
1174 } 1174 }
1175 if (bNonseparableBlend) { 1175 if (bNonseparableBlend) {
1176 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 1176 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
1177 } 1177 }
1178 for (int color = 0; color < 3; color ++) { 1178 for (int color = 0; color < 3; color ++) {
1179 int back_color = *dest_scan; 1179 int back_color = *dest_scan;
1180 int blended = bNonseparableBlend ? blended_colors[color] : 1180 int blended = bNonseparableBlend ? blended_colors[color] :
1181 _BLEND(blend_type, back_color, *src_scan); 1181 _BLEND(blend_type, back_color, *src_scan);
1182 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); 1182 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha);
1183 dest_scan ++; 1183 dest_scan ++;
1184 src_scan ++; 1184 src_scan ++;
1185 } 1185 }
1186 dest_scan += dest_gap; 1186 dest_scan += dest_gap;
1187 src_scan ++; 1187 src_scan ++;
1188 } 1188 }
1189 } else { 1189 } else {
1190 for (int col = 0; col < width; col ++) { 1190 for (int col = 0; col < width; col ++) {
1191 FX_BYTE src_alpha; 1191 uint8_t src_alpha;
1192 if (clip_scan) { 1192 if (clip_scan) {
1193 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; 1193 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
1194 } else { 1194 } else {
1195 src_alpha = *src_alpha_scan++; 1195 src_alpha = *src_alpha_scan++;
1196 } 1196 }
1197 if (src_alpha == 0) { 1197 if (src_alpha == 0) {
1198 dest_scan += dest_Bpp; 1198 dest_scan += dest_Bpp;
1199 src_scan += 3; 1199 src_scan += 3;
1200 continue; 1200 continue;
1201 } 1201 }
(...skipping 11 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_s can, int width, int dest_Bpp, FX_LPCBYTE clip_scan,
1218 FX_LPCBYTE src_alpha_scan) 1218 FX_LPCBYTE 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 FX_BYTE 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 }
1229 if (src_alpha == 255) { 1229 if (src_alpha == 255) {
1230 *dest_scan++ = *src_scan++; 1230 *dest_scan++ = *src_scan++;
1231 *dest_scan++ = *src_scan++; 1231 *dest_scan++ = *src_scan++;
1232 *dest_scan++ = *src_scan++; 1232 *dest_scan++ = *src_scan++;
1233 dest_scan += dest_gap; 1233 dest_scan += dest_gap;
1234 src_scan ++; 1234 src_scan ++;
1235 continue; 1235 continue;
1236 } 1236 }
1237 if (src_alpha == 0) { 1237 if (src_alpha == 0) {
1238 dest_scan += dest_Bpp; 1238 dest_scan += dest_Bpp;
1239 src_scan += 4; 1239 src_scan += 4;
1240 continue; 1240 continue;
1241 } 1241 }
1242 for (int color = 0; color < 3; color ++) { 1242 for (int color = 0; color < 3; color ++) {
1243 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha) ; 1243 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha) ;
1244 dest_scan ++; 1244 dest_scan ++;
1245 src_scan ++; 1245 src_scan ++;
1246 } 1246 }
1247 dest_scan += dest_gap; 1247 dest_scan += dest_gap;
1248 src_scan ++; 1248 src_scan ++;
1249 } 1249 }
1250 } else { 1250 } else {
1251 for (int col = 0; col < width; col ++) { 1251 for (int col = 0; col < width; col ++) {
1252 FX_BYTE src_alpha; 1252 uint8_t src_alpha;
1253 if (clip_scan) { 1253 if (clip_scan) {
1254 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; 1254 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
1255 } else { 1255 } else {
1256 src_alpha = *src_alpha_scan++; 1256 src_alpha = *src_alpha_scan++;
1257 } 1257 }
1258 if (src_alpha == 255) { 1258 if (src_alpha == 255) {
1259 *dest_scan++ = *src_scan++; 1259 *dest_scan++ = *src_scan++;
1260 *dest_scan++ = *src_scan++; 1260 *dest_scan++ = *src_scan++;
1261 *dest_scan++ = *src_scan++; 1261 *dest_scan++ = *src_scan++;
1262 dest_scan += dest_gap; 1262 dest_scan += dest_gap;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(FX_LPBYTE dest_scan, FX_LPCBYTE src _scan, int width, int blend_type, int dest_Bpp, int src_Bpp, FX_LPCBYTE clip_sca n)
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 FX_BYTE 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;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); 1389 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1);
1390 dp[3] = src_scan[3]; 1390 dp[3] = src_scan[3];
1391 src_scan += 4; 1391 src_scan += 4;
1392 dp += 4; 1392 dp += 4;
1393 } 1393 }
1394 } else { 1394 } else {
1395 int blended_colors[3]; 1395 int blended_colors[3];
1396 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1396 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1397 for (int col = 0; col < pixel_count; col ++) { 1397 for (int col = 0; col < pixel_count; col ++) {
1398 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src _scan, 1); 1398 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src _scan, 1);
1399 FX_BYTE back_alpha = *dest_alpha_scan; 1399 uint8_t back_alpha = *dest_alpha_scan;
1400 if (back_alpha == 0) { 1400 if (back_alpha == 0) {
1401 if (clip_scan) { 1401 if (clip_scan) {
1402 int src_alpha = clip_scan[col] * src_scan[3] / 255; 1402 int src_alpha = clip_scan[col] * src_scan[3] / 255;
1403 *dest_alpha_scan = src_alpha; 1403 *dest_alpha_scan = src_alpha;
1404 *dest_scan++ = *src_cache_scan++; 1404 *dest_scan++ = *src_cache_scan++;
1405 *dest_scan++ = *src_cache_scan++; 1405 *dest_scan++ = *src_cache_scan++;
1406 *dest_scan++ = *src_cache_scan++; 1406 *dest_scan++ = *src_cache_scan++;
1407 } else { 1407 } else {
1408 *dest_alpha_scan = src_scan[3]; 1408 *dest_alpha_scan = src_scan[3];
1409 *dest_scan++ = *src_cache_scan++; 1409 *dest_scan++ = *src_cache_scan++;
1410 *dest_scan++ = *src_cache_scan++; 1410 *dest_scan++ = *src_cache_scan++;
1411 *dest_scan++ = *src_cache_scan++; 1411 *dest_scan++ = *src_cache_scan++;
1412 } 1412 }
1413 dest_alpha_scan ++; 1413 dest_alpha_scan ++;
1414 src_scan += 4; 1414 src_scan += 4;
1415 continue; 1415 continue;
1416 } 1416 }
1417 FX_BYTE src_alpha; 1417 uint8_t src_alpha;
1418 if (clip_scan == NULL) { 1418 if (clip_scan == NULL) {
1419 src_alpha = src_scan[3]; 1419 src_alpha = src_scan[3];
1420 } else { 1420 } else {
1421 src_alpha = clip_scan[col] * src_scan[3] / 255; 1421 src_alpha = clip_scan[col] * src_scan[3] / 255;
1422 } 1422 }
1423 src_scan += 4; 1423 src_scan += 4;
1424 if (src_alpha == 0) { 1424 if (src_alpha == 0) {
1425 dest_scan += 3; 1425 dest_scan += 3;
1426 src_cache_scan += 3; 1426 src_cache_scan += 3;
1427 dest_alpha_scan ++; 1427 dest_alpha_scan ++;
1428 continue; 1428 continue;
1429 } 1429 }
1430 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 1430 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
1431 *dest_alpha_scan ++ = dest_alpha; 1431 *dest_alpha_scan ++ = dest_alpha;
1432 int alpha_ratio = src_alpha * 255 / dest_alpha; 1432 int alpha_ratio = src_alpha * 255 / dest_alpha;
1433 if (bNonseparableBlend) { 1433 if (bNonseparableBlend) {
1434 _RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_co lors); 1434 _RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_co lors);
1435 } 1435 }
1436 for (int color = 0; color < 3; color ++) { 1436 for (int color = 0; color < 3; color ++) {
1437 if (blend_type) { 1437 if (blend_type) {
1438 int blended = bNonseparableBlend ? blended_colors[color] : 1438 int blended = bNonseparableBlend ? blended_colors[color] :
1439 _BLEND(blend_type, *dest_scan, *src_cache_ scan); 1439 _BLEND(blend_type, *dest_scan, *src_cache_ scan);
1440 blended = FXDIB_ALPHA_MERGE(*src_cache_scan, blended, ba ck_alpha); 1440 blended = FXDIB_ALPHA_MERGE(*src_cache_scan, blended, ba ck_alpha);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
1530 FX_BYTE src_alpha; 1530 uint8_t src_alpha;
1531 if (clip_scan) { 1531 if (clip_scan) {
1532 src_alpha = src_scan[3] * (*clip_scan++) / 255; 1532 src_alpha = src_scan[3] * (*clip_scan++) / 255;
1533 } else { 1533 } else {
1534 src_alpha = src_scan[3]; 1534 src_alpha = src_scan[3];
1535 } 1535 }
1536 src_scan += 4; 1536 src_scan += 4;
1537 if (src_alpha == 0) { 1537 if (src_alpha == 0) {
1538 dest_scan += dest_Bpp; 1538 dest_scan += dest_Bpp;
1539 src_cache_scan += 3; 1539 src_cache_scan += 3;
1540 continue; 1540 continue;
(...skipping 18 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPC BYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan,
1560 FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform ) 1560 FX_LPCBYTE src_alpha_scan, FX_LPBYTE src_cache_scan, void* pIccTransform )
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 FX_BYTE src_alpha; 1569 uint8_t src_alpha;
1570 if (clip_scan) { 1570 if (clip_scan) {
1571 src_alpha = src_scan[3] * (*clip_scan++) / 255; 1571 src_alpha = src_scan[3] * (*clip_scan++) / 255;
1572 } else { 1572 } else {
1573 src_alpha = src_scan[3]; 1573 src_alpha = src_scan[3];
1574 } 1574 }
1575 src_scan += 4; 1575 src_scan += 4;
1576 if (src_alpha == 255) { 1576 if (src_alpha == 255) {
1577 *dest_scan++ = *src_cache_scan++; 1577 *dest_scan++ = *src_cache_scan++;
1578 *dest_scan++ = *src_cache_scan++; 1578 *dest_scan++ = *src_cache_scan++;
1579 *dest_scan++ = *src_cache_scan++; 1579 *dest_scan++ = *src_cache_scan++;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, FX_LPCBYTE pPalette, int pixel_count,
1664 int blend_type, FX_LPCBYTE clip_scan, 1664 int blend_type, FX_LPCBYTE clip_scan,
1665 FX_LPCBYTE src_alpha_scan) 1665 FX_LPCBYTE 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 FX_BYTE 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;
1676 } 1676 }
1677 if (bNonseparableBlend) { 1677 if (bNonseparableBlend) {
1678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1678 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1679 } 1679 }
1680 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 1680 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
1681 if (src_alpha) { 1681 if (src_alpha) {
1682 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 1682 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
1683 } else { 1683 } else {
1684 *dest_scan = gray; 1684 *dest_scan = gray;
1685 } 1685 }
1686 dest_scan ++; 1686 dest_scan ++;
1687 src_scan ++; 1687 src_scan ++;
1688 } 1688 }
1689 return; 1689 return;
1690 } 1690 }
1691 for (int col = 0; col < pixel_count; col ++) { 1691 for (int col = 0; col < pixel_count; col ++) {
1692 FX_BYTE gray = pPalette[*src_scan]; 1692 uint8_t gray = pPalette[*src_scan];
1693 int src_alpha = *src_alpha_scan++; 1693 int src_alpha = *src_alpha_scan++;
1694 if (clip_scan) { 1694 if (clip_scan) {
1695 src_alpha = clip_scan[col] * src_alpha / 255; 1695 src_alpha = clip_scan[col] * src_alpha / 255;
1696 } 1696 }
1697 if (src_alpha) { 1697 if (src_alpha) {
1698 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 1698 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
1699 } else { 1699 } else {
1700 *dest_scan = gray; 1700 *dest_scan = gray;
1701 } 1701 }
1702 dest_scan ++; 1702 dest_scan ++;
1703 src_scan ++; 1703 src_scan ++;
1704 } 1704 }
1705 } else { 1705 } else {
1706 if (blend_type) { 1706 if (blend_type) {
1707 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1707 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1708 int blended_color; 1708 int blended_color;
1709 for (int col = 0; col < pixel_count; col ++) { 1709 for (int col = 0; col < pixel_count; col ++) {
1710 FX_BYTE gray = pPalette[*src_scan]; 1710 uint8_t gray = pPalette[*src_scan];
1711 if (bNonseparableBlend) { 1711 if (bNonseparableBlend) {
1712 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1712 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1713 } 1713 }
1714 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 1714 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
1715 if (clip_scan && clip_scan[col] < 255) { 1715 if (clip_scan && clip_scan[col] < 255) {
1716 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c ol]); 1716 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[c ol]);
1717 } else { 1717 } else {
1718 *dest_scan = gray; 1718 *dest_scan = gray;
1719 } 1719 }
1720 dest_scan ++; 1720 dest_scan ++;
1721 src_scan ++; 1721 src_scan ++;
1722 } 1722 }
1723 return; 1723 return;
1724 } 1724 }
1725 for (int col = 0; col < pixel_count; col ++) { 1725 for (int col = 0; col < pixel_count; col ++) {
1726 FX_BYTE gray = pPalette[*src_scan]; 1726 uint8_t gray = pPalette[*src_scan];
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan , FX_LPCBYTE pPalette, int pixel_count,
1738 int blend_type, FX_LPCBYTE clip_scan, 1738 int blend_type, FX_LPCBYTE clip_scan,
1739 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr c_alpha_scan) 1739 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr c_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 FX_BYTE gray = pPalette[*src_scan]; 1746 uint8_t gray = pPalette[*src_scan];
1747 src_scan ++; 1747 src_scan ++;
1748 FX_BYTE back_alpha = *dest_alpha_scan; 1748 uint8_t back_alpha = *dest_alpha_scan;
1749 if (back_alpha == 0) { 1749 if (back_alpha == 0) {
1750 int src_alpha = *src_alpha_scan ++; 1750 int src_alpha = *src_alpha_scan ++;
1751 if (clip_scan) { 1751 if (clip_scan) {
1752 src_alpha = clip_scan[col] * src_alpha / 255; 1752 src_alpha = clip_scan[col] * src_alpha / 255;
1753 } 1753 }
1754 if (src_alpha) { 1754 if (src_alpha) {
1755 *dest_scan = gray; 1755 *dest_scan = gray;
1756 *dest_alpha_scan = src_alpha; 1756 *dest_alpha_scan = src_alpha;
1757 } 1757 }
1758 dest_scan ++; 1758 dest_scan ++;
1759 dest_alpha_scan ++; 1759 dest_alpha_scan ++;
1760 continue; 1760 continue;
1761 } 1761 }
1762 FX_BYTE src_alpha = *src_alpha_scan++; 1762 uint8_t src_alpha = *src_alpha_scan++;
1763 if (clip_scan) { 1763 if (clip_scan) {
1764 src_alpha = clip_scan[col] * src_alpha / 255; 1764 src_alpha = clip_scan[col] * src_alpha / 255;
1765 } 1765 }
1766 if (src_alpha == 0) { 1766 if (src_alpha == 0) {
1767 dest_scan ++; 1767 dest_scan ++;
1768 dest_alpha_scan ++; 1768 dest_alpha_scan ++;
1769 continue; 1769 continue;
1770 } 1770 }
1771 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alp ha / 255; 1771 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alp ha / 255;
1772 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); 1772 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
1773 if (bNonseparableBlend) { 1773 if (bNonseparableBlend) {
1774 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1774 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1775 } 1775 }
1776 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 1776 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
1777 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 1777 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
1778 dest_alpha_scan ++; 1778 dest_alpha_scan ++;
1779 dest_scan ++; 1779 dest_scan ++;
1780 } 1780 }
1781 return; 1781 return;
1782 } 1782 }
1783 for (int col = 0; col < pixel_count; col ++) { 1783 for (int col = 0; col < pixel_count; col ++) {
1784 FX_BYTE gray = pPalette[*src_scan]; 1784 uint8_t gray = pPalette[*src_scan];
1785 src_scan ++; 1785 src_scan ++;
1786 FX_BYTE back_alpha = *dest_alpha_scan; 1786 uint8_t back_alpha = *dest_alpha_scan;
1787 if (back_alpha == 0) { 1787 if (back_alpha == 0) {
1788 int src_alpha = *src_alpha_scan ++; 1788 int src_alpha = *src_alpha_scan ++;
1789 if (clip_scan) { 1789 if (clip_scan) {
1790 src_alpha = clip_scan[col] * src_alpha / 255; 1790 src_alpha = clip_scan[col] * src_alpha / 255;
1791 } 1791 }
1792 if (src_alpha) { 1792 if (src_alpha) {
1793 *dest_scan = gray; 1793 *dest_scan = gray;
1794 *dest_alpha_scan = src_alpha; 1794 *dest_alpha_scan = src_alpha;
1795 } 1795 }
1796 dest_scan ++; 1796 dest_scan ++;
1797 dest_alpha_scan ++; 1797 dest_alpha_scan ++;
1798 continue; 1798 continue;
1799 } 1799 }
1800 FX_BYTE src_alpha = *src_alpha_scan++; 1800 uint8_t src_alpha = *src_alpha_scan++;
1801 if (clip_scan) { 1801 if (clip_scan) {
1802 src_alpha = clip_scan[col] * src_alpha / 255; 1802 src_alpha = clip_scan[col] * src_alpha / 255;
1803 } 1803 }
1804 if (src_alpha == 0) { 1804 if (src_alpha == 0) {
1805 dest_scan ++; 1805 dest_scan ++;
1806 dest_alpha_scan ++; 1806 dest_alpha_scan ++;
1807 continue; 1807 continue;
1808 } 1808 }
1809 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1809 *dest_alpha_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1810 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); 1810 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan);
1811 dest_alpha_scan ++; 1811 dest_alpha_scan ++;
1812 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 1812 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
1813 dest_scan ++; 1813 dest_scan ++;
1814 } 1814 }
1815 } else { 1815 } else {
1816 if (blend_type) { 1816 if (blend_type) {
1817 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 1817 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
1818 int blended_color; 1818 int blended_color;
1819 for (int col = 0; col < pixel_count; col ++) { 1819 for (int col = 0; col < pixel_count; col ++) {
1820 FX_BYTE gray = pPalette[*src_scan]; 1820 uint8_t gray = pPalette[*src_scan];
1821 src_scan ++; 1821 src_scan ++;
1822 if (clip_scan == NULL || clip_scan[col] == 255) { 1822 if (clip_scan == NULL || clip_scan[col] == 255) {
1823 *dest_scan++ = gray; 1823 *dest_scan++ = gray;
1824 *dest_alpha_scan++ = 255; 1824 *dest_alpha_scan++ = 255;
1825 continue; 1825 continue;
1826 } 1826 }
1827 int src_alpha = clip_scan[col]; 1827 int src_alpha = clip_scan[col];
1828 if (src_alpha == 0) { 1828 if (src_alpha == 0) {
1829 dest_scan ++; 1829 dest_scan ++;
1830 dest_alpha_scan ++; 1830 dest_alpha_scan ++;
1831 continue; 1831 continue;
1832 } 1832 }
1833 int back_alpha = *dest_alpha_scan; 1833 int back_alpha = *dest_alpha_scan;
1834 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255; 1834 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_a lpha / 255;
1835 *dest_alpha_scan ++ = dest_alpha; 1835 *dest_alpha_scan ++ = dest_alpha;
1836 int alpha_ratio = src_alpha * 255 / dest_alpha; 1836 int alpha_ratio = src_alpha * 255 / dest_alpha;
1837 if (bNonseparableBlend) { 1837 if (bNonseparableBlend) {
1838 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 1838 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
1839 } 1839 }
1840 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray); 1840 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, * dest_scan, gray);
1841 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 1841 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
1842 dest_scan ++; 1842 dest_scan ++;
1843 } 1843 }
1844 return; 1844 return;
1845 } 1845 }
1846 for (int col = 0; col < pixel_count; col ++) { 1846 for (int col = 0; col < pixel_count; col ++) {
1847 FX_BYTE gray = pPalette[*src_scan]; 1847 uint8_t gray = pPalette[*src_scan];
1848 src_scan ++; 1848 src_scan ++;
1849 if (clip_scan == NULL || clip_scan[col] == 255) { 1849 if (clip_scan == NULL || clip_scan[col] == 255) {
1850 *dest_scan++ = gray; 1850 *dest_scan++ = gray;
1851 *dest_alpha_scan++ = 255; 1851 *dest_alpha_scan++ = 255;
1852 continue; 1852 continue;
1853 } 1853 }
1854 int src_alpha = clip_scan[col]; 1854 int src_alpha = clip_scan[col];
1855 if (src_alpha == 0) { 1855 if (src_alpha == 0) {
1856 dest_scan ++; 1856 dest_scan ++;
1857 dest_alpha_scan ++; 1857 dest_alpha_scan ++;
1858 continue; 1858 continue;
1859 } 1859 }
1860 int back_alpha = *dest_alpha_scan; 1860 int back_alpha = *dest_alpha_scan;
1861 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left,
1870 FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE clip_scan) 1870 FX_LPCBYTE pPalette, int pixel_count, int blend_type, FX_LPCBYTE 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 FX_BYTE 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;
1881 } 1881 }
1882 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray); 1882 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray);
1883 if (clip_scan && clip_scan[col] < 255) { 1883 if (clip_scan && clip_scan[col] < 255) {
1884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]) ; 1884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]) ;
1885 } else { 1885 } else {
1886 *dest_scan = gray; 1886 *dest_scan = gray;
1887 } 1887 }
1888 dest_scan ++; 1888 dest_scan ++;
1889 } 1889 }
1890 return; 1890 return;
1891 } 1891 }
1892 for (int col = 0; col < pixel_count; col ++) { 1892 for (int col = 0; col < pixel_count; col ++) {
1893 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan , int src_left,
1903 FX_LPCBYTE pPalette, int pixel_count, in t blend_type, FX_LPCBYTE clip_scan, 1903 FX_LPCBYTE pPalette, int pixel_count, in t blend_type, FX_LPCBYTE clip_scan,
1904 FX_LPBYTE dest_alpha_scan) 1904 FX_LPBYTE 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 FX_BYTE 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;
1915 *dest_alpha_scan ++ = 255; 1915 *dest_alpha_scan ++ = 255;
1916 continue; 1916 continue;
1917 } 1917 }
1918 int src_alpha = clip_scan[col]; 1918 int src_alpha = clip_scan[col];
1919 if (src_alpha == 0) { 1919 if (src_alpha == 0) {
1920 dest_scan ++; 1920 dest_scan ++;
1921 dest_alpha_scan ++; 1921 dest_alpha_scan ++;
1922 continue; 1922 continue;
1923 } 1923 }
1924 int back_alpha = *dest_alpha_scan; 1924 int back_alpha = *dest_alpha_scan;
1925 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 1925 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
1926 *dest_alpha_scan ++ = dest_alpha; 1926 *dest_alpha_scan ++ = dest_alpha;
1927 int alpha_ratio = src_alpha * 255 / dest_alpha; 1927 int alpha_ratio = src_alpha * 255 / dest_alpha;
1928 if (bNonseparableBlend) { 1928 if (bNonseparableBlend) {
1929 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan; 1929 blended_color = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *d est_scan;
1930 } 1930 }
1931 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray); 1931 gray = bNonseparableBlend ? blended_color : _BLEND(blend_type, *dest _scan, gray);
1932 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 1932 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
1933 dest_scan ++; 1933 dest_scan ++;
1934 } 1934 }
1935 return; 1935 return;
1936 } 1936 }
1937 for (int col = 0; col < pixel_count; col ++) { 1937 for (int col = 0; col < pixel_count; col ++) {
1938 FX_BYTE gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_l eft) % 8))) ? set_gray : reset_gray; 1938 uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_l eft) % 8))) ? set_gray : reset_gray;
1939 if (clip_scan == NULL || clip_scan[col] == 255) { 1939 if (clip_scan == NULL || clip_scan[col] == 255) {
1940 *dest_scan++ = gray; 1940 *dest_scan++ = gray;
1941 *dest_alpha_scan ++ = 255; 1941 *dest_alpha_scan ++ = 255;
1942 continue; 1942 continue;
1943 } 1943 }
1944 int src_alpha = clip_scan[col]; 1944 int src_alpha = clip_scan[col];
1945 if (src_alpha == 0) { 1945 if (src_alpha == 0) {
1946 dest_scan ++; 1946 dest_scan ++;
1947 dest_alpha_scan ++; 1947 dest_alpha_scan ++;
1948 continue; 1948 continue;
1949 } 1949 }
1950 int back_alpha = *dest_alpha_scan; 1950 int back_alpha = *dest_alpha_scan;
1951 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE sr c_scan, FX_DWORD* pPalette, int pixel_count,
1959 int DestBpp, FX_LPCBYTE clip_scan, 1959 int DestBpp, FX_LPCBYTE clip_scan,
1960 FX_LPCBYTE src_alpha_scan) 1960 FX_LPCBYTE 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 ++;
1971 FX_BYTE src_alpha = 0; 1971 uint8_t src_alpha = 0;
1972 if (clip_scan) { 1972 if (clip_scan) {
1973 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; 1973 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255;
1974 } else { 1974 } else {
1975 src_alpha = *src_alpha_scan++; 1975 src_alpha = *src_alpha_scan++;
1976 } 1976 }
1977 if (src_alpha == 255) { 1977 if (src_alpha == 255) {
1978 *dest_scan++ = src_b; 1978 *dest_scan++ = src_b;
1979 *dest_scan++ = src_g; 1979 *dest_scan++ = src_g;
1980 *dest_scan++ = src_r; 1980 *dest_scan++ = src_r;
1981 dest_scan += dest_gap; 1981 dest_scan += dest_gap;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 FX_DWORD* pPalette, FX_LPCBYTE clip_scan, 2062 FX_DWORD* pPalette, FX_LPCBYTE clip_scan,
2063 FX_LPCBYTE src_alpha_scan) 2063 FX_LPCBYTE 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 FX_BYTE back_alpha = dest_scan[3]; 2072 uint8_t back_alpha = dest_scan[3];
2073 if (back_alpha == 0) { 2073 if (back_alpha == 0) {
2074 if (clip_scan) { 2074 if (clip_scan) {
2075 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; 2075 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
2076 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b)); 2076 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b));
2077 } else { 2077 } else {
2078 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(*src_alpha_scan, src_r, src_g, src_b)); 2078 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(*src_alpha_scan, src_r, src_g, src_b));
2079 } 2079 }
2080 dest_scan += 4; 2080 dest_scan += 4;
2081 src_alpha_scan ++; 2081 src_alpha_scan ++;
2082 continue; 2082 continue;
2083 } 2083 }
2084 FX_BYTE src_alpha; 2084 uint8_t src_alpha;
2085 if (clip_scan == NULL) { 2085 if (clip_scan == NULL) {
2086 src_alpha = *src_alpha_scan ++; 2086 src_alpha = *src_alpha_scan ++;
2087 } else { 2087 } else {
2088 src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255; 2088 src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
2089 } 2089 }
2090 if (src_alpha == 0) { 2090 if (src_alpha == 0) {
2091 dest_scan += 4; 2091 dest_scan += 4;
2092 continue; 2092 continue;
2093 } 2093 }
2094 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 2094 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
2095 dest_scan[3] = dest_alpha; 2095 dest_scan[3] = dest_alpha;
2096 int alpha_ratio = src_alpha * 255 / dest_alpha; 2096 int alpha_ratio = src_alpha * 255 / dest_alpha;
2097 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2097 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2098 dest_scan ++; 2098 dest_scan ++;
2099 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2099 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2100 dest_scan ++; 2100 dest_scan ++;
2101 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2101 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2102 dest_scan ++; 2102 dest_scan ++;
2103 dest_scan ++; 2103 dest_scan ++;
2104 } 2104 }
(...skipping 11 matching lines...) Expand all
2116 src_scan ++; 2116 src_scan ++;
2117 continue; 2117 continue;
2118 } 2118 }
2119 int src_alpha = clip_scan[col]; 2119 int src_alpha = clip_scan[col];
2120 if (src_alpha == 0) { 2120 if (src_alpha == 0) {
2121 dest_scan += 4; 2121 dest_scan += 4;
2122 src_scan ++; 2122 src_scan ++;
2123 continue; 2123 continue;
2124 } 2124 }
2125 int back_alpha = dest_scan[3]; 2125 int back_alpha = dest_scan[3];
2126 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 2126 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
2127 dest_scan[3] = dest_alpha; 2127 dest_scan[3] = dest_alpha;
2128 int alpha_ratio = src_alpha * 255 / dest_alpha; 2128 int alpha_ratio = src_alpha * 255 / dest_alpha;
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan , int width,
2140 FX_DWORD* pPalette, FX_LPCBYTE clip_scan , 2140 FX_DWORD* pPalette, FX_LPCBYTE clip_scan ,
2141 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr c_alpha_scan) 2141 FX_LPBYTE dest_alpha_scan, FX_LPCBYTE sr c_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 FX_BYTE back_alpha = *dest_alpha_scan; 2150 uint8_t back_alpha = *dest_alpha_scan;
2151 if (back_alpha == 0) { 2151 if (back_alpha == 0) {
2152 if (clip_scan) { 2152 if (clip_scan) {
2153 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; 2153 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255;
2154 *dest_alpha_scan ++ = src_alpha; 2154 *dest_alpha_scan ++ = src_alpha;
2155 } else { 2155 } else {
2156 *dest_alpha_scan ++ = *src_alpha_scan; 2156 *dest_alpha_scan ++ = *src_alpha_scan;
2157 } 2157 }
2158 *dest_scan ++ = src_b; 2158 *dest_scan ++ = src_b;
2159 *dest_scan ++ = src_g; 2159 *dest_scan ++ = src_g;
2160 *dest_scan ++ = src_r; 2160 *dest_scan ++ = src_r;
2161 src_alpha_scan ++; 2161 src_alpha_scan ++;
2162 continue; 2162 continue;
2163 } 2163 }
2164 FX_BYTE src_alpha; 2164 uint8_t src_alpha;
2165 if (clip_scan == NULL) { 2165 if (clip_scan == NULL) {
2166 src_alpha = *src_alpha_scan++; 2166 src_alpha = *src_alpha_scan++;
2167 } else { 2167 } else {
2168 src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255; 2168 src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255;
2169 } 2169 }
2170 if (src_alpha == 0) { 2170 if (src_alpha == 0) {
2171 dest_scan += 3; 2171 dest_scan += 3;
2172 dest_alpha_scan ++; 2172 dest_alpha_scan ++;
2173 continue; 2173 continue;
2174 } 2174 }
2175 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 2175 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
2176 *dest_alpha_scan ++ = dest_alpha; 2176 *dest_alpha_scan ++ = dest_alpha;
2177 int alpha_ratio = src_alpha * 255 / dest_alpha; 2177 int alpha_ratio = src_alpha * 255 / dest_alpha;
2178 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2178 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2179 dest_scan ++; 2179 dest_scan ++;
2180 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2180 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2181 dest_scan ++; 2181 dest_scan ++;
2182 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2182 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2183 dest_scan ++; 2183 dest_scan ++;
2184 } 2184 }
2185 } else 2185 } else
(...skipping 11 matching lines...) Expand all
2197 continue; 2197 continue;
2198 } 2198 }
2199 int src_alpha = clip_scan[col]; 2199 int src_alpha = clip_scan[col];
2200 if (src_alpha == 0) { 2200 if (src_alpha == 0) {
2201 dest_scan += 3; 2201 dest_scan += 3;
2202 dest_alpha_scan ++; 2202 dest_alpha_scan ++;
2203 src_scan ++; 2203 src_scan ++;
2204 continue; 2204 continue;
2205 } 2205 }
2206 int back_alpha = *dest_alpha_scan; 2206 int back_alpha = *dest_alpha_scan;
2207 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; 2207 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255;
2208 *dest_alpha_scan ++ = dest_alpha; 2208 *dest_alpha_scan ++ = dest_alpha;
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 }
(...skipping 26 matching lines...) Expand all
2244 *dest_scan++ = src_r; 2244 *dest_scan++ = src_r;
2245 *dest_scan++ = 255; 2245 *dest_scan++ = 255;
2246 continue; 2246 continue;
2247 } 2247 }
2248 int src_alpha = clip_scan[col]; 2248 int src_alpha = clip_scan[col];
2249 if (src_alpha == 0) { 2249 if (src_alpha == 0) {
2250 dest_scan += 4; 2250 dest_scan += 4;
2251 continue; 2251 continue;
2252 } 2252 }
2253 int back_alpha = dest_scan[3]; 2253 int back_alpha = dest_scan[3];
2254 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2254 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2255 dest_scan[3] = dest_alpha; 2255 dest_scan[3] = dest_alpha;
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 }
(...skipping 28 matching lines...) Expand all
2293 *dest_alpha_scan++ = 255; 2293 *dest_alpha_scan++ = 255;
2294 continue; 2294 continue;
2295 } 2295 }
2296 int src_alpha = clip_scan[col]; 2296 int src_alpha = clip_scan[col];
2297 if (src_alpha == 0) { 2297 if (src_alpha == 0) {
2298 dest_scan += 3; 2298 dest_scan += 3;
2299 dest_alpha_scan ++; 2299 dest_alpha_scan ++;
2300 continue; 2300 continue;
2301 } 2301 }
2302 int back_alpha = *dest_alpha_scan; 2302 int back_alpha = *dest_alpha_scan;
2303 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2303 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m ask_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, FX_LPCBYTE 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 FX_BYTE back_alpha = dest_scan[3]; 2324 uint8_t back_alpha = dest_scan[3];
2325 if (back_alpha == 0) { 2325 if (back_alpha == 0) {
2326 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b) ); 2326 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b) );
2327 dest_scan += 4; 2327 dest_scan += 4;
2328 continue; 2328 continue;
2329 } 2329 }
2330 if (src_alpha == 0) { 2330 if (src_alpha == 0) {
2331 dest_scan += 4; 2331 dest_scan += 4;
2332 continue; 2332 continue;
2333 } 2333 }
2334 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2334 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2335 dest_scan[3] = dest_alpha; 2335 dest_scan[3] = dest_alpha;
2336 int alpha_ratio = src_alpha * 255 / dest_alpha; 2336 int alpha_ratio = src_alpha * 255 / dest_alpha;
2337 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2337 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2338 int blended_colors[3]; 2338 int blended_colors[3];
2339 FX_BYTE src_scan[3]; 2339 uint8_t src_scan[3];
2340 src_scan[0] = src_b; 2340 src_scan[0] = src_b;
2341 src_scan[1] = src_g; 2341 src_scan[1] = src_g;
2342 src_scan[2] = src_r; 2342 src_scan[2] = src_r;
2343 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2343 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2344 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio); 2344 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio);
2345 dest_scan ++; 2345 dest_scan ++;
2346 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio); 2346 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio);
2347 dest_scan ++; 2347 dest_scan ++;
2348 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio); 2348 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio);
2349 } else if (blend_type) { 2349 } else if (blend_type) {
(...skipping 22 matching lines...) Expand all
2372 int blend_type, FX_LPCBYTE clip_scan, 2372 int blend_type, FX_LPCBYTE clip_scan,
2373 FX_LPBYTE dest_alpha_scan) 2373 FX_LPBYTE 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 FX_BYTE back_alpha = *dest_alpha_scan; 2382 uint8_t back_alpha = *dest_alpha_scan;
2383 if (back_alpha == 0) { 2383 if (back_alpha == 0) {
2384 *dest_scan ++ = src_b; 2384 *dest_scan ++ = src_b;
2385 *dest_scan ++ = src_g; 2385 *dest_scan ++ = src_g;
2386 *dest_scan ++ = src_r; 2386 *dest_scan ++ = src_r;
2387 *dest_alpha_scan ++ = src_alpha; 2387 *dest_alpha_scan ++ = src_alpha;
2388 continue; 2388 continue;
2389 } 2389 }
2390 if (src_alpha == 0) { 2390 if (src_alpha == 0) {
2391 dest_scan += 3; 2391 dest_scan += 3;
2392 dest_alpha_scan ++; 2392 dest_alpha_scan ++;
2393 continue; 2393 continue;
2394 } 2394 }
2395 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2395 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2396 *dest_alpha_scan ++ = dest_alpha; 2396 *dest_alpha_scan ++ = dest_alpha;
2397 int alpha_ratio = src_alpha * 255 / dest_alpha; 2397 int alpha_ratio = src_alpha * 255 / dest_alpha;
2398 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2398 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2399 int blended_colors[3]; 2399 int blended_colors[3];
2400 FX_BYTE src_scan[3]; 2400 uint8_t src_scan[3];
2401 src_scan[0] = src_b; 2401 src_scan[0] = src_b;
2402 src_scan[1] = src_g; 2402 src_scan[1] = src_g;
2403 src_scan[2] = src_r; 2403 src_scan[2] = src_r;
2404 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2404 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2405 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio); 2405 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio);
2406 dest_scan ++; 2406 dest_scan ++;
2407 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio); 2407 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio);
2408 dest_scan ++; 2408 dest_scan ++;
2409 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio); 2409 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio);
2410 dest_scan ++; 2410 dest_scan ++;
(...skipping 29 matching lines...) Expand all
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;
2446 continue; 2446 continue;
2447 } 2447 }
2448 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2448 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2449 int blended_colors[3]; 2449 int blended_colors[3];
2450 FX_BYTE src_scan[3]; 2450 uint8_t src_scan[3];
2451 src_scan[0] = src_b; 2451 src_scan[0] = src_b;
2452 src_scan[1] = src_g; 2452 src_scan[1] = src_g;
2453 src_scan[2] = src_r; 2453 src_scan[2] = src_r;
2454 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2454 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2455 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_al pha); 2455 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_al pha);
2456 dest_scan ++; 2456 dest_scan ++;
2457 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_al pha); 2457 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_al pha);
2458 dest_scan ++; 2458 dest_scan ++;
2459 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_al pha); 2459 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_al pha);
2460 } else if (blend_type) { 2460 } else if (blend_type) {
(...skipping 18 matching lines...) Expand all
2479 void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m ask_alpha, int pixel_count, 2479 void _CompositeRow_ByteMask2Mask(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m ask_alpha, int pixel_count,
2480 FX_LPCBYTE clip_scan) 2480 FX_LPCBYTE 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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int m ask_alpha, int src_gray,
2499 int pixel_count, FX_LPCBYTE clip_scan) 2499 int pixel_count, FX_LPCBYTE clip_scan)
(...skipping 15 matching lines...) Expand all
2515 int pixel_count, FX_LPCBYTE clip_scan, 2515 int pixel_count, FX_LPCBYTE clip_scan,
2516 FX_LPBYTE dest_alpha_scan) 2516 FX_LPBYTE 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 FX_BYTE 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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma sk_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, F X_LPCBYTE 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) {
(...skipping 10 matching lines...) Expand all
2557 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)) )) { 2557 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)) )) {
2558 dest_scan += 4; 2558 dest_scan += 4;
2559 continue; 2559 continue;
2560 } 2560 }
2561 int src_alpha; 2561 int src_alpha;
2562 if (clip_scan) { 2562 if (clip_scan) {
2563 src_alpha = mask_alpha * clip_scan[col] / 255; 2563 src_alpha = mask_alpha * clip_scan[col] / 255;
2564 } else { 2564 } else {
2565 src_alpha = mask_alpha; 2565 src_alpha = mask_alpha;
2566 } 2566 }
2567 FX_BYTE back_alpha = dest_scan[3]; 2567 uint8_t back_alpha = dest_scan[3];
2568 if (back_alpha == 0) { 2568 if (back_alpha == 0) {
2569 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b) ); 2569 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b) );
2570 dest_scan += 4; 2570 dest_scan += 4;
2571 continue; 2571 continue;
2572 } 2572 }
2573 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2573 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2574 dest_scan[3] = dest_alpha; 2574 dest_scan[3] = dest_alpha;
2575 int alpha_ratio = src_alpha * 255 / dest_alpha; 2575 int alpha_ratio = src_alpha * 255 / dest_alpha;
2576 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2576 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2577 int blended_colors[3]; 2577 int blended_colors[3];
2578 FX_BYTE src_scan[3]; 2578 uint8_t src_scan[3];
2579 src_scan[0] = src_b; 2579 src_scan[0] = src_b;
2580 src_scan[1] = src_g; 2580 src_scan[1] = src_g;
2581 src_scan[2] = src_r; 2581 src_scan[2] = src_r;
2582 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2582 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2583 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio); 2583 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio);
2584 dest_scan ++; 2584 dest_scan ++;
2585 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio); 2585 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio);
2586 dest_scan ++; 2586 dest_scan ++;
2587 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio); 2587 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio);
2588 } else if (blend_type) { 2588 } else if (blend_type) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 dest_scan += 3; 2629 dest_scan += 3;
2630 dest_alpha_scan ++; 2630 dest_alpha_scan ++;
2631 continue; 2631 continue;
2632 } 2632 }
2633 int src_alpha; 2633 int src_alpha;
2634 if (clip_scan) { 2634 if (clip_scan) {
2635 src_alpha = mask_alpha * clip_scan[col] / 255; 2635 src_alpha = mask_alpha * clip_scan[col] / 255;
2636 } else { 2636 } else {
2637 src_alpha = mask_alpha; 2637 src_alpha = mask_alpha;
2638 } 2638 }
2639 FX_BYTE back_alpha = dest_scan[3]; 2639 uint8_t back_alpha = dest_scan[3];
2640 if (back_alpha == 0) { 2640 if (back_alpha == 0) {
2641 *dest_scan ++ = src_b; 2641 *dest_scan ++ = src_b;
2642 *dest_scan ++ = src_g; 2642 *dest_scan ++ = src_g;
2643 *dest_scan ++ = src_r; 2643 *dest_scan ++ = src_r;
2644 *dest_alpha_scan ++ = mask_alpha; 2644 *dest_alpha_scan ++ = mask_alpha;
2645 continue; 2645 continue;
2646 } 2646 }
2647 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2647 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2648 *dest_alpha_scan ++ = dest_alpha; 2648 *dest_alpha_scan ++ = dest_alpha;
2649 int alpha_ratio = src_alpha * 255 / dest_alpha; 2649 int alpha_ratio = src_alpha * 255 / dest_alpha;
2650 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2650 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2651 int blended_colors[3]; 2651 int blended_colors[3];
2652 FX_BYTE src_scan[3]; 2652 uint8_t src_scan[3];
2653 src_scan[0] = src_b; 2653 src_scan[0] = src_b;
2654 src_scan[1] = src_g; 2654 src_scan[1] = src_g;
2655 src_scan[2] = src_r; 2655 src_scan[2] = src_r;
2656 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2656 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2657 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio); 2657 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ ratio);
2658 dest_scan ++; 2658 dest_scan ++;
2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio); 2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ ratio);
2660 dest_scan ++; 2660 dest_scan ++;
2661 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio); 2661 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ ratio);
2662 dest_scan ++; 2662 dest_scan ++;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 src_alpha = mask_alpha * clip_scan[col] / 255; 2707 src_alpha = mask_alpha * clip_scan[col] / 255;
2708 } else { 2708 } else {
2709 src_alpha = mask_alpha; 2709 src_alpha = mask_alpha;
2710 } 2710 }
2711 if (src_alpha == 0) { 2711 if (src_alpha == 0) {
2712 dest_scan += Bpp; 2712 dest_scan += Bpp;
2713 continue; 2713 continue;
2714 } 2714 }
2715 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 2715 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
2716 int blended_colors[3]; 2716 int blended_colors[3];
2717 FX_BYTE src_scan[3]; 2717 uint8_t src_scan[3];
2718 src_scan[0] = src_b; 2718 src_scan[0] = src_b;
2719 src_scan[1] = src_g; 2719 src_scan[1] = src_g;
2720 src_scan[2] = src_r; 2720 src_scan[2] = src_r;
2721 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); 2721 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
2722 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_al pha); 2722 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_al pha);
2723 dest_scan ++; 2723 dest_scan ++;
2724 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_al pha); 2724 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_al pha);
2725 dest_scan ++; 2725 dest_scan ++;
2726 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_al pha); 2726 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_al pha);
2727 } else if (blend_type) { 2727 } else if (blend_type) {
(...skipping 22 matching lines...) Expand all
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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int ma sk_alpha, int src_gray,
2770 int src_left, int pixel_count, FX_LPCBYTE clip_s can) 2770 int src_left, int pixel_count, FX_LPCBYTE clip_s can)
(...skipping 24 matching lines...) Expand all
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;
2802 } else { 2802 } else {
2803 src_alpha = mask_alpha; 2803 src_alpha = mask_alpha;
2804 } 2804 }
2805 FX_BYTE back_alpha = *dest_alpha_scan; 2805 uint8_t back_alpha = *dest_alpha_scan;
2806 if (back_alpha == 0) { 2806 if (back_alpha == 0) {
2807 *dest_scan ++ = src_gray; 2807 *dest_scan ++ = src_gray;
2808 *dest_alpha_scan ++ = src_alpha; 2808 *dest_alpha_scan ++ = src_alpha;
2809 continue; 2809 continue;
2810 } 2810 }
2811 if (src_alpha == 0) { 2811 if (src_alpha == 0) {
2812 dest_scan ++; 2812 dest_scan ++;
2813 dest_alpha_scan ++; 2813 dest_alpha_scan ++;
2814 continue; 2814 continue;
2815 } 2815 }
2816 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_sc an, int pixel_count, int blend_type, FX_LPCBYTE 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 FX_BYTE 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];
2834 dest_scan[1] = src_scan[1]; 2834 dest_scan[1] = src_scan[1];
2835 dest_scan[2] = src_scan[0]; 2835 dest_scan[2] = src_scan[0];
2836 } else { 2836 } else {
2837 FXARGB_RGBORDERCOPY(dest_scan, src_scan); 2837 FXARGB_RGBORDERCOPY(dest_scan, src_scan);
2838 } 2838 }
2839 dest_scan += 4; 2839 dest_scan += 4;
2840 src_scan += 4; 2840 src_scan += 4;
2841 continue; 2841 continue;
2842 } 2842 }
2843 FX_BYTE src_alpha; 2843 uint8_t src_alpha;
2844 if (clip_scan == NULL) { 2844 if (clip_scan == NULL) {
2845 src_alpha = src_scan[3]; 2845 src_alpha = src_scan[3];
2846 } else { 2846 } else {
2847 src_alpha = clip_scan[col] * src_scan[3] / 255; 2847 src_alpha = clip_scan[col] * src_scan[3] / 255;
2848 } 2848 }
2849 if (src_alpha == 0) { 2849 if (src_alpha == 0) {
2850 dest_scan += 4; 2850 dest_scan += 4;
2851 src_scan += 4; 2851 src_scan += 4;
2852 continue; 2852 continue;
2853 } 2853 }
2854 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 2854 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
2855 dest_scan[3] = dest_alpha; 2855 dest_scan[3] = dest_alpha;
2856 int alpha_ratio = src_alpha * 255 / dest_alpha; 2856 int alpha_ratio = src_alpha * 255 / dest_alpha;
2857 if (bNonseparableBlend) { 2857 if (bNonseparableBlend) {
2858 FX_BYTE dest_scan_o[3]; 2858 uint8_t dest_scan_o[3];
2859 dest_scan_o[0] = dest_scan[2]; 2859 dest_scan_o[0] = dest_scan[2];
2860 dest_scan_o[1] = dest_scan[1]; 2860 dest_scan_o[1] = dest_scan[1];
2861 dest_scan_o[2] = dest_scan[0]; 2861 dest_scan_o[2] = dest_scan[0];
2862 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 2862 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
2863 } 2863 }
2864 for (int color = 0; color < 3; color ++) { 2864 for (int color = 0; color < 3; color ++) {
2865 int index = 2 - color; 2865 int index = 2 - color;
2866 if (blend_type) { 2866 if (blend_type) {
2867 int blended = bNonseparableBlend ? blended_colors[color] : 2867 int blended = bNonseparableBlend ? blended_colors[color] :
2868 _BLEND(blend_type, dest_scan[index], *src_scan); 2868 _BLEND(blend_type, dest_scan[index], *src_scan);
2869 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); 2869 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha);
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(FX_LPBYTE dest_scan, FX_LP CBYTE 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 FX_BYTE 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 {
2891 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); 2891 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0]));
2892 } 2892 }
2893 dest_scan += 4; 2893 dest_scan += 4;
2894 src_scan += src_Bpp; 2894 src_scan += src_Bpp;
2895 continue; 2895 continue;
2896 } 2896 }
2897 dest_scan[3] = 0xff; 2897 dest_scan[3] = 0xff;
2898 if (bNonseparableBlend) { 2898 if (bNonseparableBlend) {
2899 FX_BYTE dest_scan_o[3]; 2899 uint8_t dest_scan_o[3];
2900 dest_scan_o[0] = dest_scan[2]; 2900 dest_scan_o[0] = dest_scan[2];
2901 dest_scan_o[1] = dest_scan[1]; 2901 dest_scan_o[1] = dest_scan[1];
2902 dest_scan_o[2] = dest_scan[0]; 2902 dest_scan_o[2] = dest_scan[0];
2903 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 2903 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
2904 } 2904 }
2905 for (int color = 0; color < 3; color ++) { 2905 for (int color = 0; color < 3; color ++) {
2906 int index = 2 - color; 2906 int index = 2 - color;
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(FX_LPBYTE dest_scan, FX_LP CBYTE src_scan, int width, int blend_type, int dest_Bpp, FX_LPCBYTE 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 FX_BYTE 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 }
2928 if (src_alpha == 0) { 2928 if (src_alpha == 0) {
2929 dest_scan += dest_Bpp; 2929 dest_scan += dest_Bpp;
2930 src_scan += 4; 2930 src_scan += 4;
2931 continue; 2931 continue;
2932 } 2932 }
2933 if (bNonseparableBlend) { 2933 if (bNonseparableBlend) {
2934 FX_BYTE dest_scan_o[3]; 2934 uint8_t dest_scan_o[3];
2935 dest_scan_o[0] = dest_scan[2]; 2935 dest_scan_o[0] = dest_scan[2];
2936 dest_scan_o[1] = dest_scan[1]; 2936 dest_scan_o[1] = dest_scan[1];
2937 dest_scan_o[2] = dest_scan[0]; 2937 dest_scan_o[2] = dest_scan[0];
2938 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 2938 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
2939 } 2939 }
2940 for (int color = 0; color < 3; color ++) { 2940 for (int color = 0; color < 3; color ++) {
2941 int index = 2 - color; 2941 int index = 2 - color;
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);
(...skipping 16 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE 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 FX_BYTE 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(FX_LPBYTE dest_scan, FX_ LPCBYTE src_scan, int width, int dest_Bpp, FX_LPCBYTE clip_scan)
2991 { 2991 {
2992 for (int col = 0; col < width; col ++) { 2992 for (int col = 0; col < width; col ++) {
2993 FX_BYTE 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++);
3001 dest_scan[1] = FX_GAMMA_INVERSE(*src_scan++); 3001 dest_scan[1] = FX_GAMMA_INVERSE(*src_scan++);
3002 dest_scan[0] = FX_GAMMA_INVERSE(*src_scan++); 3002 dest_scan[0] = FX_GAMMA_INVERSE(*src_scan++);
3003 dest_scan += dest_Bpp; 3003 dest_scan += dest_Bpp;
(...skipping 24 matching lines...) Expand all
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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int width, int blend_type, int src_Bpp, FX_LPCBYTE clip_sca n)
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 FX_BYTE 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++);
3042 dest_scan[0] = FX_GAMMA(*src_scan++); 3042 dest_scan[0] = FX_GAMMA(*src_scan++);
3043 src_scan += src_gap; 3043 src_scan += src_gap;
3044 dest_scan += 4; 3044 dest_scan += 4;
3045 continue; 3045 continue;
3046 } 3046 }
3047 if (src_alpha == 0) { 3047 if (src_alpha == 0) {
3048 dest_scan += 4; 3048 dest_scan += 4;
3049 src_scan += src_Bpp; 3049 src_scan += src_Bpp;
3050 continue; 3050 continue;
3051 } 3051 }
3052 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 3052 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
3053 dest_scan[3] = dest_alpha; 3053 dest_scan[3] = dest_alpha;
3054 int alpha_ratio = src_alpha * 255 / dest_alpha; 3054 int alpha_ratio = src_alpha * 255 / dest_alpha;
3055 if (bNonseparableBlend) { 3055 if (bNonseparableBlend) {
3056 FX_BYTE dest_scan_o[3]; 3056 uint8_t dest_scan_o[3];
3057 dest_scan_o[0] = dest_scan[2]; 3057 dest_scan_o[0] = dest_scan[2];
3058 dest_scan_o[1] = dest_scan[1]; 3058 dest_scan_o[1] = dest_scan[1];
3059 dest_scan_o[2] = dest_scan[0]; 3059 dest_scan_o[2] = dest_scan[0];
3060 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3060 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3061 } 3061 }
3062 for (int color = 0; color < 3; color ++) { 3062 for (int color = 0; color < 3; color ++) {
3063 int index = 2 - color; 3063 int index = 2 - color;
3064 int src_color = FX_GAMMA(*src_scan); 3064 int src_color = FX_GAMMA(*src_scan);
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(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)
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 FX_BYTE 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;
3086 } 3086 }
3087 if (bNonseparableBlend) { 3087 if (bNonseparableBlend) {
3088 FX_BYTE dest_scan_o[3]; 3088 uint8_t dest_scan_o[3];
3089 dest_scan_o[0] = dest_scan[2]; 3089 dest_scan_o[0] = dest_scan[2];
3090 dest_scan_o[1] = dest_scan[1]; 3090 dest_scan_o[1] = dest_scan[1];
3091 dest_scan_o[2] = dest_scan[0]; 3091 dest_scan_o[2] = dest_scan[0];
3092 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3092 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3093 } 3093 }
3094 for (int color = 0; color < 3; color ++) { 3094 for (int color = 0; color < 3; color ++) {
3095 int index = 2 - color; 3095 int index = 2 - color;
3096 int src_color = FX_GAMMA(*src_scan); 3096 int src_color = FX_GAMMA(*src_scan);
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] :
(...skipping 18 matching lines...) Expand all
3117 dest_scan += 4; 3117 dest_scan += 4;
3118 src_scan += src_gap; 3118 src_scan += src_gap;
3119 continue; 3119 continue;
3120 } 3120 }
3121 if (src_alpha == 0) { 3121 if (src_alpha == 0) {
3122 dest_scan += 4; 3122 dest_scan += 4;
3123 src_scan += src_Bpp; 3123 src_scan += src_Bpp;
3124 continue; 3124 continue;
3125 } 3125 }
3126 int back_alpha = dest_scan[3]; 3126 int back_alpha = dest_scan[3];
3127 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 3127 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
3128 dest_scan[3] = dest_alpha; 3128 dest_scan[3] = dest_alpha;
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 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 dest_scan += 4; 3240 dest_scan += 4;
3241 continue; 3241 continue;
3242 } 3242 }
3243 int src_alpha = clip_scan[col]; 3243 int src_alpha = clip_scan[col];
3244 if (src_alpha == 0) { 3244 if (src_alpha == 0) {
3245 dest_scan += 4; 3245 dest_scan += 4;
3246 src_scan ++; 3246 src_scan ++;
3247 continue; 3247 continue;
3248 } 3248 }
3249 int back_alpha = dest_scan[3]; 3249 int back_alpha = dest_scan[3];
3250 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int src_left, int width,
(...skipping 30 matching lines...) Expand all
3291 dest_scan[3] = 255; 3291 dest_scan[3] = 255;
3292 dest_scan += 4; 3292 dest_scan += 4;
3293 continue; 3293 continue;
3294 } 3294 }
3295 int src_alpha = clip_scan[col]; 3295 int src_alpha = clip_scan[col];
3296 if (src_alpha == 0) { 3296 if (src_alpha == 0) {
3297 dest_scan += 4; 3297 dest_scan += 4;
3298 continue; 3298 continue;
3299 } 3299 }
3300 int back_alpha = dest_scan[3]; 3300 int back_alpha = dest_scan[3];
3301 FX_BYTE 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(FX_LPBYTE dest_scan, FX_LPCBYTE sr c_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, FX_LPCBYTE 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 FX_BYTE back_alpha = dest_scan[3]; 3320 uint8_t back_alpha = dest_scan[3];
3321 if (back_alpha == 0) { 3321 if (back_alpha == 0) {
3322 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b)); 3322 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b));
3323 dest_scan += 4; 3323 dest_scan += 4;
3324 continue; 3324 continue;
3325 } 3325 }
3326 if (src_alpha == 0) { 3326 if (src_alpha == 0) {
3327 dest_scan += 4; 3327 dest_scan += 4;
3328 continue; 3328 continue;
3329 } 3329 }
3330 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 3330 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
3331 dest_scan[3] = dest_alpha; 3331 dest_scan[3] = dest_alpha;
3332 int alpha_ratio = src_alpha * 255 / dest_alpha; 3332 int alpha_ratio = src_alpha * 255 / dest_alpha;
3333 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 3333 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
3334 int blended_colors[3]; 3334 int blended_colors[3];
3335 FX_BYTE src_scan[3]; 3335 uint8_t src_scan[3];
3336 FX_BYTE dest_scan_o[3]; 3336 uint8_t dest_scan_o[3];
3337 src_scan[0] = src_b; 3337 src_scan[0] = src_b;
3338 src_scan[1] = src_g; 3338 src_scan[1] = src_g;
3339 src_scan[2] = src_r; 3339 src_scan[2] = src_r;
3340 dest_scan_o[0] = dest_scan[2]; 3340 dest_scan_o[0] = dest_scan[2];
3341 dest_scan_o[1] = dest_scan[1]; 3341 dest_scan_o[1] = dest_scan[1];
3342 dest_scan_o[2] = dest_scan[0]; 3342 dest_scan_o[2] = dest_scan[0];
3343 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3343 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3344 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], al pha_ratio); 3344 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], al pha_ratio);
3345 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], al pha_ratio); 3345 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], al pha_ratio);
3346 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], al pha_ratio); 3346 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], al pha_ratio);
(...skipping 24 matching lines...) Expand all
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;
3377 continue; 3377 continue;
3378 } 3378 }
3379 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 3379 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
3380 int blended_colors[3]; 3380 int blended_colors[3];
3381 FX_BYTE src_scan[3]; 3381 uint8_t src_scan[3];
3382 FX_BYTE dest_scan_o[3]; 3382 uint8_t dest_scan_o[3];
3383 src_scan[0] = src_b; 3383 src_scan[0] = src_b;
3384 src_scan[1] = src_g; 3384 src_scan[1] = src_g;
3385 src_scan[2] = src_r; 3385 src_scan[2] = src_r;
3386 dest_scan_o[0] = dest_scan[2]; 3386 dest_scan_o[0] = dest_scan[2];
3387 dest_scan_o[1] = dest_scan[1]; 3387 dest_scan_o[1] = dest_scan[1];
3388 dest_scan_o[2] = dest_scan[0]; 3388 dest_scan_o[2] = dest_scan[0];
3389 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3389 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3390 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], sr c_alpha); 3390 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], sr c_alpha);
3391 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], sr c_alpha); 3391 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], sr c_alpha);
3392 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], sr c_alpha); 3392 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], sr c_alpha);
(...skipping 29 matching lines...) Expand all
3422 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)) )) { 3422 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)) )) {
3423 dest_scan += 4; 3423 dest_scan += 4;
3424 continue; 3424 continue;
3425 } 3425 }
3426 int src_alpha; 3426 int src_alpha;
3427 if (clip_scan) { 3427 if (clip_scan) {
3428 src_alpha = mask_alpha * clip_scan[col] / 255; 3428 src_alpha = mask_alpha * clip_scan[col] / 255;
3429 } else { 3429 } else {
3430 src_alpha = mask_alpha; 3430 src_alpha = mask_alpha;
3431 } 3431 }
3432 FX_BYTE back_alpha = dest_scan[3]; 3432 uint8_t back_alpha = dest_scan[3];
3433 if (back_alpha == 0) { 3433 if (back_alpha == 0) {
3434 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b)); 3434 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g , src_b));
3435 dest_scan += 4; 3435 dest_scan += 4;
3436 continue; 3436 continue;
3437 } 3437 }
3438 FX_BYTE dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55; 3438 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 2 55;
3439 dest_scan[3] = dest_alpha; 3439 dest_scan[3] = dest_alpha;
3440 int alpha_ratio = src_alpha * 255 / dest_alpha; 3440 int alpha_ratio = src_alpha * 255 / dest_alpha;
3441 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 3441 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
3442 int blended_colors[3]; 3442 int blended_colors[3];
3443 FX_BYTE src_scan[3]; 3443 uint8_t src_scan[3];
3444 FX_BYTE dest_scan_o[3]; 3444 uint8_t dest_scan_o[3];
3445 src_scan[0] = src_b; 3445 src_scan[0] = src_b;
3446 src_scan[1] = src_g; 3446 src_scan[1] = src_g;
3447 src_scan[2] = src_r; 3447 src_scan[2] = src_r;
3448 dest_scan_o[0] = dest_scan[2]; 3448 dest_scan_o[0] = dest_scan[2];
3449 dest_scan_o[1] = dest_scan[1]; 3449 dest_scan_o[1] = dest_scan[1];
3450 dest_scan_o[2] = dest_scan[0]; 3450 dest_scan_o[2] = dest_scan[0];
3451 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3451 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3452 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], al pha_ratio); 3452 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], al pha_ratio);
3453 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], al pha_ratio); 3453 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], al pha_ratio);
3454 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], al pha_ratio); 3454 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], al pha_ratio);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 src_alpha = mask_alpha * clip_scan[col] / 255; 3494 src_alpha = mask_alpha * clip_scan[col] / 255;
3495 } else { 3495 } else {
3496 src_alpha = mask_alpha; 3496 src_alpha = mask_alpha;
3497 } 3497 }
3498 if (src_alpha == 0) { 3498 if (src_alpha == 0) {
3499 dest_scan += Bpp; 3499 dest_scan += Bpp;
3500 continue; 3500 continue;
3501 } 3501 }
3502 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { 3502 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
3503 int blended_colors[3]; 3503 int blended_colors[3];
3504 FX_BYTE src_scan[3]; 3504 uint8_t src_scan[3];
3505 FX_BYTE dest_scan_o[3]; 3505 uint8_t dest_scan_o[3];
3506 src_scan[0] = src_b; 3506 src_scan[0] = src_b;
3507 src_scan[1] = src_g; 3507 src_scan[1] = src_g;
3508 src_scan[2] = src_r; 3508 src_scan[2] = src_r;
3509 dest_scan_o[0] = dest_scan[2]; 3509 dest_scan_o[0] = dest_scan[2];
3510 dest_scan_o[1] = dest_scan[1]; 3510 dest_scan_o[1] = dest_scan[1];
3511 dest_scan_o[2] = dest_scan[0]; 3511 dest_scan_o[2] = dest_scan[0];
3512 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); 3512 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
3513 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], sr c_alpha); 3513 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], sr c_alpha);
3514 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], sr c_alpha); 3514 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], sr c_alpha);
3515 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], sr c_alpha); 3515 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], sr c_alpha);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FX_LPBYTE gray_p = (FX_LPBYTE)&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 FX_BYTE 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 }
(...skipping 20 matching lines...) Expand all
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(FX_BYTE, pal_count); 3603 FX_LPBYTE 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, (FX_L PCBYTE)&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, (FX_LPBYTE)&col or, (FX_LPCBYTE)&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(FX_BYTE, pal_count); 3621 FX_LPBYTE 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, (FX_LPBYTE)&pDe stPalette[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(FX_BYTE, pal_count); 3646 FX_LPBYTE 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 FX_BYTE 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
3657 for (int i = 0; i < pal_count; i ++) { 3657 for (int i = 0; i < pal_count; i ++) {
3658 FX_ARGB argb = pSrcPalette[i]; 3658 FX_ARGB argb = pSrcPalette[i];
3659 *gray_pal ++ = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb) , FXARGB_B(argb)); 3659 *gray_pal ++ = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb) , FXARGB_B(argb));
3660 } 3660 }
3661 } else { 3661 } else {
3662 int palsize = 1 << (src_format & 0xff); 3662 int palsize = 1 << (src_format & 0xff);
3663 pDestPalette = FX_Alloc(FX_DWORD, palsize); 3663 pDestPalette = FX_Alloc(FX_DWORD, palsize);
3664 if (isDstCmyk == isSrcCmyk) { 3664 if (isDstCmyk == isSrcCmyk) {
3665 FXSYS_memcpy32(pDestPalette, pSrcPalette, palsize * sizeof(F X_DWORD)); 3665 FXSYS_memcpy32(pDestPalette, pSrcPalette, palsize * sizeof(F X_DWORD));
3666 } else { 3666 } else {
3667 for (int i = 0; i < palsize; i ++) { 3667 for (int i = 0; i < palsize; i ++) {
3668 FX_CMYK cmyk = pSrcPalette[i]; 3668 FX_CMYK cmyk = pSrcPalette[i];
3669 FX_BYTE 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(FX_BYTE, pal_count); 3679 FX_LPBYTE 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 {
3690 int palsize = 1 << (src_format & 0xff); 3690 int palsize = 1 << (src_format & 0xff);
3691 pDestPalette = FX_Alloc(FX_DWORD, palsize); 3691 pDestPalette = FX_Alloc(FX_DWORD, palsize);
3692 if (palsize == 2) { 3692 if (palsize == 2) {
3693 pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000; 3693 pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000;
3694 pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff; 3694 pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff;
3695 } else { 3695 } else {
3696 for (int i = 0; i < palsize; i++) { 3696 for (int i = 0; i < palsize; i++) {
3697 pDestPalette[i] = isSrcCmyk ? FX_CCOLOR(i) : (i * 0x1010 1); 3697 pDestPalette[i] = isSrcCmyk ? FX_CCOLOR(i) : (i * 0x1010 1);
3698 } 3698 }
3699 } 3699 }
3700 if (isSrcCmyk != isDstCmyk) { 3700 if (isSrcCmyk != isDstCmyk) {
3701 for (int i = 0; i < palsize; i ++) { 3701 for (int i = 0; i < palsize; i ++) {
3702 FX_CMYK cmyk = pDestPalette[i]; 3702 FX_CMYK cmyk = pDestPalette[i];
3703 FX_BYTE r, g, b; 3703 uint8_t r, g, b;
3704 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), 3704 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValu e(cmyk), FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk),
3705 r, g, b); 3705 r, g, b);
3706 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); 3706 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b);
3707 } 3707 }
3708 } 3708 }
3709 } 3709 }
3710 } 3710 }
3711 } 3711 }
3712 } 3712 }
3713 CFX_ScanlineCompositor::CFX_ScanlineCompositor() 3713 CFX_ScanlineCompositor::CFX_ScanlineCompositor()
3714 { 3714 {
3715 m_pSrcPalette = NULL; 3715 m_pSrcPalette = NULL;
3716 m_pCacheScanline = NULL; 3716 m_pCacheScanline = NULL;
3717 m_CacheSize = 0; 3717 m_CacheSize = 0;
3718 m_bRgbByteOrder = FALSE; 3718 m_bRgbByteOrder = FALSE;
3719 m_BlendType = FXDIB_BLEND_NORMAL; 3719 m_BlendType = FXDIB_BLEND_NORMAL;
3720 } 3720 }
3721 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() 3721 CFX_ScanlineCompositor::~CFX_ScanlineCompositor()
3722 { 3722 {
3723 if (m_pSrcPalette) { 3723 if (m_pSrcPalette) {
3724 FX_Free(m_pSrcPalette); 3724 FX_Free(m_pSrcPalette);
3725 } 3725 }
3726 if (m_pCacheScanline) { 3726 if (m_pCacheScanline) {
3727 FX_Free(m_pCacheScanline); 3727 FX_Free(m_pCacheScanline);
3728 } 3728 }
3729 } 3729 }
3730 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ format, FX_INT32 width, FX_DWORD* pSrcPalette, 3730 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_ format, int32_t width, FX_DWORD* pSrcPalette,
3731 FX_DWORD mask_color, int blend_type, FX_BOO L bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform) 3731 FX_DWORD mask_color, int blend_type, FX_BOO L bClip, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform)
3732 { 3732 {
3733 m_SrcFormat = src_format; 3733 m_SrcFormat = src_format;
3734 m_DestFormat = dest_format; 3734 m_DestFormat = dest_format;
3735 m_BlendType = blend_type; 3735 m_BlendType = blend_type;
3736 m_bRgbByteOrder = bRgbByteOrder; 3736 m_bRgbByteOrder = bRgbByteOrder;
3737 ICodec_IccModule* pIccModule = NULL; 3737 ICodec_IccModule* pIccModule = NULL;
3738 if (CFX_GEModule::Get()->GetCodecModule()) { 3738 if (CFX_GEModule::Get()->GetCodecModule()) {
3739 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 3739 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
3740 } 3740 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 } 3854 }
3855 if (m_DestFormat & 0x0400) { 3855 if (m_DestFormat & 0x0400) {
3856 for (int i = 0; i < width; i ++) { 3856 for (int i = 0; i < width; i ++) {
3857 *dest_scan = ~*dest_scan; 3857 *dest_scan = ~*dest_scan;
3858 dest_scan++; 3858 dest_scan++;
3859 } 3859 }
3860 } 3860 }
3861 } else { 3861 } else {
3862 int dest_Size = width * dest_Bpp + 4; 3862 int dest_Size = width * dest_Bpp + 4;
3863 if (dest_Size > m_CacheSize) { 3863 if (dest_Size > m_CacheSize) {
3864 m_pCacheScanline = FX_Realloc(FX_BYTE, m_pCacheScanline, dest_Size); 3864 m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size);
3865 if (!m_pCacheScanline) { 3865 if (!m_pCacheScanline) {
3866 return; 3866 return;
3867 } 3867 }
3868 m_CacheSize = dest_Size; 3868 m_CacheSize = dest_Size;
3869 } 3869 }
3870 switch (m_Transparency) { 3870 switch (m_Transparency) {
3871 case 0: 3871 case 0:
3872 case 4: 3872 case 4:
3873 case 8: 3873 case 8:
3874 case 4+8: { 3874 case 4+8: {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4151 } 4151 }
4152 ASSERT(pMask->IsAlphaMask()); 4152 ASSERT(pMask->IsAlphaMask());
4153 ASSERT(m_bpp >= 8); 4153 ASSERT(m_bpp >= 8);
4154 if (!pMask->IsAlphaMask() || m_bpp < 8) { 4154 if (!pMask->IsAlphaMask() || m_bpp < 8) {
4155 return FALSE; 4155 return FALSE;
4156 } 4156 }
4157 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask- >GetHeight(), src_left, src_top, pClipRgn); 4157 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask- >GetHeight(), src_left, src_top, pClipRgn);
4158 if (width == 0 || height == 0) { 4158 if (width == 0 || height == 0) {
4159 return TRUE; 4159 return TRUE;
4160 } 4160 }
4161 int src_alpha = (FX_BYTE)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A( color); 4161 int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A( color);
4162 if (src_alpha == 0) { 4162 if (src_alpha == 0) {
4163 return TRUE; 4163 return TRUE;
4164 } 4164 }
4165 const CFX_DIBitmap* pClipMask = NULL; 4165 const CFX_DIBitmap* pClipMask = NULL;
4166 FX_RECT clip_box; 4166 FX_RECT clip_box;
4167 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { 4167 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) {
4168 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); 4168 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF);
4169 pClipMask = pClipRgn->GetMask(); 4169 pClipMask = pClipRgn->GetMask();
4170 clip_box = pClipRgn->GetBox(); 4170 clip_box = pClipRgn->GetBox();
4171 } 4171 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FX_LPBYTE color_p = (FX_LPBYTE)&dst_color;
4216 if (m_bpp == 8) { 4216 if (m_bpp == 8) {
4217 FX_BYTE 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 FX_BYTE 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 = (FX_BYTE)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 FX_LPBYTE 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) {
4248 ASSERT(!IsCmykImage() && (FX_BYTE)(alpha_flag >> 8) == 0); 4248 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
4249 int left_shift = rect.left % 8; 4249 int left_shift = rect.left % 8;
4250 int right_shift = rect.right % 8; 4250 int right_shift = rect.right % 8;
4251 int width = rect.right / 8 - rect.left / 8; 4251 int width = rect.right / 8 - rect.left / 8;
4252 int index = 0; 4252 int index = 0;
4253 if (m_pPalette == NULL) { 4253 if (m_pPalette == NULL) {
4254 index = ((FX_BYTE)color == 0xff) ? 1 : 0; 4254 index = ((uint8_t)color == 0xff) ? 1 : 0;
4255 } else { 4255 } else {
4256 for (int i = 0; i < 2; i ++) 4256 for (int i = 0; i < 2; i ++)
4257 if (m_pPalette[i] == color) { 4257 if (m_pPalette[i] == color) {
4258 index = i; 4258 index = i;
4259 } 4259 }
4260 } 4260 }
4261 for (int row = rect.top; row < rect.bottom; row ++) { 4261 for (int row = rect.top; row < rect.bottom; row ++) {
4262 FX_BYTE* dest_scan_top = (FX_BYTE*)GetScanline(row) + rect.left / 8; 4262 uint8_t* dest_scan_top = (uint8_t*)GetScanline(row) + rect.left / 8;
4263 FX_BYTE* dest_scan_top_r = (FX_BYTE*)GetScanline(row) + rect.right / 8; 4263 uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8;
4264 FX_BYTE left_flag = *dest_scan_top & (255 << (8 - left_shift)); 4264 uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift));
4265 FX_BYTE right_flag = *dest_scan_top_r & (255 >> right_shift); 4265 uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift);
4266 if (width) { 4266 if (width) {
4267 FXSYS_memset8(dest_scan_top + 1, index ? 255 : 0, width - 1); 4267 FXSYS_memset8(dest_scan_top + 1, index ? 255 : 0, width - 1);
4268 if (!index) { 4268 if (!index) {
4269 *dest_scan_top &= left_flag; 4269 *dest_scan_top &= left_flag;
4270 *dest_scan_top_r &= right_flag; 4270 *dest_scan_top_r &= right_flag;
4271 } else { 4271 } else {
4272 *dest_scan_top |= ~left_flag; 4272 *dest_scan_top |= ~left_flag;
4273 *dest_scan_top_r |= ~right_flag; 4273 *dest_scan_top_r |= ~right_flag;
4274 } 4274 }
4275 } else { 4275 } else {
(...skipping 15 matching lines...) Expand all
4291 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); 4291 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
4292 } else { 4292 } else {
4293 if (alpha_flag >> 8 && !IsCmykImage()) 4293 if (alpha_flag >> 8 && !IsCmykImage())
4294 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F XSYS_GetYValue(color), FXSYS_GetKValue(color), 4294 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), F XSYS_GetYValue(color), FXSYS_GetKValue(color),
4295 color_p[2], color_p[1], color_p[0]); 4295 color_p[2], color_p[1], color_p[0]);
4296 else if (!(alpha_flag >> 8) && IsCmykImage()) { 4296 else if (!(alpha_flag >> 8) && IsCmykImage()) {
4297 return FALSE; 4297 return FALSE;
4298 } 4298 }
4299 } 4299 }
4300 if(!IsCmykImage()) { 4300 if(!IsCmykImage()) {
4301 color_p[3] = (FX_BYTE)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 FX_LPBYTE 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 FX_LPBYTE dest_scan_alpha = m_pAlphaMask ? (FX_LPBYTE)m_pAlphaMask-> GetScanline(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);
(...skipping 11 matching lines...) Expand all
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 FX_LPBYTE 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 FX_BYTE 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 FX_BYTE 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 FX_LPBYTE dest_scan_alpha = (FX_LPBYTE)m_pAlphaMask->GetScanline (row) + rect.left;
4351 for (int col = 0; col < width; col ++) { 4351 for (int col = 0; col < width; col ++) {
4352 FX_BYTE 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 FX_BYTE 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;
4361 int alpha_ratio = src_alpha * 255 / dest_alpha; 4361 int alpha_ratio = src_alpha * 255 / dest_alpha;
4362 for(int comps = 0; comps < Bpp; comps ++) { 4362 for(int comps = 0; comps < Bpp; comps ++) {
4363 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps ], alpha_ratio); 4363 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps ], alpha_ratio);
4364 dest_scan ++; 4364 dest_scan ++;
4365 } 4365 }
4366 } 4366 }
4367 } 4367 }
4368 } else { 4368 } else {
4369 for (int col = 0; col < width; col ++) { 4369 for (int col = 0; col < width; col ++) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 m_BlendType = blend_type; 4430 m_BlendType = blend_type;
4431 } 4431 }
4432 FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form at, FX_DWORD* pSrcPalette) 4432 FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form at, FX_DWORD* pSrcPalette)
4433 { 4433 {
4434 m_SrcFormat = src_format; 4434 m_SrcFormat = src_format;
4435 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett e, m_MaskColor, FXDIB_BLEND_NORMAL, 4435 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalett e, m_MaskColor, FXDIB_BLEND_NORMAL,
4436 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB yteOrder, m_AlphaFlag, m_pIccTransform)) { 4436 m_pClipMask != NULL || (m_BitmapAlpha < 255), m_bRgbB yteOrder, m_AlphaFlag, m_pIccTransform)) {
4437 return FALSE; 4437 return FALSE;
4438 } 4438 }
4439 if (m_bVertical) { 4439 if (m_bVertical) {
4440 m_pScanlineV = FX_Alloc(FX_BYTE, m_pBitmap->GetBPP() / 8 * width + 4); 4440 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4);
4441 m_pClipScanV = FX_Alloc(FX_BYTE, 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(FX_BYTE, 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(FX_BYTE, 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(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan, int dest_width, FX_LPCBYTE clip_scan,
4452 FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_ext ra_alpha) 4452 FX_LPCBYTE src_extra_alpha, FX_LPBYTE dst_ext ra_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;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « core/src/fxge/apple/fx_quartz_device.cpp ('k') | core/src/fxge/dib/fx_dib_convert.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698