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

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

Issue 2227883002: Use smart pointers for class owned pointers in xfa/fxfa (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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 | « xfa/fxfa/app/xfa_ffdocview.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.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 // 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 FX_BOOL Start(CFX_RenderDevice* pDevice, 557 FX_BOOL Start(CFX_RenderDevice* pDevice,
558 CFX_DIBSource* pDIBSource, 558 CFX_DIBSource* pDIBSource,
559 FX_ARGB bitmap_argb, 559 FX_ARGB bitmap_argb,
560 int bitmap_alpha, 560 int bitmap_alpha,
561 const CFX_Matrix* pImage2Device, 561 const CFX_Matrix* pImage2Device,
562 uint32_t flags, 562 uint32_t flags,
563 int blendType = FXDIB_BLEND_NORMAL); 563 int blendType = FXDIB_BLEND_NORMAL);
564 FX_BOOL Continue(IFX_Pause* pPause); 564 FX_BOOL Continue(IFX_Pause* pPause);
565 565
566 protected: 566 protected:
567 FX_BOOL StartDIBSource();
568 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
569 int left,
570 int top,
571 FX_ARGB mask_argb,
572 int bitmap_alpha,
573 int blend_mode,
574 int Transparency);
575
567 CFX_RenderDevice* m_pDevice; 576 CFX_RenderDevice* m_pDevice;
568 int m_Status; 577 int m_Status;
569 CFX_Matrix m_ImageMatrix; 578 CFX_Matrix m_ImageMatrix;
570 CFX_DIBSource* m_pDIBSource; 579 CFX_DIBSource* m_pDIBSource;
571 CFX_DIBitmap* m_pCloneConvert; 580 std::unique_ptr<CFX_DIBitmap> m_pCloneConvert;
572 int m_BitmapAlpha; 581 int m_BitmapAlpha;
573 FX_ARGB m_FillArgb; 582 FX_ARGB m_FillArgb;
574 uint32_t m_Flags; 583 uint32_t m_Flags;
575 std::unique_ptr<CFX_ImageTransformer> m_pTransformer; 584 std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
576 void* m_DeviceHandle; 585 void* m_DeviceHandle;
577 int32_t m_BlendType; 586 int32_t m_BlendType;
578 FX_BOOL m_Result; 587 FX_BOOL m_Result;
579 FX_BOOL m_bPrint; 588 FX_BOOL m_bPrint;
580 FX_BOOL StartDIBSource();
581 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
582 int left,
583 int top,
584 FX_ARGB mask_argb,
585 int bitmap_alpha,
586 int blend_mode,
587 int Transparency);
588 }; 589 };
589 CXFA_ImageRenderer::CXFA_ImageRenderer() { 590
590 m_pDevice = nullptr; 591 CXFA_ImageRenderer::CXFA_ImageRenderer()
591 m_Status = 0; 592 : m_pDevice(nullptr),
592 m_pDIBSource = nullptr; 593 m_Status(0),
593 m_pCloneConvert = nullptr; 594 m_pDIBSource(nullptr),
594 m_BitmapAlpha = 255; 595 m_BitmapAlpha(255),
595 m_FillArgb = 0; 596 m_FillArgb(0),
596 m_Flags = 0; 597 m_Flags(0),
597 m_DeviceHandle = nullptr; 598 m_DeviceHandle(nullptr),
598 m_BlendType = FXDIB_BLEND_NORMAL; 599 m_BlendType(FXDIB_BLEND_NORMAL),
599 m_Result = TRUE; 600 m_Result(TRUE),
600 m_bPrint = FALSE; 601 m_bPrint(FALSE) {}
601 }
602 602
603 CXFA_ImageRenderer::~CXFA_ImageRenderer() { 603 CXFA_ImageRenderer::~CXFA_ImageRenderer() {
604 delete m_pCloneConvert;
605 if (m_DeviceHandle) 604 if (m_DeviceHandle)
606 m_pDevice->CancelDIBits(m_DeviceHandle); 605 m_pDevice->CancelDIBits(m_DeviceHandle);
607 } 606 }
608 607
609 FX_BOOL CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice, 608 FX_BOOL CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
610 CFX_DIBSource* pDIBSource, 609 CFX_DIBSource* pDIBSource,
611 FX_ARGB bitmap_argb, 610 FX_ARGB bitmap_argb,
612 int bitmap_alpha, 611 int bitmap_alpha,
613 const CFX_Matrix* pImage2Device, 612 const CFX_Matrix* pImage2Device,
614 uint32_t flags, 613 uint32_t flags,
(...skipping 25 matching lines...) Expand all
640 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || 639 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) ||
641 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { 640 (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) {
642 if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { 641 if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) {
643 m_Result = FALSE; 642 m_Result = FALSE;
644 return FALSE; 643 return FALSE;
645 } 644 }
646 CFX_DIBSource* pDib = m_pDIBSource; 645 CFX_DIBSource* pDib = m_pDIBSource;
647 if (m_pDIBSource->HasAlpha() && 646 if (m_pDIBSource->HasAlpha() &&
648 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) && 647 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE) &&
649 !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { 648 !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) {
650 m_pCloneConvert = m_pDIBSource->CloneConvert(FXDIB_Rgb); 649 m_pCloneConvert.reset(m_pDIBSource->CloneConvert(FXDIB_Rgb));
651 if (!m_pCloneConvert) { 650 if (!m_pCloneConvert) {
652 m_Result = FALSE; 651 m_Result = FALSE;
653 return FALSE; 652 return FALSE;
654 } 653 }
655 pDib = m_pCloneConvert; 654 pDib = m_pCloneConvert.get();
656 } 655 }
657 FX_RECT clip_box = m_pDevice->GetClipBox(); 656 FX_RECT clip_box = m_pDevice->GetClipBox();
658 clip_box.Intersect(image_rect); 657 clip_box.Intersect(image_rect);
659 m_Status = 2; 658 m_Status = 2;
660 m_pTransformer.reset( 659 m_pTransformer.reset(
661 new CFX_ImageTransformer(pDib, &m_ImageMatrix, m_Flags, &clip_box)); 660 new CFX_ImageTransformer(pDib, &m_ImageMatrix, m_Flags, &clip_box));
662 m_pTransformer->Start(); 661 m_pTransformer->Start();
663 return TRUE; 662 return TRUE;
664 } 663 }
665 if (m_ImageMatrix.a < 0) { 664 if (m_ImageMatrix.a < 0) {
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 } 2044 }
2046 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 2045 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
2047 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 2046 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
2048 } 2047 }
2049 2048
2050 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} 2049 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
2051 2050
2052 CXFA_CalcData::~CXFA_CalcData() { 2051 CXFA_CalcData::~CXFA_CalcData() {
2053 m_Globals.RemoveAll(); 2052 m_Globals.RemoveAll();
2054 } 2053 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffdocview.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698