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

Side by Side Diff: core/src/fxge/skia/fx_skia_blitter_new.cpp

Issue 1730553002: Fixing whitespace lint errors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review fixes Created 4 years, 10 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/freetype/fx_freetype.c ('k') | core/src/fxge/skia/fx_skia_device.h » ('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 #include "core/include/fxge/fx_ge.h" 5 #include "core/include/fxge/fx_ge.h"
6 6
7 //#define _SKIA_SUPPORT_
8 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
9 #include "SkBlitter.h" 8 #include "SkBlitter.h"
10 #include "core/include/fxcodec/fx_codec.h" 9 #include "core/include/fxcodec/fx_codec.h"
11 #include "core/src/fxge/skia/fx_skia_blitter_new.h" 10 #include "core/src/fxge/skia/fx_skia_blitter_new.h"
12 11
13 // We use our own renderer here to make it simple 12 // We use our own renderer here to make it simple
14 void CFX_SkiaRenderer::blitAntiH(int x, 13 void CFX_SkiaRenderer::blitAntiH(int x,
15 int y, 14 int y,
16 const SkAlpha antialias[], 15 const SkAlpha antialias[],
17 const int16_t runs[]) { 16 const int16_t runs[]) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 int col_start = span_left < clip_left ? clip_left - span_left : 0; 382 int col_start = span_left < clip_left ? clip_left - span_left : 0;
384 int col_end = 383 int col_end =
385 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); 384 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
386 if (col_end < col_start) 385 if (col_end < col_start)
387 return; // do nothing. 386 return; // do nothing.
388 dest_scan += col_start << 2; 387 dest_scan += col_start << 2;
389 if (m_Alpha == 255 && cover_scan == 255) { 388 if (m_Alpha == 255 && cover_scan == 255) {
390 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2); 389 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2);
391 return; 390 return;
392 } 391 }
393 int src_alpha; 392 int src_alpha = m_Alpha * cover_scan / 255;
394 #if 0
395 if (m_bFullCover) {
396 if (m_Alpha == 255) {
397 FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
398 return;
399 }
400 }
401 else
402 #endif
403 src_alpha = m_Alpha * cover_scan / 255;
404 for (int col = col_start; col < col_end; col++) { 393 for (int col = col_start; col < col_end; col++) {
405 // Dest format: Argb 394 // Dest format: Argb
406 // calculate destination alpha (it's union of source and dest alpha) 395 // calculate destination alpha (it's union of source and dest alpha)
407 if (dest_scan[3] == 0) { 396 if (dest_scan[3] == 0) {
408 dest_scan[3] = src_alpha; 397 dest_scan[3] = src_alpha;
409 *dest_scan++ = m_Blue; 398 *dest_scan++ = m_Blue;
410 *dest_scan++ = m_Green; 399 *dest_scan++ = m_Green;
411 *dest_scan = m_Red; 400 *dest_scan = m_Red;
412 dest_scan += 2; 401 dest_scan += 2;
413 continue; 402 continue;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 int col_start = span_left < clip_left ? clip_left - span_left : 0; 673 int col_start = span_left < clip_left ? clip_left - span_left : 0;
685 int col_end = 674 int col_end =
686 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); 675 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
687 if (col_end < col_start) 676 if (col_end < col_start)
688 return; // do nothing. 677 return; // do nothing.
689 dest_scan += (col_start << 2); 678 dest_scan += (col_start << 2);
690 if (m_Alpha == 255 && cover_scan == 255) { 679 if (m_Alpha == 255 && cover_scan == 255) {
691 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2); 680 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2);
692 return; 681 return;
693 } 682 }
694 int src_alpha; 683 int src_alpha = m_Alpha * cover_scan / 255;
695 #if 0
696 if (m_bFullCover)
697 src_alpha = m_Alpha;
698 else
699 #endif
700 src_alpha = m_Alpha * cover_scan / 255;
701 for (int col = col_start; col < col_end; col++) { 684 for (int col = col_start; col < col_end; col++) {
702 // Dest format: Rgb32 685 // Dest format: Rgb32
703 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha); 686 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
704 dest_scan++; 687 dest_scan++;
705 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha); 688 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
706 dest_scan++; 689 dest_scan++;
707 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha); 690 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
708 dest_scan += 2; 691 dest_scan += 2;
709 } 692 }
710 } 693 }
(...skipping 17 matching lines...) Expand all
728 if (col_end < col_start) 711 if (col_end < col_start)
729 return; // do nothing. 712 return; // do nothing.
730 dest_scan += col_start << 2; 713 dest_scan += col_start << 2;
731 ori_scan += col_start << 2; 714 ori_scan += col_start << 2;
732 if (m_Alpha == 255 && cover_scan == 255) { 715 if (m_Alpha == 255 && cover_scan == 255) {
733 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2); 716 FXSYS_memset(dest_scan, m_Color, (col_end - col_start) << 2);
734 return; 717 return;
735 } 718 }
736 int src_alpha = m_Alpha; 719 int src_alpha = m_Alpha;
737 for (int col = col_start; col < col_end; col++) { 720 for (int col = col_start; col < col_end; col++) {
738 #if 0
739 if (m_bFullCover) {
740 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha) ;
741 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha );
742 *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
743 dest_scan += 2; ori_scan += 2;
744 continue;
745 }
746 #endif
747 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha); 721 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
748 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha); 722 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
749 int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha); 723 int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
750 ori_scan += 2; 724 ori_scan += 2;
751 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan); 725 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan);
752 dest_scan++; 726 dest_scan++;
753 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan); 727 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
754 dest_scan++; 728 dest_scan++;
755 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan); 729 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
756 dest_scan += 2; 730 dest_scan += 2;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 uint8_t* clip_scan, 921 uint8_t* clip_scan,
948 uint8_t* dest_extra_alpha_scan) { 922 uint8_t* dest_extra_alpha_scan) {
949 dest_scan = 923 dest_scan =
950 (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left << 1); 924 (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left << 1);
951 int col_start = span_left < clip_left ? clip_left - span_left : 0; 925 int col_start = span_left < clip_left ? clip_left - span_left : 0;
952 int col_end = 926 int col_end =
953 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left); 927 (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
954 if (col_end < col_start) 928 if (col_end < col_start)
955 return; // do nothing. 929 return; // do nothing.
956 dest_scan += (col_start << 1) + col_start; 930 dest_scan += (col_start << 1) + col_start;
957 int src_alpha; 931 int src_alpha = m_Alpha * cover_scan / 255;
958 #if 0
959 if (m_bFullCover)
960 src_alpha = m_Alpha;
961 else
962 #endif
963 src_alpha = m_Alpha * cover_scan / 255;
964 if (src_alpha == 255) { 932 if (src_alpha == 255) {
965 for (int col = col_start; col < col_end; col++) { 933 for (int col = col_start; col < col_end; col++) {
966 *dest_scan++ = m_Blue; 934 *dest_scan++ = m_Blue;
967 *dest_scan++ = m_Green; 935 *dest_scan++ = m_Green;
968 *dest_scan++ = m_Red; 936 *dest_scan++ = m_Red;
969 } 937 }
970 return; 938 return;
971 } 939 }
972 for (int col = col_start; col < col_end; col++) { 940 for (int col = col_start; col < col_end; col++) {
973 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha); 941 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
(...skipping 30 matching lines...) Expand all
1004 ori_scan += (col_start << 1) + col_start; 972 ori_scan += (col_start << 1) + col_start;
1005 if (m_Alpha == 255 && cover_scan == 255) { 973 if (m_Alpha == 255 && cover_scan == 255) {
1006 for (int col = col_start; col < col_end; col++) { 974 for (int col = col_start; col < col_end; col++) {
1007 *dest_scan++ = m_Blue; 975 *dest_scan++ = m_Blue;
1008 *dest_scan++ = m_Green; 976 *dest_scan++ = m_Green;
1009 *dest_scan++ = m_Red; 977 *dest_scan++ = m_Red;
1010 } 978 }
1011 return; 979 return;
1012 } 980 }
1013 for (int col = col_start; col < col_end; col++) { 981 for (int col = col_start; col < col_end; col++) {
1014 #if 0
1015 if (m_bFullCover) {
1016 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
1017 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
1018 *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
1019 continue;
1020 }
1021 #endif
1022 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha); 982 int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
1023 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha); 983 int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
1024 int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha); 984 int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
1025 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan); 985 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, b, cover_scan);
1026 dest_scan++; 986 dest_scan++;
1027 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan); 987 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
1028 dest_scan++; 988 dest_scan++;
1029 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan); 989 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
1030 dest_scan++; 990 dest_scan++;
1031 } 991 }
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 1483
1524 //-------------------------------------------------------------------- 1484 //--------------------------------------------------------------------
1525 FX_BOOL CFX_SkiaRenderer::Init( 1485 FX_BOOL CFX_SkiaRenderer::Init(
1526 CFX_DIBitmap* pDevice, 1486 CFX_DIBitmap* pDevice,
1527 CFX_DIBitmap* pOriDevice, 1487 CFX_DIBitmap* pOriDevice,
1528 const CFX_ClipRgn* pClipRgn, 1488 const CFX_ClipRgn* pClipRgn,
1529 FX_DWORD color, 1489 FX_DWORD color,
1530 FX_BOOL bFullCover, 1490 FX_BOOL bFullCover,
1531 FX_BOOL bRgbByteOrder, 1491 FX_BOOL bRgbByteOrder,
1532 int alpha_flag, 1492 int alpha_flag,
1533 void* pIccTransform) // The alpha flag must be fill_flag if exist. 1493 void* pIccTransform) { // The alpha flag must be fill_flag if exist.
1534 {
1535 m_pDevice = pDevice; 1494 m_pDevice = pDevice;
1536 m_pClipRgn = pClipRgn; 1495 m_pClipRgn = pClipRgn;
1537 m_bRgbByteOrder = bRgbByteOrder; 1496 m_bRgbByteOrder = bRgbByteOrder;
1538 m_pOriDevice = pOriDevice; 1497 m_pOriDevice = pOriDevice;
1539 m_pDestScan = NULL; 1498 m_pDestScan = NULL;
1540 m_pDestExtraAlphaScan = NULL; 1499 m_pDestExtraAlphaScan = NULL;
1541 m_pOriScan = NULL; 1500 m_pOriScan = NULL;
1542 m_pClipScan = NULL; 1501 m_pClipScan = NULL;
1543 composite_span = NULL; 1502 composite_span = NULL;
1544 if (m_pClipRgn) 1503 if (m_pClipRgn)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 m_Gray = FXRGB2GRAY(r, g, b); 1555 m_Gray = FXRGB2GRAY(r, g, b);
1597 } else { 1556 } else {
1598 m_Gray = 1557 m_Gray =
1599 FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color)); 1558 FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
1600 } 1559 }
1601 } 1560 }
1602 } 1561 }
1603 } else { 1562 } else {
1604 if (bDeviceCMYK) { // Cmyk(a) Device 1563 if (bDeviceCMYK) { // Cmyk(a) Device
1605 ASSERT(!m_bRgbByteOrder); 1564 ASSERT(!m_bRgbByteOrder);
1606 // TODO... opt for cmyk 1565 // TODO ... opt for cmyk
1607 composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK; 1566 composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK;
1608 if (bObjectCMYK) { 1567 if (bObjectCMYK) {
1609 m_Color = FXCMYK_TODIB(color); 1568 m_Color = FXCMYK_TODIB(color);
1610 if (pIccTransform) 1569 if (pIccTransform)
1611 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, 1570 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color,
1612 (const uint8_t*)&m_Color, 1); 1571 (const uint8_t*)&m_Color, 1);
1613 } else { // Object RGB 1572 } else { // Object RGB
1614 if (!pIccTransform) 1573 if (!pIccTransform)
1615 return FALSE; 1574 return FALSE;
1616 color = FXARGB_TODIB(color); 1575 color = FXARGB_TODIB(color);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 : &CFX_SkiaRenderer::CompositeSpanRGB32_7; 1681 : &CFX_SkiaRenderer::CompositeSpanRGB32_7;
1723 } break; 1682 } break;
1724 case 1: 1683 case 1:
1725 case 5: 1684 case 5:
1726 case 8: 1685 case 8:
1727 case 9: 1686 case 9:
1728 case 11: 1687 case 11:
1729 case 12: 1688 case 12:
1730 case 13: 1689 case 13:
1731 case 15: 1690 case 15:
1732 // TODO... 1691 // TODO ...
1733 break; 1692 break;
1734 case 10: 1693 case 10:
1735 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10; 1694 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10;
1736 break; 1695 break;
1737 case 14: 1696 case 14:
1738 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14; 1697 composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14;
1739 break; 1698 break;
1740 } 1699 }
1741 return !!composite_span; 1700 return !!composite_span;
1742 } 1701 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 m_pDevice = pDevice; 1800 m_pDevice = pDevice;
1842 m_Left = Left; 1801 m_Left = Left;
1843 m_Top = Top; 1802 m_Top = Top;
1844 if (pDevice) { 1803 if (pDevice) {
1845 m_dstWidth = m_Left + pDevice->GetWidth(); 1804 m_dstWidth = m_Left + pDevice->GetWidth();
1846 m_dstHeight = m_Top + pDevice->GetHeight(); 1805 m_dstHeight = m_Top + pDevice->GetHeight();
1847 } 1806 }
1848 return TRUE; 1807 return TRUE;
1849 } 1808 }
1850 #endif 1809 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/freetype/fx_freetype.c ('k') | core/src/fxge/skia/fx_skia_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698