| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "embedders/openglui/common/extension.h" | 5 #include "embedders/openglui/common/extension.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 LOGI("PlaySample"); | 916 LOGI("PlaySample"); |
| 917 Dart_EnterScope(); | 917 Dart_EnterScope(); |
| 918 const char* what = GetArgAsString(arguments, 0); | 918 const char* what = GetArgAsString(arguments, 0); |
| 919 int rtn = PlaySoundSample(what); | 919 int rtn = PlaySoundSample(what); |
| 920 SetIntReturnValue(arguments, rtn); | 920 SetIntReturnValue(arguments, rtn); |
| 921 Dart_ExitScope(); | 921 Dart_ExitScope(); |
| 922 } | 922 } |
| 923 | 923 |
| 924 // 2D Canvas. | 924 // 2D Canvas. |
| 925 | 925 |
| 926 CanvasContext* display_context; | 926 CanvasContext* display_context = NULL; |
| 927 | 927 |
| 928 void C2DCreateNativeContext(Dart_NativeArguments arguments) { | 928 void C2DCreateNativeContext(Dart_NativeArguments arguments) { |
| 929 LOGI("In C2DCreateNativeContext"); | 929 LOGI("In C2DCreateNativeContext"); |
| 930 Dart_EnterScope(); | 930 Dart_EnterScope(); |
| 931 | 931 |
| 932 int handle = GetArgAsInt(arguments, 0); | 932 int handle = GetArgAsInt(arguments, 0); |
| 933 int width = GetArgAsInt(arguments, 1); | 933 int width = GetArgAsInt(arguments, 1); |
| 934 int height = GetArgAsInt(arguments, 2); | 934 int height = GetArgAsInt(arguments, 2); |
| 935 | 935 |
| 936 CanvasContext* rtn = new CanvasContext(handle, width, height); | 936 CanvasContext* rtn = new CanvasContext(handle, width, height); |
| 937 if (display_context == NULL) { | 937 if (display_context == NULL) { |
| 938 LOGI("Created display context"); |
| 938 display_context = rtn; | 939 display_context = rtn; |
| 939 } | 940 } |
| 940 Dart_ExitScope(); | 941 Dart_ExitScope(); |
| 941 LOGI("Out C2DCreateNativeContext"); | 942 LOGI("Out C2DCreateNativeContext"); |
| 942 } | 943 } |
| 943 | 944 |
| 944 void C2DSetWidth(Dart_NativeArguments arguments) { | 945 void C2DSetWidth(Dart_NativeArguments arguments) { |
| 945 LOGI("In C2DSetWidth"); | 946 LOGI("In C2DSetWidth"); |
| 946 Dart_EnterScope(); | 947 Dart_EnterScope(); |
| 947 int handle = GetArgAsInt(arguments, 0); | 948 int handle = GetArgAsInt(arguments, 0); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 HandleError(Dart_StringToCString(name, &cname)); | 1648 HandleError(Dart_StringToCString(name, &cname)); |
| 1648 for (int i = 0; function_list[i].name != NULL; ++i) { | 1649 for (int i = 0; function_list[i].name != NULL; ++i) { |
| 1649 if (strcmp(function_list[i].name, cname) == 0) { | 1650 if (strcmp(function_list[i].name, cname) == 0) { |
| 1650 result = function_list[i].function; | 1651 result = function_list[i].function; |
| 1651 break; | 1652 break; |
| 1652 } | 1653 } |
| 1653 } | 1654 } |
| 1654 Dart_ExitScope(); | 1655 Dart_ExitScope(); |
| 1655 return result; | 1656 return result; |
| 1656 } | 1657 } |
| OLD | NEW |