Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: sky/engine/core/painting/PaintingStyle.cpp

Issue 1171543002: Use an enum for Dart bindings for Skia Paint style (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/painting/PaintingStyle.h ('k') | sky/engine/core/painting/PaintingStyle.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/TransferMode.h" 6 #include "sky/engine/core/painting/PaintingStyle.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_builtin.h" 9 #include "sky/engine/tonic/dart_builtin.h"
10 #include "sky/engine/tonic/dart_error.h" 10 #include "sky/engine/tonic/dart_error.h"
11 #include "sky/engine/tonic/dart_value.h" 11 #include "sky/engine/tonic/dart_value.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // If this fails, it's because SkXfermode has changed. We need to change 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++ 16 // PaintingStyle.dart to ensure the PaintingStyle enum is in sync with the C++
17 // values. 17 // values.
18 COMPILE_ASSERT(SkXfermode::kLastMode == 28, Need_to_update_TransferMode_dart); 18 COMPILE_ASSERT(SkPaint::kStyleCount == 3, Need_to_update_PaintingStyle_dart);
19 19
20 // Convert dart_mode => SkXfermode::Mode. 20 // Convert dart_style => SkPaint::Style.
21 SkXfermode::Mode DartConverter<TransferMode>::FromArgumentsWithNullCheck( 21 SkPaint::Style DartConverter<PaintingStyle>::FromArgumentsWithNullCheck(
22 Dart_NativeArguments args, 22 Dart_NativeArguments args,
23 int index, 23 int index,
24 Dart_Handle& exception) { 24 Dart_Handle& exception) {
25 SkXfermode::Mode result; 25 SkPaint::Style result;
26 26
27 Dart_Handle dart_mode = Dart_GetNativeArgument(args, index); 27 Dart_Handle dart_style = Dart_GetNativeArgument(args, index);
28 DCHECK(!LogIfError(dart_mode)); 28 DCHECK(!LogIfError(dart_style));
29 29
30 Dart_Handle value = 30 Dart_Handle value =
31 Dart_GetField(dart_mode, DOMDartState::Current()->index_handle()); 31 Dart_GetField(dart_style, DOMDartState::Current()->index_handle());
32 32
33 uint64_t mode = 0; 33 uint64_t style = 0;
34 Dart_Handle rv = Dart_IntegerToUint64(value, &mode); 34 Dart_Handle rv = Dart_IntegerToUint64(value, &style);
35 DCHECK(!LogIfError(rv)); 35 DCHECK(!LogIfError(rv));
36 36
37 result = static_cast<SkXfermode::Mode>(mode); 37 result = static_cast<SkPaint::Style>(style);
38 return result; 38 return result;
39 } 39 }
40 40
41 } // namespace blink 41 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/PaintingStyle.h ('k') | sky/engine/core/painting/PaintingStyle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698