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

Side by Side Diff: ui/gfx/path_x11.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 | « ui/gfx/path_win.cc ('k') | ui/gfx/platform_font_linux.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 #include "ui/gfx/path_x11.h" 5 #include "ui/gfx/path_x11.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #include <X11/Xregion.h> 8 #include <X11/Xregion.h>
9 #include <X11/Xutil.h> 9 #include <X11/Xutil.h>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include <memory>
12
12 #include "third_party/skia/include/core/SkRegion.h" 13 #include "third_party/skia/include/core/SkRegion.h"
13 #include "ui/gfx/path.h" 14 #include "ui/gfx/path.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 17
17 Region CreateRegionFromSkRegion(const SkRegion& region) { 18 Region CreateRegionFromSkRegion(const SkRegion& region) {
18 Region result = XCreateRegion(); 19 Region result = XCreateRegion();
19 20
20 for (SkRegion::Iterator i(region); !i.done(); i.next()) { 21 for (SkRegion::Iterator i(region); !i.done(); i.next()) {
21 XRectangle rect; 22 XRectangle rect;
22 rect.x = i.rect().x(); 23 rect.x = i.rect().x();
23 rect.y = i.rect().y(); 24 rect.y = i.rect().y();
24 rect.width = i.rect().width(); 25 rect.width = i.rect().width();
25 rect.height = i.rect().height(); 26 rect.height = i.rect().height();
26 XUnionRectWithRegion(&rect, result, result); 27 XUnionRectWithRegion(&rect, result, result);
27 } 28 }
28 29
29 return result; 30 return result;
30 } 31 }
31 32
32 Region CreateRegionFromSkPath(const SkPath& path) { 33 Region CreateRegionFromSkPath(const SkPath& path) {
33 int point_count = path.getPoints(NULL, 0); 34 int point_count = path.getPoints(NULL, 0);
34 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]); 35 std::unique_ptr<SkPoint[]> points(new SkPoint[point_count]);
35 path.getPoints(points.get(), point_count); 36 path.getPoints(points.get(), point_count);
36 scoped_ptr<XPoint[]> x11_points(new XPoint[point_count]); 37 std::unique_ptr<XPoint[]> x11_points(new XPoint[point_count]);
37 for (int i = 0; i < point_count; ++i) { 38 for (int i = 0; i < point_count; ++i) {
38 x11_points[i].x = SkScalarRoundToInt(points[i].fX); 39 x11_points[i].x = SkScalarRoundToInt(points[i].fX);
39 x11_points[i].y = SkScalarRoundToInt(points[i].fY); 40 x11_points[i].y = SkScalarRoundToInt(points[i].fY);
40 } 41 }
41 42
42 return XPolygonRegion(x11_points.get(), point_count, EvenOddRule); 43 return XPolygonRegion(x11_points.get(), point_count, EvenOddRule);
43 } 44 }
44 45
45 } // namespace gfx 46 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/path_win.cc ('k') | ui/gfx/platform_font_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698