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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Issue 12077039: Adding supported checks for WebGL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 65f548a92c98f2c8e63e193f1a7d973c9d08c6dd..1faa1262acd59083ebee5fc18b3ef8c19c8f0075 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -1229,14 +1229,34 @@ class CanvasElement extends _Element_Merged {
@DomName('HTMLCanvasElement.getContext')
@DocsEditable
- Object getContext(String contextId) native "HTMLCanvasElement_getContext_Callback";
+ CanvasRenderingContext getContext(String contextId, [Map attrs]) native "HTMLCanvasElement_getContext_Callback";
@DomName('HTMLCanvasElement.toDataURL')
@DocsEditable
String toDataUrl(String type, [num quality]) native "HTMLCanvasElement_toDataURL_Callback";
-
CanvasRenderingContext2D get context2d => getContext('2d');
+
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @Experimental
+ WebGLRenderingContext getContext3d({alpha: true, depth: true, stencil: false,
+ antialias: true, premultipliedAlpha: true, preserveDrawingBuffer: false}) {
+
+ var options = {
+ 'alpha': alpha,
+ 'depth': depth,
+ 'stencil': stencil,
+ 'antialias': antialias,
+ 'premultipliedAlpha': premultipliedAlpha,
+ 'preserveDrawingBuffer': preserveDrawingBuffer,
+ };
+ var context = getContext('webgl', options);
+ if (context == null) {
+ context = getContext('experimental-webgl', options);
+ }
+ return context;
+ }
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -26348,9 +26368,15 @@ class WebGLRenderbuffer extends NativeFieldWrapperClass1 {
@DocsEditable
@DomName('WebGLRenderingContext')
+@SupportedBrowser(SupportedBrowser.CHROME)
+@SupportedBrowser(SupportedBrowser.FIREFOX)
+@Experimental
class WebGLRenderingContext extends CanvasRenderingContext {
WebGLRenderingContext.internal() : super.internal();
+ /// Checks if this type is supported on the current platform.
+ static bool get supported => true;
+
static const int ACTIVE_ATTRIBUTES = 0x8B89;
static const int ACTIVE_TEXTURE = 0x84E0;

Powered by Google App Engine
This is Rietveld 408576698