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

Unified Diff: sky/engine/bindings/scripts/dart_types.py

Issue 1152963009: Add support for linear gradients, implemented as skia shaders. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/engine/core/core.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/scripts/dart_types.py
diff --git a/sky/engine/bindings/scripts/dart_types.py b/sky/engine/bindings/scripts/dart_types.py
index 11f10578c9176d6fd1a7f076d27799bfecf03cce..85f194261c37aa5ebc281051e8b55b19d8bf88dc 100644
--- a/sky/engine/bindings/scripts/dart_types.py
+++ b/sky/engine/bindings/scripts/dart_types.py
@@ -366,13 +366,12 @@ DART_TO_CPP_VALUE = {
# Pass-by-value types.
'Color': pass_by_value_format('CanvasColor'),
'Float32List': pass_by_value_format('Float32List'),
- 'Point': pass_by_value_format('{implemented_as}'),
- 'Rect': pass_by_value_format('{implemented_as}'),
+ 'Point': pass_by_value_format('Point'),
+ 'Rect': pass_by_value_format('Rect'),
'TransferMode': pass_by_value_format('TransferMode'),
'PaintingStyle': pass_by_value_format('PaintingStyle'),
}
-
def dart_value_to_cpp_value(idl_type, extended_attributes, variable_name,
null_check, has_type_checking_interface,
index, auto_scope=True):
@@ -428,12 +427,19 @@ def dart_value_to_cpp_value(idl_type, extended_attributes, variable_name,
auto_scope=DartUtilities.bool_to_cpp(auto_scope))
+# Special mappings for arrays of types.
+INNER_TYPE_FOR_ARRAY = {
+ 'SkColor': 'CanvasColor'
+}
+
def dart_value_to_cpp_value_array_or_sequence(native_array_element_type, variable_name, index):
# Index is None for setters, index (starting at 0) for method arguments,
# and is used to provide a human-readable exception message
if index is None:
index = 0 # special case, meaning "setter"
this_cpp_type = native_array_element_type.cpp_type
+ if this_cpp_type in INNER_TYPE_FOR_ARRAY:
+ this_cpp_type = INNER_TYPE_FOR_ARRAY[this_cpp_type]
expression_format = '{variable_name} = DartConverter<Vector<{cpp_type}>>::FromArguments(args, {index}, exception)'
expression = expression_format.format(native_array_element_type=native_array_element_type.name,
cpp_type=this_cpp_type, index=index,
« no previous file with comments | « no previous file | sky/engine/core/core.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698