diff options
Diffstat (limited to 'xfa/fxfa/cxfa_ffimage.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_ffimage.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index eeb0e24ed..bc1a67f93 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -1,4 +1,4 @@ -// Copyright 2014 PDFium Authors. All rights reserved. +// Copyright 2014 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,8 @@ #include "xfa/fxfa/cxfa_ffimage.h" +#include <utility> + #include "core/fxge/dib/cfx_dibitmap.h" #include "xfa/fxfa/cxfa_ffapp.h" #include "xfa/fxfa/cxfa_ffdoc.h" @@ -17,22 +19,24 @@ CXFA_FFImage::CXFA_FFImage(CXFA_Node* pNode) : CXFA_FFWidget(pNode) {} -CXFA_FFImage::~CXFA_FFImage() { - GetNode()->SetImageImage(nullptr); +CXFA_FFImage::~CXFA_FFImage() = default; + +void CXFA_FFImage::PreFinalize() { + GetNode()->SetLayoutImage(nullptr); } bool CXFA_FFImage::IsLoaded() { - return !!GetNode()->GetImageImage(); + return !!GetNode()->GetLayoutImage(); } bool CXFA_FFImage::LoadWidget() { - if (GetNode()->GetImageImage()) + if (GetNode()->GetLayoutImage()) return true; - return GetNode()->LoadImageImage(GetDoc()) && CXFA_FFWidget::LoadWidget(); + return GetNode()->LoadLayoutImage(GetDoc()) && CXFA_FFWidget::LoadWidget(); } -void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, +void CXFA_FFImage::RenderWidget(CFGAS_GEGraphics* pGS, const CFX_Matrix& matrix, HighlightOption highlight) { if (!HasVisibleStatus()) @@ -43,7 +47,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, CXFA_FFWidget::RenderWidget(pGS, mtRotate, highlight); - RetainPtr<CFX_DIBitmap> pDIBitmap = GetNode()->GetImageImage(); + RetainPtr<CFX_DIBitmap> pDIBitmap = GetNode()->GetLayoutImage(); if (!pDIBitmap) return; @@ -60,9 +64,14 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, } auto* value = m_pNode->GetFormValueIfExists(); - CXFA_Image* image = value ? value->GetImageIfExists() : nullptr; - if (image) { - XFA_DrawImage(pGS, rtImage, mtRotate, pDIBitmap, image->GetAspect(), - m_pNode->GetImageDpi(), iHorzAlign, iVertAlign); - } + if (!value) + return; + + CXFA_Image* image = value->GetImageIfExists(); + if (!image) + return; + + XFA_DrawImage(pGS, rtImage, mtRotate, std::move(pDIBitmap), + image->GetAspect(), m_pNode->GetLayoutImageDpi(), iHorzAlign, + iVertAlign); } |