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

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

Powered by Google App Engine
This is Rietveld 408576698