Chromium Code Reviews| 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..6cce76a98c1b051d273ba893831489ba1e4ea6d3 |
| --- /dev/null |
| +++ b/sky/engine/core/painting/Point.cpp |
| @@ -0,0 +1,37 @@ |
| +// 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.isNull = 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")); |
|
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
|
| + |
| + double x = 0.0, y = 0.0; |
| + Dart_DoubleValue(xValue, &x); |
| + 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
|
| + DCHECK(!LogIfError(err)); |
| + result.skPoint.set(x, y); |
| + result.isNull = false; |
| + return result; |
| +} |
| + |
| +} // namespace blink |