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

Side by Side Diff: xfa/fwl/core/cfwl_picturebox.cpp

Issue 2556873004: Convert GetWidgetRect to return rect. (Closed)
Patch Set: Created 4 years 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/fwl/core/cfwl_picturebox.h" 7 #include "xfa/fwl/core/cfwl_picturebox.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "third_party/base/ptr_util.h" 11 #include "third_party/base/ptr_util.h"
12 12
13 CFWL_PictureBox::CFWL_PictureBox(const CFWL_App* app) 13 CFWL_PictureBox::CFWL_PictureBox(const CFWL_App* app)
14 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr) { 14 : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr) {
15 m_rtClient.Reset(); 15 m_rtClient.Reset();
16 m_rtImage.Reset(); 16 m_rtImage.Reset();
17 m_matrix.SetIdentity(); 17 m_matrix.SetIdentity();
18 } 18 }
19 19
20 CFWL_PictureBox::~CFWL_PictureBox() {} 20 CFWL_PictureBox::~CFWL_PictureBox() {}
21 21
22 FWL_Type CFWL_PictureBox::GetClassID() const { 22 FWL_Type CFWL_PictureBox::GetClassID() const {
23 return FWL_Type::PictureBox; 23 return FWL_Type::PictureBox;
24 } 24 }
25 25
26 void CFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { 26 CFX_RectF CFWL_PictureBox::GetWidgetRect(bool bAutoSize) {
27 if (!bAutoSize) { 27 if (!bAutoSize)
28 rect = m_pProperties->m_rtWidget; 28 return m_pProperties->m_rtWidget;
29 return;
30 }
31 29
32 rect.Set(0, 0, 0, 0); 30 CFX_RectF rect;
33 InflateWidgetRect(rect); 31 InflateWidgetRect(rect);
32 return rect;
34 } 33 }
35 34
36 void CFWL_PictureBox::Update() { 35 void CFWL_PictureBox::Update() {
37 if (IsLocked()) 36 if (IsLocked())
38 return; 37 return;
39 if (!m_pProperties->m_pThemeProvider) 38 if (!m_pProperties->m_pThemeProvider)
40 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 39 m_pProperties->m_pThemeProvider = GetAvailableTheme();
41 40
42 GetClientRect(m_rtClient); 41 GetClientRect(m_rtClient);
43 } 42 }
44 43
45 void CFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics, 44 void CFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics,
46 const CFX_Matrix* pMatrix) { 45 const CFX_Matrix* pMatrix) {
47 if (!pGraphics) 46 if (!pGraphics)
48 return; 47 return;
49 if (!m_pProperties->m_pThemeProvider) 48 if (!m_pProperties->m_pThemeProvider)
50 return; 49 return;
51 50
52 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); 51 IFWL_ThemeProvider* pTheme = GetAvailableTheme();
53 if (HasBorder()) 52 if (HasBorder())
54 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 53 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
55 if (HasEdge()) 54 if (HasEdge())
56 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 55 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
57 } 56 }
58 57
59 void CFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics, 58 void CFWL_PictureBox::OnDrawWidget(CFX_Graphics* pGraphics,
60 const CFX_Matrix* pMatrix) { 59 const CFX_Matrix* pMatrix) {
61 DrawWidget(pGraphics, pMatrix); 60 DrawWidget(pGraphics, pMatrix);
62 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698