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

Side by Side Diff: xfa/fxfa/app/xfa_ffwidget.cpp

Issue 2011943004: Remove default arguments in CFX_RenderDevice. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 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/fxge/include/fx_ge.h ('k') | no next file » | 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 "xfa/fxfa/include/xfa_ffwidget.h" 7 #include "xfa/fxfa/include/xfa_ffwidget.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 int blendType) { 551 int blendType) {
552 m_pDevice = pDevice; 552 m_pDevice = pDevice;
553 m_pDIBSource = pDIBSource; 553 m_pDIBSource = pDIBSource;
554 m_FillArgb = bitmap_argb; 554 m_FillArgb = bitmap_argb;
555 m_BitmapAlpha = bitmap_alpha; 555 m_BitmapAlpha = bitmap_alpha;
556 m_ImageMatrix = *pImage2Device; 556 m_ImageMatrix = *pImage2Device;
557 m_Flags = flags; 557 m_Flags = flags;
558 m_BlendType = blendType; 558 m_BlendType = blendType;
559 return StartDIBSource(); 559 return StartDIBSource();
560 } 560 }
561
561 FX_BOOL CXFA_ImageRenderer::StartDIBSource() { 562 FX_BOOL CXFA_ImageRenderer::StartDIBSource() {
562 if (m_pDevice->StartDIBits(m_pDIBSource, m_BitmapAlpha, m_FillArgb, 563 if (m_pDevice->StartDIBitsWithBlend(m_pDIBSource, m_BitmapAlpha, m_FillArgb,
563 &m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, 564 &m_ImageMatrix, m_Flags, m_DeviceHandle,
564 m_BlendType)) { 565 m_BlendType)) {
565 if (m_DeviceHandle) { 566 if (m_DeviceHandle) {
566 m_Status = 3; 567 m_Status = 3;
567 return TRUE; 568 return TRUE;
568 } 569 }
569 return FALSE; 570 return FALSE;
570 } 571 }
571 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); 572 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
572 FX_RECT image_rect = image_rect_f.GetOutterRect(); 573 FX_RECT image_rect = image_rect_f.GetOutterRect();
573 int dest_width = image_rect.Width(); 574 int dest_width = image_rect.Width();
574 int dest_height = image_rect.Height(); 575 int dest_height = image_rect.Height();
(...skipping 25 matching lines...) Expand all
600 if (m_ImageMatrix.a < 0) { 601 if (m_ImageMatrix.a < 0) {
601 dest_width = -dest_width; 602 dest_width = -dest_width;
602 } 603 }
603 if (m_ImageMatrix.d > 0) { 604 if (m_ImageMatrix.d > 0) {
604 dest_height = -dest_height; 605 dest_height = -dest_height;
605 } 606 }
606 int dest_left, dest_top; 607 int dest_left, dest_top;
607 dest_left = dest_width > 0 ? image_rect.left : image_rect.right; 608 dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
608 dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom; 609 dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;
609 if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) { 610 if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
610 if (m_pDevice->StretchDIBits(m_pDIBSource, dest_left, dest_top, dest_width, 611 if (m_pDevice->StretchDIBitsWithFlagsAndBlend(
611 dest_height, m_Flags, NULL, m_BlendType)) { 612 m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
613 m_BlendType)) {
612 return FALSE; 614 return FALSE;
613 } 615 }
614 } 616 }
615 if (m_pDIBSource->IsAlphaMask()) { 617 if (m_pDIBSource->IsAlphaMask()) {
616 if (m_BitmapAlpha != 255) { 618 if (m_BitmapAlpha != 255) {
617 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); 619 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
618 } 620 }
619 if (m_pDevice->StretchBitMask(m_pDIBSource, dest_left, dest_top, dest_width, 621 if (m_pDevice->StretchBitMaskWithFlags(m_pDIBSource, dest_left, dest_top,
620 dest_height, m_FillArgb, m_Flags)) { 622 dest_width, dest_height, m_FillArgb,
623 m_Flags)) {
621 return FALSE; 624 return FALSE;
622 } 625 }
623 } 626 }
624 if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { 627 if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
625 m_Result = FALSE; 628 m_Result = FALSE;
626 return TRUE; 629 return TRUE;
627 } 630 }
628 FX_RECT clip_box = m_pDevice->GetClipBox(); 631 FX_RECT clip_box = m_pDevice->GetClipBox();
629 FX_RECT dest_rect = clip_box; 632 FX_RECT dest_rect = clip_box;
630 dest_rect.Intersect(image_rect); 633 dest_rect.Intersect(image_rect);
(...skipping 20 matching lines...) Expand all
651 654
652 if (pBitmap->IsAlphaMask()) { 655 if (pBitmap->IsAlphaMask()) {
653 if (m_BitmapAlpha != 255) 656 if (m_BitmapAlpha != 255)
654 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha); 657 m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
655 m_Result = 658 m_Result =
656 m_pDevice->SetBitMask(pBitmap.get(), m_pTransformer->result().left, 659 m_pDevice->SetBitMask(pBitmap.get(), m_pTransformer->result().left,
657 m_pTransformer->result().top, m_FillArgb); 660 m_pTransformer->result().top, m_FillArgb);
658 } else { 661 } else {
659 if (m_BitmapAlpha != 255) 662 if (m_BitmapAlpha != 255)
660 pBitmap->MultiplyAlpha(m_BitmapAlpha); 663 pBitmap->MultiplyAlpha(m_BitmapAlpha);
661 m_Result = 664 m_Result = m_pDevice->SetDIBitsWithBlend(
662 m_pDevice->SetDIBits(pBitmap.get(), m_pTransformer->result().left, 665 pBitmap.get(), m_pTransformer->result().left,
663 m_pTransformer->result().top, m_BlendType); 666 m_pTransformer->result().top, m_BlendType);
664 } 667 }
665 return FALSE; 668 return FALSE;
666 } 669 }
667 if (m_Status == 3) 670 if (m_Status == 3)
668 return m_pDevice->ContinueDIBits(m_DeviceHandle, pPause); 671 return m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
669 672
670 return FALSE; 673 return FALSE;
671 } 674 }
672 675
673 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, 676 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
(...skipping 30 matching lines...) Expand all
704 FX_BOOL bBackAlphaRequired = blend_mode && bIsolated; 707 FX_BOOL bBackAlphaRequired = blend_mode && bIsolated;
705 FX_BOOL bGetBackGround = 708 FX_BOOL bGetBackGround =
706 ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) || 709 ((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
707 (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) && 710 (!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) &&
708 (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired); 711 (m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired);
709 if (bGetBackGround) { 712 if (bGetBackGround) {
710 if (bIsolated || !bGroup) { 713 if (bIsolated || !bGroup) {
711 if (pDIBitmap->IsAlphaMask()) { 714 if (pDIBitmap->IsAlphaMask()) {
712 return; 715 return;
713 } 716 }
714 m_pDevice->SetDIBits(pDIBitmap, left, top, blend_mode); 717 m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode);
715 } else { 718 } else {
716 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), 719 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
717 top + pDIBitmap->GetHeight()); 720 top + pDIBitmap->GetHeight());
718 rect.Intersect(m_pDevice->GetClipBox()); 721 rect.Intersect(m_pDevice->GetClipBox());
719 CFX_DIBitmap* pClone = NULL; 722 CFX_DIBitmap* pClone = NULL;
720 FX_BOOL bClone = FALSE; 723 FX_BOOL bClone = FALSE;
721 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { 724 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
722 bClone = TRUE; 725 bClone = TRUE;
723 pClone = m_pDevice->GetBackDrop()->Clone(&rect); 726 pClone = m_pDevice->GetBackDrop()->Clone(&rect);
724 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap(); 727 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
725 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), 728 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
726 pForeBitmap, rect.left, rect.top); 729 pForeBitmap, rect.left, rect.top);
727 left = left >= 0 ? 0 : left; 730 left = left >= 0 ? 0 : left;
728 top = top >= 0 ? 0 : top; 731 top = top >= 0 ? 0 : top;
729 if (!pDIBitmap->IsAlphaMask()) 732 if (!pDIBitmap->IsAlphaMask())
730 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), 733 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
731 pDIBitmap, left, top, blend_mode); 734 pDIBitmap, left, top, blend_mode);
732 else 735 else
733 pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(), 736 pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(),
734 pDIBitmap, mask_argb, left, top, blend_mode); 737 pDIBitmap, mask_argb, left, top, blend_mode);
735 } else { 738 } else {
736 pClone = pDIBitmap; 739 pClone = pDIBitmap;
737 } 740 }
738 if (m_pDevice->GetBackDrop()) { 741 if (m_pDevice->GetBackDrop()) {
739 m_pDevice->SetDIBits(pClone, rect.left, rect.top); 742 m_pDevice->SetDIBits(pClone, rect.left, rect.top);
740 } else { 743 } else {
741 if (pDIBitmap->IsAlphaMask()) { 744 if (pDIBitmap->IsAlphaMask())
742 return; 745 return;
743 } 746 m_pDevice->SetDIBitsWithBlend(pDIBitmap, rect.left, rect.top,
744 m_pDevice->SetDIBits(pDIBitmap, rect.left, rect.top, blend_mode); 747 blend_mode);
745 } 748 }
746 if (bClone) { 749 if (bClone) {
747 delete pClone; 750 delete pClone;
748 } 751 }
749 } 752 }
750 return; 753 return;
751 } 754 }
752 if (pDIBitmap->HasAlpha() && 755 if (pDIBitmap->HasAlpha() &&
753 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { 756 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) {
754 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); 757 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb);
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 iType != XFA_ELEMENT_Rectangle) { 1979 iType != XFA_ELEMENT_Rectangle) {
1977 return; 1980 return;
1978 } 1981 }
1979 CXFA_StrokeArray strokes; 1982 CXFA_StrokeArray strokes;
1980 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { 1983 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) {
1981 box.GetStrokes(strokes); 1984 box.GetStrokes(strokes);
1982 } 1985 }
1983 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 1986 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
1984 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 1987 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
1985 } 1988 }
OLDNEW
« no previous file with comments | « core/fxge/include/fx_ge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698