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

Unified Diff: ui/gfx/path_win.cc

Issue 83293008: Fix CreateHRGNFromSkPath to support arbitrary SkPaths. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/gfx_tests.gyp ('k') | ui/gfx/path_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/path_win.cc
diff --git a/ui/gfx/path_win.cc b/ui/gfx/path_win.cc
index b28ea7a2c7bf02e99a501c4f9351d199fe6beed5..2588e811c12dcc239ba81bd6a233a42581a01705 100644
--- a/ui/gfx/path_win.cc
+++ b/ui/gfx/path_win.cc
@@ -25,16 +25,10 @@ HRGN CreateHRGNFromSkRegion(const SkRegion& region) {
}
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(SkIRect::MakeLTRB(INT_MIN, INT_MIN, INT_MAX, INT_MAX));
+ SkRegion region;
+ region.setPath(path, clip);
+ return CreateHRGNFromSkRegion(region);
}
// See path_aura.cc for Aura definition of these methods:
« no previous file with comments | « ui/gfx/gfx_tests.gyp ('k') | ui/gfx/path_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698