Fix regions generation on windows.
On windows HRGN for window is generated from the SkPath using dumb
function that doesn`t respects anything except simple polygons. It's
impossible to create window with round corners on windows. Replacing
implementation of that function with a new one will fix this.
[email protected]
BUG=322360
Review URL: https://codereview.chromium.org/673623002
Cr-Commit-Position: refs/heads/master@{#304045}
diff --git a/ui/gfx/path_win.cc b/ui/gfx/path_win.cc
index b28ea7a..0f55253 100644
--- a/ui/gfx/path_win.cc
+++ b/ui/gfx/path_win.cc
@@ -25,16 +25,11 @@
}
HRGN CreateHRGNFromSkPath(const SkPath& path) {
- int point_count = path.getPoints(NULL, 0);
- scoped_ptr<SkPoint[]> points(new SkPoint[point_count]);
- path.getPoints(points.get(), point_count);
- scoped_ptr<POINT[]> windows_points(new POINT[point_count]);
- for (int i = 0; i < point_count; ++i) {
- windows_points[i].x = SkScalarRoundToInt(points[i].fX);
- windows_points[i].y = SkScalarRoundToInt(points[i].fY);
- }
-
- return ::CreatePolygonRgn(windows_points.get(), point_count, ALTERNATE);
+ SkRegion clip_region;
+ clip_region.setRect(path.getBounds().round());
+ SkRegion region;
+ region.setPath(path, clip_region);
+ return CreateHRGNFromSkRegion(region);
}
// See path_aura.cc for Aura definition of these methods: