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