summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 01:32:42 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 01:32:42 +0000
commita2bf6c8561d8a7da17b4cc9713707fa182b9968b (patch)
treeed259130a977353abc526a5e7b12961f5896377e /ui
parent84561c3783760698783b7320111b435b9bcd406b (diff)
downloadchromium_src-a2bf6c8561d8a7da17b4cc9713707fa182b9968b.zip
chromium_src-a2bf6c8561d8a7da17b4cc9713707fa182b9968b.tar.gz
chromium_src-a2bf6c8561d8a7da17b4cc9713707fa182b9968b.tar.bz2
Add floating point support to gfx::Path
BUG=115347 TEST=none Review URL: http://codereview.chromium.org/10024037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/path.cc11
-rw-r--r--ui/gfx/path.h11
2 files changed, 20 insertions, 2 deletions
diff --git a/ui/gfx/path.cc b/ui/gfx/path.cc
index c95333a..db355e8 100644
--- a/ui/gfx/path.cc
+++ b/ui/gfx/path.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,15 @@ Path::Path(const Point* points, size_t count) {
lineTo(SkIntToScalar(points[i].x), SkIntToScalar(points[i].y));
}
+#if defined(ENABLE_DIP)
+Path::Path(const PointF* points, size_t count) {
+ DCHECK(count > 1);
+ moveTo(SkFloatToScalar(points[0].x), SkFloatToScalar(points[0].y));
+ for (size_t i = 1; i < count; ++i)
+ lineTo(SkFloatToScalar(points[i].x), SkFloatToScalar(points[i].y));
+}
+#endif
+
Path::~Path() {
}
diff --git a/ui/gfx/path.h b/ui/gfx/path.h
index c00443d..1b576bd 100644
--- a/ui/gfx/path.h
+++ b/ui/gfx/path.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,11 +20,20 @@ class UI_EXPORT Path : public SkPath {
int x;
int y;
};
+#if defined(ENABLE_DIP)
+ struct PointF {
+ float x;
+ float y;
+ };
+#endif
Path();
// Creates a path populated with the specified points.
Path(const Point* points, size_t count);
+#if defined(ENABLE_DIP)
+ Path(const PointF* points, size_t count);
+#endif
~Path();