| 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/TransferMode.h" | |
| 7 | |
| 8 #include "sky/engine/core/script/dom_dart_state.h" | |
| 9 #include "sky/engine/tonic/dart_builtin.h" | |
| 10 #include "sky/engine/tonic/dart_error.h" | |
| 11 #include "sky/engine/tonic/dart_value.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 // If this fails, it's because SkXfermode has changed. We need to change | |
| 16 // TransferMode.dart to ensure the TransferMode enum is in sync with the C++ | |
| 17 // values. | |
| 18 COMPILE_ASSERT(SkXfermode::kLastMode == 28, Need_to_update_TransferMode_dart); | |
| 19 | |
| 20 // Convert dart_mode => SkXfermode::Mode. | |
| 21 SkXfermode::Mode DartConverter<TransferMode>::FromArgumentsWithNullCheck( | |
| 22 Dart_NativeArguments args, | |
| 23 int index, | |
| 24 Dart_Handle& exception) { | |
| 25 SkXfermode::Mode result; | |
| 26 | |
| 27 Dart_Handle dart_mode = Dart_GetNativeArgument(args, index); | |
| 28 DCHECK(!LogIfError(dart_mode)); | |
| 29 | |
| 30 Dart_Handle value = | |
| 31 Dart_GetField(dart_mode, DOMDartState::Current()->index_handle()); | |
| 32 | |
| 33 uint64_t mode = 0; | |
| 34 Dart_Handle rv = Dart_IntegerToUint64(value, &mode); | |
| 35 DCHECK(!LogIfError(rv)); | |
| 36 | |
| 37 result = static_cast<SkXfermode::Mode>(mode); | |
| 38 return result; | |
| 39 } | |
| 40 | |
| 41 } // namespace blink | |
| OLD | NEW |