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

Unified Diff: sky/engine/core/painting/Point.cpp

Issue 1158843002: Sky: Add a Point class. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: style revert 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/Point.h ('k') | sky/engine/core/painting/Point.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Point.cpp
diff --git a/sky/engine/core/painting/Point.cpp b/sky/engine/core/painting/Point.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..aff2fdcb7b9869d768cd1b50710e8a8c983c66c1
--- /dev/null
+++ b/sky/engine/core/painting/Point.cpp
@@ -0,0 +1,38 @@
+// 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.
+
+#include "sky/engine/config.h"
+#include "sky/engine/core/painting/Point.h"
+
+#include "sky/engine/tonic/dart_error.h"
+#include "sky/engine/tonic/dart_state.h"
+#include "base/logging.h"
+
+namespace blink {
+
+// Convert dartPoint.x,y ==> SkPoint.
+Point DartConverter<Point, void>::FromArgumentsWithNullCheck(
+ Dart_NativeArguments args,
+ int index,
+ Dart_Handle& exception) {
+ Point result;
+ result.is_null = true;
+
+ Dart_Handle dartPoint = Dart_GetNativeArgument(args, index);
+ DCHECK(!LogIfError(dartPoint));
+
+ Dart_Handle xValue = Dart_GetField(dartPoint, Dart_NewStringFromCString("x"));
+ Dart_Handle yValue = Dart_GetField(dartPoint, Dart_NewStringFromCString("y"));
+
+ double x = 0.0, y = 0.0;
+ Dart_Handle err = Dart_DoubleValue(xValue, &x);
+ DCHECK(!LogIfError(err));
+ err = Dart_DoubleValue(xValue, &y);
+ DCHECK(!LogIfError(err));
+ result.sk_point.set(x, y);
+ result.is_null = false;
+ return result;
+}
+
+} // namespace blink
« no previous file with comments | « sky/engine/core/painting/Point.h ('k') | sky/engine/core/painting/Point.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698