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

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

Issue 1747123002: Fix and enable lint checks. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/fxcrt/fx_system_unittest.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 "core/include/fxcodec/fx_codec.h" 7 #include "core/include/fxcodec/fx_codec.h"
8 #include "core/include/fxge/fx_ge.h" 8 #include "core/include/fxge/fx_ge.h"
9 #include "core/src/fxge/dib/dib_int.h" 9 #include "core/src/fxge/dib/dib_int.h"
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 } 279 }
280 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, 280 void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
281 const uint8_t* src_scan, 281 const uint8_t* src_scan,
282 int pixel_count, 282 int pixel_count,
283 int blend_type, 283 int blend_type,
284 const uint8_t* clip_scan, 284 const uint8_t* clip_scan,
285 const uint8_t* src_alpha_scan, 285 const uint8_t* src_alpha_scan,
286 uint8_t* dst_alpha_scan, 286 uint8_t* dst_alpha_scan,
287 void* pIccTransform) { 287 void* pIccTransform) {
288 ICodec_IccModule* pIccModule = NULL; 288 ICodec_IccModule* pIccModule = nullptr;
289 if (pIccTransform) { 289 if (pIccTransform)
290 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 290 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
291 } 291
292 if (blend_type) { 292 if (blend_type) {
293 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 293 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
294 int blended_color; 294 int blended_color;
295 if (src_alpha_scan) { 295 if (src_alpha_scan) {
296 for (int col = 0; col < pixel_count; col++) { 296 for (int col = 0; col < pixel_count; col++) {
297 uint8_t back_alpha = *dst_alpha_scan; 297 uint8_t back_alpha = *dst_alpha_scan;
298 if (back_alpha == 0) { 298 if (back_alpha == 0) {
299 int src_alpha = *src_alpha_scan++; 299 int src_alpha = *src_alpha_scan++;
300 if (clip_scan) { 300 if (clip_scan)
301 src_alpha = clip_scan[col] * src_alpha / 255; 301 src_alpha = clip_scan[col] * src_alpha / 255;
302 } 302
303 if (src_alpha) { 303 if (src_alpha) {
304 if (pIccTransform) { 304 if (pIccTransform) {
305 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 305 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
306 1); 306 1);
307 } else { 307 } else {
308 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 308 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
309 } 309 }
310 *dst_alpha_scan = src_alpha; 310 *dst_alpha_scan = src_alpha;
311 } 311 }
312 dest_scan++; 312 dest_scan++;
313 dst_alpha_scan++; 313 dst_alpha_scan++;
314 src_scan += 3; 314 src_scan += 3;
315 continue; 315 continue;
316 } 316 }
317 uint8_t src_alpha = *src_alpha_scan++; 317 uint8_t 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 == 0) { 321 if (src_alpha == 0) {
322 dest_scan++; 322 dest_scan++;
323 dst_alpha_scan++; 323 dst_alpha_scan++;
324 src_scan += 3; 324 src_scan += 3;
325 continue; 325 continue;
326 } 326 }
327 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 327 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
328 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 328 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
329 uint8_t gray; 329 uint8_t gray;
330 if (pIccTransform) { 330 if (pIccTransform) {
331 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 331 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
332 } else { 332 } else {
333 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 333 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
334 } 334 }
335 if (bNonseparableBlend) { 335 if (bNonseparableBlend) {
336 blended_color = 336 blended_color =
337 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 337 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
338 } 338 }
339 gray = bNonseparableBlend ? blended_color 339 gray = bNonseparableBlend ? blended_color
340 : _BLEND(blend_type, *dest_scan, gray); 340 : _BLEND(blend_type, *dest_scan, gray);
341 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 341 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
342 dest_scan++; 342 dest_scan++;
343 dst_alpha_scan++; 343 dst_alpha_scan++;
344 src_scan += 3; 344 src_scan += 3;
345 } 345 }
346 } else 346 } else {
347 for (int col = 0; col < pixel_count; col++) { 347 for (int col = 0; col < pixel_count; col++) {
348 uint8_t back_alpha = *dst_alpha_scan; 348 uint8_t back_alpha = *dst_alpha_scan;
349 if (back_alpha == 0) { 349 if (back_alpha == 0) {
350 int src_alpha = src_scan[3]; 350 int src_alpha = src_scan[3];
351 if (clip_scan) { 351 if (clip_scan)
352 src_alpha = clip_scan[col] * src_alpha / 255; 352 src_alpha = clip_scan[col] * src_alpha / 255;
353 } 353
354 if (src_alpha) { 354 if (src_alpha) {
355 if (pIccTransform) { 355 if (pIccTransform) {
356 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 356 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
357 1); 357 1);
358 } else { 358 } else {
359 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 359 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
360 } 360 }
361 *dst_alpha_scan = src_alpha; 361 *dst_alpha_scan = src_alpha;
362 } 362 }
363 dest_scan++; 363 dest_scan++;
364 dst_alpha_scan++; 364 dst_alpha_scan++;
365 src_scan += 4; 365 src_scan += 4;
366 continue; 366 continue;
367 } 367 }
368 uint8_t src_alpha = src_scan[3]; 368 uint8_t src_alpha = src_scan[3];
369 if (clip_scan) { 369 if (clip_scan)
370 src_alpha = clip_scan[col] * src_alpha / 255; 370 src_alpha = clip_scan[col] * src_alpha / 255;
371 } 371
372 if (src_alpha == 0) { 372 if (src_alpha == 0) {
373 dest_scan++; 373 dest_scan++;
374 dst_alpha_scan++; 374 dst_alpha_scan++;
375 src_scan += 4; 375 src_scan += 4;
376 continue; 376 continue;
377 } 377 }
378 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 378 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
379 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 379 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
380 uint8_t gray; 380 uint8_t gray;
381 if (pIccTransform) { 381 if (pIccTransform)
382 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 382 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
383 } else { 383 else
384 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 384 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
385 } 385
386 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 386 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
387 dest_scan++; 387 dest_scan++;
388 dst_alpha_scan++; 388 dst_alpha_scan++;
389 src_scan += 4; 389 src_scan += 4;
390 } 390 }
391 }
391 return; 392 return;
392 } 393 }
393 if (src_alpha_scan) { 394 if (src_alpha_scan) {
394 for (int col = 0; col < pixel_count; col++) { 395 for (int col = 0; col < pixel_count; col++) {
395 uint8_t back_alpha = *dst_alpha_scan; 396 uint8_t back_alpha = *dst_alpha_scan;
396 if (back_alpha == 0) { 397 if (back_alpha == 0) {
397 int src_alpha = *src_alpha_scan++; 398 int src_alpha = *src_alpha_scan++;
398 if (clip_scan) { 399 if (clip_scan)
399 src_alpha = clip_scan[col] * src_alpha / 255; 400 src_alpha = clip_scan[col] * src_alpha / 255;
400 } 401
401 if (src_alpha) { 402 if (src_alpha) {
402 if (pIccTransform) { 403 if (pIccTransform) {
403 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 404 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
404 1); 405 1);
405 } else { 406 } else {
406 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 407 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
407 } 408 }
408 *dst_alpha_scan = src_alpha; 409 *dst_alpha_scan = src_alpha;
409 } 410 }
410 dest_scan++; 411 dest_scan++;
411 dst_alpha_scan++; 412 dst_alpha_scan++;
412 src_scan += 3; 413 src_scan += 3;
413 continue; 414 continue;
414 } 415 }
415 uint8_t src_alpha = *src_alpha_scan++; 416 uint8_t src_alpha = *src_alpha_scan++;
416 if (clip_scan) { 417 if (clip_scan)
417 src_alpha = clip_scan[col] * src_alpha / 255; 418 src_alpha = clip_scan[col] * src_alpha / 255;
418 } 419
419 if (src_alpha == 0) { 420 if (src_alpha == 0) {
420 dest_scan++; 421 dest_scan++;
421 dst_alpha_scan++; 422 dst_alpha_scan++;
422 src_scan += 3; 423 src_scan += 3;
423 continue; 424 continue;
424 } 425 }
425 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 426 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
426 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 427 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
427 uint8_t gray; 428 uint8_t gray;
428 if (pIccTransform) { 429 if (pIccTransform)
429 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 430 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
430 } else { 431 else
431 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 432 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
432 } 433
433 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 434 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
434 dest_scan++; 435 dest_scan++;
435 dst_alpha_scan++; 436 dst_alpha_scan++;
436 src_scan += 3; 437 src_scan += 3;
437 } 438 }
438 } else 439 } else {
439 for (int col = 0; col < pixel_count; col++) { 440 for (int col = 0; col < pixel_count; col++) {
440 uint8_t back_alpha = *dst_alpha_scan; 441 uint8_t back_alpha = *dst_alpha_scan;
441 if (back_alpha == 0) { 442 if (back_alpha == 0) {
442 int src_alpha = src_scan[3]; 443 int src_alpha = src_scan[3];
443 if (clip_scan) { 444 if (clip_scan)
444 src_alpha = clip_scan[col] * src_alpha / 255; 445 src_alpha = clip_scan[col] * src_alpha / 255;
445 } 446
446 if (src_alpha) { 447 if (src_alpha) {
447 if (pIccTransform) { 448 if (pIccTransform) {
448 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 449 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
449 1); 450 1);
450 } else { 451 } else {
451 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 452 *dest_scan = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
452 } 453 }
453 *dst_alpha_scan = src_alpha; 454 *dst_alpha_scan = src_alpha;
454 } 455 }
455 dest_scan++; 456 dest_scan++;
456 dst_alpha_scan++; 457 dst_alpha_scan++;
457 src_scan += 4; 458 src_scan += 4;
458 continue; 459 continue;
459 } 460 }
460 uint8_t src_alpha = src_scan[3]; 461 uint8_t src_alpha = src_scan[3];
461 if (clip_scan) { 462 if (clip_scan)
462 src_alpha = clip_scan[col] * src_alpha / 255; 463 src_alpha = clip_scan[col] * src_alpha / 255;
463 } 464
464 if (src_alpha == 0) { 465 if (src_alpha == 0) {
465 dest_scan++; 466 dest_scan++;
466 dst_alpha_scan++; 467 dst_alpha_scan++;
467 src_scan += 4; 468 src_scan += 4;
468 continue; 469 continue;
469 } 470 }
470 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha); 471 *dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
471 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); 472 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
472 uint8_t gray; 473 uint8_t gray;
473 if (pIccTransform) { 474 if (pIccTransform)
474 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 475 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
475 } else { 476 else
476 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 477 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
477 } 478
478 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); 479 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
479 dest_scan++; 480 dest_scan++;
480 dst_alpha_scan++; 481 dst_alpha_scan++;
481 src_scan += 4; 482 src_scan += 4;
482 } 483 }
484 }
483 } 485 }
486
484 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, 487 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan,
485 const uint8_t* src_scan, 488 const uint8_t* src_scan,
486 int pixel_count, 489 int pixel_count,
487 int blend_type, 490 int blend_type,
488 const uint8_t* clip_scan, 491 const uint8_t* clip_scan,
489 const uint8_t* src_alpha_scan, 492 const uint8_t* src_alpha_scan,
490 void* pIccTransform) { 493 void* pIccTransform) {
491 ICodec_IccModule* pIccModule = NULL; 494 ICodec_IccModule* pIccModule = NULL;
492 uint8_t gray; 495 uint8_t gray;
493 if (pIccTransform) { 496 if (pIccTransform)
494 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 497 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
495 } 498
496 if (blend_type) { 499 if (blend_type) {
497 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; 500 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
498 int blended_color; 501 int blended_color;
499 if (src_alpha_scan) { 502 if (src_alpha_scan) {
500 for (int col = 0; col < pixel_count; col++) { 503 for (int col = 0; col < pixel_count; col++) {
501 int src_alpha = *src_alpha_scan++; 504 int src_alpha = *src_alpha_scan++;
502 if (clip_scan) { 505 if (clip_scan)
503 src_alpha = clip_scan[col] * src_alpha / 255; 506 src_alpha = clip_scan[col] * src_alpha / 255;
504 } 507
505 if (src_alpha) { 508 if (src_alpha) {
506 if (pIccTransform) { 509 if (pIccTransform)
507 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 510 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
508 } else { 511 else
509 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 512 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
510 } 513
511 if (bNonseparableBlend) { 514 if (bNonseparableBlend) {
512 blended_color = 515 blended_color =
513 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 516 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
514 } 517 }
515 gray = bNonseparableBlend ? blended_color 518 gray = bNonseparableBlend ? blended_color
516 : _BLEND(blend_type, *dest_scan, gray); 519 : _BLEND(blend_type, *dest_scan, gray);
517 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 520 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
518 } 521 }
519 dest_scan++; 522 dest_scan++;
520 src_scan += 3; 523 src_scan += 3;
521 } 524 }
522 } else 525 } else {
523 for (int col = 0; col < pixel_count; col++) { 526 for (int col = 0; col < pixel_count; col++) {
524 int src_alpha = src_scan[3]; 527 int src_alpha = src_scan[3];
525 if (clip_scan) { 528 if (clip_scan)
526 src_alpha = clip_scan[col] * src_alpha / 255; 529 src_alpha = clip_scan[col] * src_alpha / 255;
527 } 530
528 if (src_alpha) { 531 if (src_alpha) {
529 if (pIccTransform) { 532 if (pIccTransform)
530 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 533 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
531 } else { 534 else
532 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 535 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
533 } 536
534 if (bNonseparableBlend) { 537 if (bNonseparableBlend) {
535 blended_color = 538 blended_color =
536 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; 539 blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
537 } 540 }
538 gray = bNonseparableBlend ? blended_color 541 gray = bNonseparableBlend ? blended_color
539 : _BLEND(blend_type, *dest_scan, gray); 542 : _BLEND(blend_type, *dest_scan, gray);
540 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 543 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
541 } 544 }
542 dest_scan++; 545 dest_scan++;
543 src_scan += 4; 546 src_scan += 4;
544 } 547 }
548 }
545 return; 549 return;
546 } 550 }
547 if (src_alpha_scan) { 551 if (src_alpha_scan) {
548 for (int col = 0; col < pixel_count; col++) { 552 for (int col = 0; col < pixel_count; col++) {
549 int src_alpha = *src_alpha_scan++; 553 int src_alpha = *src_alpha_scan++;
550 if (clip_scan) { 554 if (clip_scan)
551 src_alpha = clip_scan[col] * src_alpha / 255; 555 src_alpha = clip_scan[col] * src_alpha / 255;
552 } 556
553 if (src_alpha) { 557 if (src_alpha) {
554 if (pIccTransform) { 558 if (pIccTransform)
555 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 559 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
556 } else { 560 else
557 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 561 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
558 } 562
559 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 563 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
560 } 564 }
561 dest_scan++; 565 dest_scan++;
562 src_scan += 3; 566 src_scan += 3;
563 } 567 }
564 } else 568 } else {
565 for (int col = 0; col < pixel_count; col++) { 569 for (int col = 0; col < pixel_count; col++) {
566 int src_alpha = src_scan[3]; 570 int src_alpha = src_scan[3];
567 if (clip_scan) { 571 if (clip_scan)
568 src_alpha = clip_scan[col] * src_alpha / 255; 572 src_alpha = clip_scan[col] * src_alpha / 255;
569 } 573
570 if (src_alpha) { 574 if (src_alpha) {
571 if (pIccTransform) { 575 if (pIccTransform)
572 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); 576 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
573 } else { 577 else
574 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); 578 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
575 } 579
576 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 580 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
577 } 581 }
578 dest_scan++; 582 dest_scan++;
579 src_scan += 4; 583 src_scan += 4;
580 } 584 }
585 }
581 } 586 }
587
582 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, 588 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan,
583 const uint8_t* src_scan, 589 const uint8_t* src_scan,
584 int src_Bpp, 590 int src_Bpp,
585 int pixel_count, 591 int pixel_count,
586 int blend_type, 592 int blend_type,
587 const uint8_t* clip_scan, 593 const uint8_t* clip_scan,
588 void* pIccTransform) { 594 void* pIccTransform) {
589 ICodec_IccModule* pIccModule = NULL; 595 ICodec_IccModule* pIccModule = NULL;
590 uint8_t gray; 596 uint8_t gray;
591 if (pIccTransform) { 597 if (pIccTransform) {
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 dest_scan[3] = dest_alpha; 2328 dest_scan[3] = dest_alpha;
2323 int alpha_ratio = src_alpha * 255 / dest_alpha; 2329 int alpha_ratio = src_alpha * 255 / dest_alpha;
2324 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2330 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2325 dest_scan++; 2331 dest_scan++;
2326 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2332 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2327 dest_scan++; 2333 dest_scan++;
2328 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2334 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2329 dest_scan++; 2335 dest_scan++;
2330 dest_scan++; 2336 dest_scan++;
2331 } 2337 }
2332 } else 2338 } else {
2333 for (int col = 0; col < width; col++) { 2339 for (int col = 0; col < width; col++) {
2334 FX_ARGB argb = pPalette[*src_scan]; 2340 FX_ARGB argb = pPalette[*src_scan];
2335 int src_r = FXARGB_R(argb); 2341 int src_r = FXARGB_R(argb);
2336 int src_g = FXARGB_G(argb); 2342 int src_g = FXARGB_G(argb);
2337 int src_b = FXARGB_B(argb); 2343 int src_b = FXARGB_B(argb);
2338 if (!clip_scan || clip_scan[col] == 255) { 2344 if (!clip_scan || clip_scan[col] == 255) {
2339 *dest_scan++ = src_b; 2345 *dest_scan++ = src_b;
2340 *dest_scan++ = src_g; 2346 *dest_scan++ = src_g;
2341 *dest_scan++ = src_r; 2347 *dest_scan++ = src_r;
2342 *dest_scan++ = 255; 2348 *dest_scan++ = 255;
(...skipping 13 matching lines...) Expand all
2356 int alpha_ratio = src_alpha * 255 / dest_alpha; 2362 int alpha_ratio = src_alpha * 255 / dest_alpha;
2357 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2363 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2358 dest_scan++; 2364 dest_scan++;
2359 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2365 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2360 dest_scan++; 2366 dest_scan++;
2361 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2367 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2362 dest_scan++; 2368 dest_scan++;
2363 dest_scan++; 2369 dest_scan++;
2364 src_scan++; 2370 src_scan++;
2365 } 2371 }
2372 }
2366 } 2373 }
2374
2367 void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, 2375 void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
2368 const uint8_t* src_scan, 2376 const uint8_t* src_scan,
2369 int width, 2377 int width,
2370 FX_DWORD* pPalette, 2378 FX_DWORD* pPalette,
2371 const uint8_t* clip_scan, 2379 const uint8_t* clip_scan,
2372 uint8_t* dest_alpha_scan, 2380 uint8_t* dest_alpha_scan,
2373 const uint8_t* src_alpha_scan) { 2381 const uint8_t* src_alpha_scan) {
2374 if (src_alpha_scan) { 2382 if (src_alpha_scan) {
2375 for (int col = 0; col < width; col++) { 2383 for (int col = 0; col < width; col++) {
2376 FX_ARGB argb = pPalette[*src_scan]; 2384 FX_ARGB argb = pPalette[*src_scan];
(...skipping 30 matching lines...) Expand all
2407 back_alpha + src_alpha - back_alpha * src_alpha / 255; 2415 back_alpha + src_alpha - back_alpha * src_alpha / 255;
2408 *dest_alpha_scan++ = dest_alpha; 2416 *dest_alpha_scan++ = dest_alpha;
2409 int alpha_ratio = src_alpha * 255 / dest_alpha; 2417 int alpha_ratio = src_alpha * 255 / dest_alpha;
2410 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2418 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2411 dest_scan++; 2419 dest_scan++;
2412 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2420 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2413 dest_scan++; 2421 dest_scan++;
2414 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2422 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2415 dest_scan++; 2423 dest_scan++;
2416 } 2424 }
2417 } else 2425 } else {
2418 for (int col = 0; col < width; col++) { 2426 for (int col = 0; col < width; col++) {
2419 FX_ARGB argb = pPalette[*src_scan]; 2427 FX_ARGB argb = pPalette[*src_scan];
2420 int src_r = FXARGB_R(argb); 2428 int src_r = FXARGB_R(argb);
2421 int src_g = FXARGB_G(argb); 2429 int src_g = FXARGB_G(argb);
2422 int src_b = FXARGB_B(argb); 2430 int src_b = FXARGB_B(argb);
2423 if (!clip_scan || clip_scan[col] == 255) { 2431 if (!clip_scan || clip_scan[col] == 255) {
2424 *dest_scan++ = src_b; 2432 *dest_scan++ = src_b;
2425 *dest_scan++ = src_g; 2433 *dest_scan++ = src_g;
2426 *dest_scan++ = src_r; 2434 *dest_scan++ = src_r;
2427 *dest_alpha_scan++ = 255; 2435 *dest_alpha_scan++ = 255;
(...skipping 13 matching lines...) Expand all
2441 *dest_alpha_scan++ = dest_alpha; 2449 *dest_alpha_scan++ = dest_alpha;
2442 int alpha_ratio = src_alpha * 255 / dest_alpha; 2450 int alpha_ratio = src_alpha * 255 / dest_alpha;
2443 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); 2451 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
2444 dest_scan++; 2452 dest_scan++;
2445 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); 2453 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
2446 dest_scan++; 2454 dest_scan++;
2447 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); 2455 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
2448 dest_scan++; 2456 dest_scan++;
2449 src_scan++; 2457 src_scan++;
2450 } 2458 }
2459 }
2451 } 2460 }
2461
2452 inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, 2462 inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan,
2453 const uint8_t* src_scan, 2463 const uint8_t* src_scan,
2454 int src_left, 2464 int src_left,
2455 int width, 2465 int width,
2456 FX_DWORD* pPalette, 2466 FX_DWORD* pPalette,
2457 const uint8_t* clip_scan) { 2467 const uint8_t* clip_scan) {
2458 int reset_r, reset_g, reset_b; 2468 int reset_r, reset_g, reset_b;
2459 int set_r, set_g, set_b; 2469 int set_r, set_g, set_b;
2460 reset_r = FXARGB_R(pPalette[0]); 2470 reset_r = FXARGB_R(pPalette[0]);
2461 reset_g = FXARGB_G(pPalette[0]); 2471 reset_g = FXARGB_G(pPalette[0]);
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
4113 pDestPalette = (FX_DWORD*)gray_pal; 4123 pDestPalette = (FX_DWORD*)gray_pal;
4114 if (isSrcCmyk) { 4124 if (isSrcCmyk) {
4115 for (int i = 0; i < pal_count; i++) { 4125 for (int i = 0; i < pal_count; i++) {
4116 FX_CMYK cmyk = pSrcPalette[i]; 4126 FX_CMYK cmyk = pSrcPalette[i];
4117 uint8_t r, g, b; 4127 uint8_t r, g, b;
4118 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), 4128 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
4119 FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, 4129 FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r,
4120 g, b); 4130 g, b);
4121 *gray_pal++ = FXRGB2GRAY(r, g, b); 4131 *gray_pal++ = FXRGB2GRAY(r, g, b);
4122 } 4132 }
4123 } else 4133 } else {
4124 for (int i = 0; i < pal_count; i++) { 4134 for (int i = 0; i < pal_count; i++) {
4125 FX_ARGB argb = pSrcPalette[i]; 4135 FX_ARGB argb = pSrcPalette[i];
4126 *gray_pal++ = 4136 *gray_pal++ =
4127 FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb)); 4137 FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
4128 } 4138 }
4139 }
4129 } else { 4140 } else {
4130 int palsize = 1 << (src_format & 0xff); 4141 int palsize = 1 << (src_format & 0xff);
4131 pDestPalette = FX_Alloc(FX_DWORD, palsize); 4142 pDestPalette = FX_Alloc(FX_DWORD, palsize);
4132 if (isDstCmyk == isSrcCmyk) { 4143 if (isDstCmyk == isSrcCmyk) {
4133 FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(FX_DWORD)); 4144 FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(FX_DWORD));
4134 } else { 4145 } else {
4135 for (int i = 0; i < palsize; i++) { 4146 for (int i = 0; i < palsize; i++) {
4136 FX_CMYK cmyk = pSrcPalette[i]; 4147 FX_CMYK cmyk = pSrcPalette[i];
4137 uint8_t r, g, b; 4148 uint8_t r, g, b;
4138 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), 4149 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
4579 clip_scan); 4590 clip_scan);
4580 } else if ((m_DestFormat & 0xff) == 8) { 4591 } else if ((m_DestFormat & 0xff) == 8) {
4581 if (m_DestFormat & 0x0200) { 4592 if (m_DestFormat & 0x0200) {
4582 _CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4593 _CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4583 width, clip_scan, dst_extra_alpha); 4594 width, clip_scan, dst_extra_alpha);
4584 } else { 4595 } else {
4585 _CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4596 _CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4586 width, clip_scan); 4597 width, clip_scan);
4587 } 4598 }
4588 } else if (m_bRgbByteOrder) { 4599 } else if (m_bRgbByteOrder) {
4589 if (m_DestFormat == FXDIB_Argb) 4600 if (m_DestFormat == FXDIB_Argb) {
4590 _CompositeRow_ByteMask2Argb_RgbByteOrder( 4601 _CompositeRow_ByteMask2Argb_RgbByteOrder(
4591 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4602 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4592 width, m_BlendType, clip_scan); 4603 width, m_BlendType, clip_scan);
4593 else 4604 } else {
4594 _CompositeRow_ByteMask2Rgb_RgbByteOrder( 4605 _CompositeRow_ByteMask2Rgb_RgbByteOrder(
4595 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4606 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4596 width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); 4607 width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
4608 }
4597 return; 4609 return;
4598 } else if (m_DestFormat == FXDIB_Argb) 4610 } else if (m_DestFormat == FXDIB_Argb) {
4599 _CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4611 _CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4600 m_MaskGreen, m_MaskBlue, width, m_BlendType, 4612 m_MaskGreen, m_MaskBlue, width, m_BlendType,
4601 clip_scan); 4613 clip_scan);
4602 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) 4614 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
4603 _CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4615 _CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4604 m_MaskGreen, m_MaskBlue, width, m_BlendType, 4616 m_MaskGreen, m_MaskBlue, width, m_BlendType,
4605 (m_DestFormat & 0xff) >> 3, clip_scan); 4617 (m_DestFormat & 0xff) >> 3, clip_scan);
4606 else if (m_DestFormat == FXDIB_Rgba) 4618 } else if (m_DestFormat == FXDIB_Rgba) {
4607 _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4619 _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4608 m_MaskGreen, m_MaskBlue, width, m_BlendType, 4620 m_MaskGreen, m_MaskBlue, width, m_BlendType,
4609 clip_scan, dst_extra_alpha); 4621 clip_scan, dst_extra_alpha);
4622 }
4610 } 4623 }
4611 void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, 4624 void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan,
4612 const uint8_t* src_scan, 4625 const uint8_t* src_scan,
4613 int src_left, 4626 int src_left,
4614 int width, 4627 int width,
4615 const uint8_t* clip_scan, 4628 const uint8_t* clip_scan,
4616 uint8_t* dst_extra_alpha) { 4629 uint8_t* dst_extra_alpha) {
4617 if (m_DestFormat == FXDIB_8bppMask) { 4630 if (m_DestFormat == FXDIB_8bppMask) {
4618 _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, 4631 _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left,
4619 width, clip_scan); 4632 width, clip_scan);
4620 } else if ((m_DestFormat & 0xff) == 8) { 4633 } else if ((m_DestFormat & 0xff) == 8) {
4621 if (m_DestFormat & 0x0200) 4634 if (m_DestFormat & 0x0200) {
4622 _CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4635 _CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4623 src_left, width, clip_scan, dst_extra_alpha); 4636 src_left, width, clip_scan, dst_extra_alpha);
4624 else { 4637 } else {
4625 _CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4638 _CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4626 src_left, width, clip_scan); 4639 src_left, width, clip_scan);
4627 } 4640 }
4628 } else if (m_bRgbByteOrder) { 4641 } else if (m_bRgbByteOrder) {
4629 if (m_DestFormat == FXDIB_Argb) 4642 if (m_DestFormat == FXDIB_Argb) {
4630 _CompositeRow_BitMask2Argb_RgbByteOrder( 4643 _CompositeRow_BitMask2Argb_RgbByteOrder(
4631 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4644 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4632 src_left, width, m_BlendType, clip_scan); 4645 src_left, width, m_BlendType, clip_scan);
4633 else 4646 } else {
4634 _CompositeRow_BitMask2Rgb_RgbByteOrder( 4647 _CompositeRow_BitMask2Rgb_RgbByteOrder(
4635 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4648 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4636 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); 4649 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
4650 }
4637 return; 4651 return;
4638 } else if (m_DestFormat == FXDIB_Argb) 4652 } else if (m_DestFormat == FXDIB_Argb) {
4639 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, 4653 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
4640 m_MaskGreen, m_MaskBlue, src_left, width, 4654 m_MaskGreen, m_MaskBlue, src_left, width,
4641 m_BlendType, clip_scan); 4655 m_BlendType, clip_scan);
4642 else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) 4656 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
4643 _CompositeRow_BitMask2Rgb( 4657 _CompositeRow_BitMask2Rgb(
4644 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, 4658 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
4645 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); 4659 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
4660 }
4646 } 4661 }
4662
4647 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, 4663 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left,
4648 int dest_top, 4664 int dest_top,
4649 int width, 4665 int width,
4650 int height, 4666 int height,
4651 const CFX_DIBSource* pSrcBitmap, 4667 const CFX_DIBSource* pSrcBitmap,
4652 int src_left, 4668 int src_left,
4653 int src_top, 4669 int src_top,
4654 int blend_type, 4670 int blend_type,
4655 const CFX_ClipRgn* pClipRgn, 4671 const CFX_ClipRgn* pClipRgn,
4656 FX_BOOL bRgbByteOrder, 4672 FX_BOOL bRgbByteOrder,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
4831 } 4847 }
4832 } 4848 }
4833 if (IsCmykImage()) { 4849 if (IsCmykImage()) {
4834 gray = ~gray; 4850 gray = ~gray;
4835 } 4851 }
4836 } 4852 }
4837 for (int row = rect.top; row < rect.bottom; row++) { 4853 for (int row = rect.top; row < rect.bottom; row++) {
4838 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; 4854 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left;
4839 if (src_alpha == 255) { 4855 if (src_alpha == 255) {
4840 FXSYS_memset(dest_scan, gray, width); 4856 FXSYS_memset(dest_scan, gray, width);
4841 } else 4857 } else {
4842 for (int col = 0; col < width; col++) { 4858 for (int col = 0; col < width; col++) {
4843 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); 4859 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
4844 dest_scan++; 4860 dest_scan++;
4845 } 4861 }
4862 }
4846 } 4863 }
4847 return TRUE; 4864 return TRUE;
4848 } 4865 }
4849 if (m_bpp == 1) { 4866 if (m_bpp == 1) {
4850 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); 4867 ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
4851 int left_shift = rect.left % 8; 4868 int left_shift = rect.left % 8;
4852 int right_shift = rect.right % 8; 4869 int right_shift = rect.right % 8;
4853 int width = rect.right / 8 - rect.left / 8; 4870 int width = rect.right / 8 - rect.left / 8;
4854 int index = 0; 4871 int index = 0;
4855 if (m_pPalette) { 4872 if (m_pPalette) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4887 } 4904 }
4888 ASSERT(m_bpp >= 24); 4905 ASSERT(m_bpp >= 24);
4889 if (m_bpp < 24) { 4906 if (m_bpp < 24) {
4890 return FALSE; 4907 return FALSE;
4891 } 4908 }
4892 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { 4909 if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) {
4893 ICodec_IccModule* pIccModule = 4910 ICodec_IccModule* pIccModule =
4894 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 4911 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
4895 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1); 4912 pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
4896 } else { 4913 } else {
4897 if (alpha_flag >> 8 && !IsCmykImage()) 4914 if (alpha_flag >> 8 && !IsCmykImage()) {
4898 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), 4915 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
4899 FXSYS_GetYValue(color), FXSYS_GetKValue(color), 4916 FXSYS_GetYValue(color), FXSYS_GetKValue(color),
4900 color_p[2], color_p[1], color_p[0]); 4917 color_p[2], color_p[1], color_p[0]);
4901 else if (!(alpha_flag >> 8) && IsCmykImage()) { 4918 } else if (!(alpha_flag >> 8) && IsCmykImage()) {
4902 return FALSE; 4919 return FALSE;
4903 } 4920 }
4904 } 4921 }
4905 if (!IsCmykImage()) { 4922 if (!IsCmykImage()) {
4906 color_p[3] = (uint8_t)src_alpha; 4923 color_p[3] = (uint8_t)src_alpha;
4907 } 4924 }
4908 int Bpp = m_bpp / 8; 4925 int Bpp = m_bpp / 8;
4909 FX_BOOL bAlpha = HasAlpha(); 4926 FX_BOOL bAlpha = HasAlpha();
4910 bool bArgb = GetFormat() == FXDIB_Argb; 4927 bool bArgb = GetFormat() == FXDIB_Argb;
4911 if (src_alpha == 255) { 4928 if (src_alpha == 255) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
5184 } 5201 }
5185 src_alpha_scan = m_pScanlineAlphaV; 5202 src_alpha_scan = m_pScanlineAlphaV;
5186 dest_alpha_scan = dest_alpha_buf; 5203 dest_alpha_scan = dest_alpha_buf;
5187 if (dest_alpha_scan) { 5204 if (dest_alpha_scan) {
5188 for (i = 0; i < m_DestHeight; i++) { 5205 for (i = 0; i < m_DestHeight; i++) {
5189 *dest_alpha_scan = *src_alpha_scan++; 5206 *dest_alpha_scan = *src_alpha_scan++;
5190 dest_alpha_scan += y_alpha_step; 5207 dest_alpha_scan += y_alpha_step;
5191 } 5208 }
5192 } 5209 }
5193 } 5210 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_system_unittest.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