Chromium Code Reviews| 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.isNull = 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")); | |
|
abarth-chromium
2015/05/27 02:17:36
We should cache the "x" and "y" strings so that we
Matt Perry
2015/05/27 17:55:43
OK. Not sure what you mean by Symbols. Do we have
| |
| 27 | |
| 28 double x = 0.0, y = 0.0; | |
| 29 Dart_DoubleValue(xValue, &x); | |
| 30 Dart_Handle err = Dart_DoubleValue(xValue, &y); | |
|
abarth-chromium
2015/05/27 02:17:36
Why do we capture an error for y and not for x?
Matt Perry
2015/05/27 17:55:43
I was thinking the error would propagate to the la
| |
| 31 DCHECK(!LogIfError(err)); | |
| 32 result.skPoint.set(x, y); | |
| 33 result.isNull = false; | |
| 34 return result; | |
| 35 } | |
| 36 | |
| 37 } // namespace blink | |
| OLD | NEW |