| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return 0; | 92 return 0; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 static Dart_Handle webGLGetInfoToDart(const WebGLGetInfo& info) | 96 static Dart_Handle webGLGetInfoToDart(const WebGLGetInfo& info) |
| 97 { | 97 { |
| 98 switch (info.getType()) { | 98 switch (info.getType()) { |
| 99 case WebGLGetInfo::kTypeBool: | 99 case WebGLGetInfo::kTypeBool: |
| 100 return toDartValue(info.getBool()); | 100 return toDartValue(info.getBool()); |
| 101 case WebGLGetInfo::kTypeBoolArray: | 101 case WebGLGetInfo::kTypeBoolArray: |
| 102 return vectorToDartList(info.getBoolArray()); | 102 return toDartValue(info.getBoolArray()); |
| 103 case WebGLGetInfo::kTypeFloat: | 103 case WebGLGetInfo::kTypeFloat: |
| 104 return toDartValue(info.getFloat()); | 104 return toDartValue(info.getFloat()); |
| 105 case WebGLGetInfo::kTypeInt: | 105 case WebGLGetInfo::kTypeInt: |
| 106 return toDartValue(info.getInt()); | 106 return toDartValue(info.getInt()); |
| 107 case WebGLGetInfo::kTypeNull: | 107 case WebGLGetInfo::kTypeNull: |
| 108 return 0; | 108 return 0; |
| 109 case WebGLGetInfo::kTypeString: | 109 case WebGLGetInfo::kTypeString: |
| 110 return toDartValue(info.getString()); | 110 return toDartValue(info.getString()); |
| 111 case WebGLGetInfo::kTypeUnsignedInt: | 111 case WebGLGetInfo::kTypeUnsignedInt: |
| 112 return toDartValue(static_cast<intptr_t>(info.getUnsignedInt())); | 112 return toDartValue(static_cast<intptr_t>(info.getUnsignedInt())); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 Vector<RefPtr<WebGLShader> > shaders; | 209 Vector<RefPtr<WebGLShader> > shaders; |
| 210 ExceptionCode ec = 0; | 210 ExceptionCode ec = 0; |
| 211 bool succeed = context->getAttachedShaders(program, shaders, ec); | 211 bool succeed = context->getAttachedShaders(program, shaders, ec); |
| 212 if (UNLIKELY(ec)) { | 212 if (UNLIKELY(ec)) { |
| 213 exception = DartDOMWrapper::exceptionCodeToDartException(ec); | 213 exception = DartDOMWrapper::exceptionCodeToDartException(ec); |
| 214 goto fail; | 214 goto fail; |
| 215 } | 215 } |
| 216 Dart_Handle result; | 216 Dart_Handle result; |
| 217 if (succeed) { | 217 if (succeed) { |
| 218 result = vectorToDartList(shaders); | 218 result = toDartValue(shaders); |
| 219 if (!DartUtilities::checkResult(result, exception)) | 219 if (!DartUtilities::checkResult(result, exception)) |
| 220 goto fail; | 220 goto fail; |
| 221 } else | 221 } else |
| 222 result = 0; | 222 result = 0; |
| 223 Dart_SetReturnValue(args, result); | 223 Dart_SetReturnValue(args, result); |
| 224 return; | 224 return; |
| 225 } | 225 } |
| 226 | 226 |
| 227 fail: | 227 fail: |
| 228 Dart_ThrowException(exception); | 228 Dart_ThrowException(exception); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 ASSERT_NOT_REACHED(); | 407 ASSERT_NOT_REACHED(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void getSupportedExtensionsCallback(Dart_NativeArguments args) | 410 void getSupportedExtensionsCallback(Dart_NativeArguments args) |
| 411 { | 411 { |
| 412 DartApiScope dartApiScope; | 412 DartApiScope dartApiScope; |
| 413 Dart_Handle exception = 0; | 413 Dart_Handle exception = 0; |
| 414 { | 414 { |
| 415 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); | 415 WebGLRenderingContext* context = DartDOMWrapper::receiver<WebGLRendering
Context>(args); |
| 416 Vector<String> value = context->getSupportedExtensions(); | 416 Vector<String> value = context->getSupportedExtensions(); |
| 417 Dart_Handle result = vectorToDartList(value); | 417 Dart_Handle result = toDartValue(value); |
| 418 if (!DartUtilities::checkResult(result, exception)) | 418 if (!DartUtilities::checkResult(result, exception)) |
| 419 goto fail; | 419 goto fail; |
| 420 | 420 |
| 421 Dart_SetReturnValue(args, result); | 421 Dart_SetReturnValue(args, result); |
| 422 return; | 422 return; |
| 423 } | 423 } |
| 424 | 424 |
| 425 fail: | 425 fail: |
| 426 Dart_ThrowException(exception); | 426 Dart_ThrowException(exception); |
| 427 ASSERT_NOT_REACHED(); | 427 ASSERT_NOT_REACHED(); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 void vertexAttrib4fvCallback(Dart_NativeArguments args) | 740 void vertexAttrib4fvCallback(Dart_NativeArguments args) |
| 741 { | 741 { |
| 742 vertexAttribAndUniformHelperf(args, kVertexAttrib4v); | 742 vertexAttribAndUniformHelperf(args, kVertexAttrib4v); |
| 743 } | 743 } |
| 744 | 744 |
| 745 } | 745 } |
| 746 | 746 |
| 747 } | 747 } |
| 748 | 748 |
| 749 #endif // ENABLE(WEBGL) | 749 #endif // ENABLE(WEBGL) |
| OLD | NEW |