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

Unified Diff: sky/engine/core/painting/CanvasPath.h

Issue 1152383002: A proof of concept for annular sector layout. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add the Path C++ and IDL files which I forgot before Created 5 years, 7 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 | « sky/engine/core/painting/Canvas.idl ('k') | sky/engine/core/painting/CanvasPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/CanvasPath.h
diff --git a/sky/engine/core/painting/CanvasPath.h b/sky/engine/core/painting/CanvasPath.h
new file mode 100644
index 0000000000000000000000000000000000000000..05d94e0757177274b33cb2666f77a440431e15b8
--- /dev/null
+++ b/sky/engine/core/painting/CanvasPath.h
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+#ifndef SKY_ENGINE_CORE_PAINTING_PATH_H_
+#define SKY_ENGINE_CORE_PAINTING_PATH_H_
+
+#include "sky/engine/core/painting/Rect.h"
+#include "sky/engine/tonic/dart_wrappable.h"
+#include "sky/engine/wtf/PassRefPtr.h"
+#include "sky/engine/wtf/RefCounted.h"
+#include "third_party/skia/include/core/SkPath.h"
+
+// Note: There's a very similar class in ../../platform/graphics/Path.h
+// We should probably rationalise these two.
+// (The existence of that class is why this is CanvasPath and not just Path.)
+
+namespace blink {
+
+class CanvasPath : public RefCounted<CanvasPath>, public DartWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ ~CanvasPath() override;
+ static PassRefPtr<CanvasPath> create()
+ {
+ return adoptRef(new CanvasPath);
+ }
+
+ void moveTo(float x, float y)
+ {
+ m_path.moveTo(x, y);
+ }
+
+ void lineTo(float x, float y)
+ {
+ m_path.lineTo(x, y);
+ }
+
+ void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceMoveTo)
+ {
+ m_path.arcTo(rect.sk_rect, startAngle, sweepAngle, forceMoveTo);
+ }
+
+ void close()
+ {
+ m_path.close();
+ }
+
+ const SkPath& path() const { return m_path; }
+
+private:
+ CanvasPath();
+
+ SkPath m_path;
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_CORE_PAINTING_PATH_H_
« no previous file with comments | « sky/engine/core/painting/Canvas.idl ('k') | sky/engine/core/painting/CanvasPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698