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

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

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 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_x11.h ('k') | ui/gfx/platform_font.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/gfx/path_x11.h"
6
7 #include <X11/Xlib.h>
8 #include <X11/Xregion.h>
9 #include <X11/Xutil.h>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/skia/include/core/SkRegion.h"
13 #include "ui/gfx/path.h"
14
15 namespace gfx {
16
17 Region CreateRegionFromSkRegion(const SkRegion& region) {
18 Region result = XCreateRegion();
19
20 for (SkRegion::Iterator i(region); !i.done(); i.next()) {
21 XRectangle rect;
22 rect.x = i.rect().x();
23 rect.y = i.rect().y();
24 rect.width = i.rect().width();
25 rect.height = i.rect().height();
26 XUnionRectWithRegion(&rect, result, result);
27 }
28
29 return result;
30 }
31
32 Region CreateRegionFromSkPath(const SkPath& path) {
33 int point_count = path.getPoints(NULL, 0);
34 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]);
35 path.getPoints(points.get(), point_count);
36 scoped_ptr<XPoint[]> x11_points(new XPoint[point_count]);
37 for (int i = 0; i < point_count; ++i) {
38 x11_points[i].x = SkScalarRoundToInt(points[i].fX);
39 x11_points[i].y = SkScalarRoundToInt(points[i].fY);
40 }
41
42 return XPolygonRegion(x11_points.get(), point_count, EvenOddRule);
43 }
44
45 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/path_x11.h ('k') | ui/gfx/platform_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698