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

Side by Side Diff: xfa/fxgraphics/cfx_graphics.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase 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
« no previous file with comments | « xfa/fxfa/parser/cxfa_scriptcontext.cpp ('k') | xfa/fxgraphics/cfx_path.cpp » ('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/fxgraphics/cfx_graphics.h" 7 #include "xfa/fxgraphics/cfx_graphics.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "core/fxge/cfx_fxgedevice.h" 11 #include "core/fxge/cfx_fxgedevice.h"
12 #include "core/fxge/cfx_gemodule.h" 12 #include "core/fxge/cfx_gemodule.h"
13 #include "core/fxge/cfx_renderdevice.h" 13 #include "core/fxge/cfx_renderdevice.h"
14 #include "core/fxge/cfx_unicodeencoding.h" 14 #include "core/fxge/cfx_unicodeencoding.h"
15 #include "third_party/base/ptr_util.h"
15 #include "xfa/fxgraphics/cagg_graphics.h" 16 #include "xfa/fxgraphics/cagg_graphics.h"
16 #include "xfa/fxgraphics/cfx_color.h" 17 #include "xfa/fxgraphics/cfx_color.h"
17 #include "xfa/fxgraphics/cfx_path.h" 18 #include "xfa/fxgraphics/cfx_path.h"
18 #include "xfa/fxgraphics/cfx_path_generator.h" 19 #include "xfa/fxgraphics/cfx_path_generator.h"
19 #include "xfa/fxgraphics/cfx_pattern.h" 20 #include "xfa/fxgraphics/cfx_pattern.h"
20 #include "xfa/fxgraphics/cfx_shading.h" 21 #include "xfa/fxgraphics/cfx_shading.h"
21 22
22 namespace { 23 namespace {
23 24
24 enum { 25 enum {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 FWL_Error CFX_Graphics::Create(int32_t width, 591 FWL_Error CFX_Graphics::Create(int32_t width,
591 int32_t height, 592 int32_t height,
592 FXDIB_Format format, 593 FXDIB_Format format,
593 bool isNative, 594 bool isNative,
594 bool isAntialiasing) { 595 bool isAntialiasing) {
595 if (m_type != FX_CONTEXT_None) 596 if (m_type != FX_CONTEXT_None)
596 return FWL_Error::PropertyInvalid; 597 return FWL_Error::PropertyInvalid;
597 598
598 m_type = FX_CONTEXT_Device; 599 m_type = FX_CONTEXT_Device;
599 m_info.isAntialiasing = isAntialiasing; 600 m_info.isAntialiasing = isAntialiasing;
600 m_aggGraphics.reset(new CAGG_Graphics); 601 m_aggGraphics = pdfium::MakeUnique<CAGG_Graphics>();
601 return m_aggGraphics->Create(this, width, height, format); 602 return m_aggGraphics->Create(this, width, height, format);
602 } 603 }
603 604
604 CFX_Graphics::~CFX_Graphics() {} 605 CFX_Graphics::~CFX_Graphics() {}
605 606
606 FWL_Error CFX_Graphics::GetDeviceCap(const int32_t capID, 607 FWL_Error CFX_Graphics::GetDeviceCap(const int32_t capID,
607 FX_DeviceCap& capVal) { 608 FX_DeviceCap& capVal) {
608 if (m_type == FX_CONTEXT_Device && m_renderDevice) { 609 if (m_type == FX_CONTEXT_Device && m_renderDevice) {
609 capVal = m_renderDevice->GetDeviceCaps(capID); 610 capVal = m_renderDevice->GetDeviceCaps(capID);
610 return FWL_Error::Succeeded; 611 return FWL_Error::Succeeded;
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 CTM = other.CTM; 1570 CTM = other.CTM;
1570 isActOnDash = other.isActOnDash; 1571 isActOnDash = other.isActOnDash;
1571 strokeColor = other.strokeColor; 1572 strokeColor = other.strokeColor;
1572 fillColor = other.fillColor; 1573 fillColor = other.fillColor;
1573 font = other.font; 1574 font = other.font;
1574 fontSize = other.fontSize; 1575 fontSize = other.fontSize;
1575 fontHScale = other.fontHScale; 1576 fontHScale = other.fontHScale;
1576 fontSpacing = other.fontSpacing; 1577 fontSpacing = other.fontSpacing;
1577 return *this; 1578 return *this;
1578 } 1579 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_scriptcontext.cpp ('k') | xfa/fxgraphics/cfx_path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698