OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/painting/Point.h" |
| 7 |
| 8 #include "sky/engine/tonic/dart_error.h" |
| 9 #include "sky/engine/tonic/dart_state.h" |
| 10 #include "base/logging.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 // Convert dartPoint.x,y ==> SkPoint. |
| 15 Point DartConverter<Point, void>::FromArgumentsWithNullCheck( |
| 16 Dart_NativeArguments args, |
| 17 int index, |
| 18 Dart_Handle& exception) { |
| 19 Point result; |
| 20 result.is_null = true; |
| 21 |
| 22 Dart_Handle dartPoint = Dart_GetNativeArgument(args, index); |
| 23 DCHECK(!LogIfError(dartPoint)); |
| 24 |
| 25 Dart_Handle xValue = Dart_GetField(dartPoint, Dart_NewStringFromCString("x")); |
| 26 Dart_Handle yValue = Dart_GetField(dartPoint, Dart_NewStringFromCString("y")); |
| 27 |
| 28 double x = 0.0, y = 0.0; |
| 29 Dart_Handle err = Dart_DoubleValue(xValue, &x); |
| 30 DCHECK(!LogIfError(err)); |
| 31 err = Dart_DoubleValue(xValue, &y); |
| 32 DCHECK(!LogIfError(err)); |
| 33 result.sk_point.set(x, y); |
| 34 result.is_null = false; |
| 35 return result; |
| 36 } |
| 37 |
| 38 } // namespace blink |
OLD | NEW |