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

Side by Side Diff: xfa/fwl/basewidget/fwl_editimp.cpp

Issue 1960673003: Replace some calls to Release() with direct delete, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Another unique_ptr. Created 4 years, 7 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/fee/fde_txtedtengine.cpp ('k') | xfa/fwl/theme/cfwl_widgettp.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/fwl/basewidget/fwl_editimp.h" 7 #include "xfa/fwl/basewidget/fwl_editimp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory>
10 #include <vector> 11 #include <vector>
11 12
12 #include "xfa/fde/fde_gedevice.h" 13 #include "xfa/fde/fde_gedevice.h"
13 #include "xfa/fde/fde_render.h" 14 #include "xfa/fde/fde_render.h"
14 #include "xfa/fee/fde_txtedtengine.h" 15 #include "xfa/fee/fde_txtedtengine.h"
15 #include "xfa/fee/ifde_txtedtpage.h" 16 #include "xfa/fee/ifde_txtedtpage.h"
16 #include "xfa/fwl/basewidget/fwl_caretimp.h" 17 #include "xfa/fwl/basewidget/fwl_caretimp.h"
17 #include "xfa/fwl/basewidget/fwl_comboboximp.h" 18 #include "xfa/fwl/basewidget/fwl_comboboximp.h"
18 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" 19 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
19 #include "xfa/fwl/basewidget/ifwl_caret.h" 20 #include "xfa/fwl/basewidget/ifwl_caret.h"
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 param.m_pGraphics = pGraphics; 1076 param.m_pGraphics = pGraphics;
1076 param.m_matrix = *pMatrix; 1077 param.m_matrix = *pMatrix;
1077 param.m_pWidget = m_pInterface; 1078 param.m_pWidget = m_pInterface;
1078 param.m_iPart = CFWL_Part::Background; 1079 param.m_iPart = CFWL_Part::Background;
1079 param.m_pPath = &path; 1080 param.m_pPath = &path;
1080 pTheme->DrawBackground(&param); 1081 pTheme->DrawBackground(&param);
1081 } 1082 }
1082 CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice(); 1083 CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice();
1083 if (!pRenderDev) 1084 if (!pRenderDev)
1084 return; 1085 return;
1085 CFDE_RenderDevice* pRenderDevice = new CFDE_RenderDevice(pRenderDev, FALSE); 1086
1086 CFDE_RenderContext* pRenderContext = new CFDE_RenderContext; 1087 std::unique_ptr<CFDE_RenderDevice> pRenderDevice(
1088 new CFDE_RenderDevice(pRenderDev, FALSE));
1089 std::unique_ptr<CFDE_RenderContext> pRenderContext(new CFDE_RenderContext);
1087 pRenderDevice->SetClipRect(rtClip); 1090 pRenderDevice->SetClipRect(rtClip);
1088 pRenderContext->StartRender(pRenderDevice, pPage, mt); 1091 pRenderContext->StartRender(pRenderDevice.get(), pPage, mt);
1089 pRenderContext->DoRender(NULL); 1092 pRenderContext->DoRender(nullptr);
1090 pRenderContext->Release();
1091 pRenderDevice->Release();
1092 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) { 1093 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
1093 pGraphics->RestoreGraphState(); 1094 pGraphics->RestoreGraphState();
1094 CFX_Path path; 1095 CFX_Path path;
1095 path.Create(); 1096 path.Create();
1096 int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1; 1097 int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1;
1097 FX_FLOAT fStep = m_rtEngine.width / iLimit; 1098 FX_FLOAT fStep = m_rtEngine.width / iLimit;
1098 FX_FLOAT fLeft = m_rtEngine.left + 1; 1099 FX_FLOAT fLeft = m_rtEngine.left + 1;
1099 for (int32_t i = 1; i < iLimit; i++) { 1100 for (int32_t i = 1; i < iLimit; i++) {
1100 fLeft += fStep; 1101 fLeft += fStep;
1101 path.AddLine(fLeft, m_rtClient.top, fLeft, m_rtClient.bottom()); 1102 path.AddLine(fLeft, m_rtClient.top, fLeft, m_rtClient.bottom());
1102 } 1103 }
1103 CFWL_ThemeBackground param; 1104 CFWL_ThemeBackground param;
1104 param.m_pGraphics = pGraphics; 1105 param.m_pGraphics = pGraphics;
1105 param.m_matrix = *pMatrix; 1106 param.m_matrix = *pMatrix;
1106 param.m_pWidget = m_pInterface; 1107 param.m_pWidget = m_pInterface;
1107 param.m_iPart = CFWL_Part::CombTextLine; 1108 param.m_iPart = CFWL_Part::CombTextLine;
1108 param.m_pPath = &path; 1109 param.m_pPath = &path;
1109 pTheme->DrawBackground(&param); 1110 pTheme->DrawBackground(&param);
1110 } 1111 }
1111 pGraphics->RestoreGraphState(); 1112 pGraphics->RestoreGraphState();
1112 } 1113 }
1114
1113 void CFWL_EditImp::UpdateEditEngine() { 1115 void CFWL_EditImp::UpdateEditEngine() {
1114 UpdateEditParams(); 1116 UpdateEditParams();
1115 UpdateEditLayout(); 1117 UpdateEditLayout();
1116 if (m_nLimit > -1) { 1118 if (m_nLimit > -1) {
1117 m_pEdtEngine->SetLimit(m_nLimit); 1119 m_pEdtEngine->SetLimit(m_nLimit);
1118 } 1120 }
1119 } 1121 }
1120 void CFWL_EditImp::UpdateEditParams() { 1122 void CFWL_EditImp::UpdateEditParams() {
1121 FDE_TXTEDTPARAMS params; 1123 FDE_TXTEDTPARAMS params;
1122 params.nHorzScale = 100; 1124 params.nHorzScale = 100;
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 } 2206 }
2205 CFX_RectF rect; 2207 CFX_RectF rect;
2206 m_pOwner->GetWidgetRect(rect); 2208 m_pOwner->GetWidgetRect(rect);
2207 CFX_RectF rtInvalidate; 2209 CFX_RectF rtInvalidate;
2208 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); 2210 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2);
2209 m_pOwner->Repaint(&rtInvalidate); 2211 m_pOwner->Repaint(&rtInvalidate);
2210 } 2212 }
2211 return TRUE; 2213 return TRUE;
2212 } 2214 }
2213 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} 2215 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {}
OLDNEW
« no previous file with comments | « xfa/fee/fde_txtedtengine.cpp ('k') | xfa/fwl/theme/cfwl_widgettp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698