gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / ui / gfx / path_x11.cc
blob2cfd10abe34393c3570fa67ae1214e9258a4688d
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.
5 #include "ui/gfx/path_x11.h"
7 #include <X11/Xutil.h>
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/path.h"
12 namespace gfx {
14 Region CreateRegionFromSkPath(const SkPath& path) {
15 int point_count = path.getPoints(NULL, 0);
16 scoped_ptr<SkPoint[]> points(new SkPoint[point_count]);
17 path.getPoints(points.get(), point_count);
18 scoped_ptr<XPoint[]> x11_points(new XPoint[point_count]);
19 for (int i = 0; i < point_count; ++i) {
20 x11_points[i].x = SkScalarRound(points[i].fX);
21 x11_points[i].y = SkScalarRound(points[i].fY);
24 return XPolygonRegion(x11_points.get(), point_count, EvenOddRule);
27 } // namespace gfx