| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Sets the currently bound texture to [data]. | 11 * Sets the currently bound texture to [data]. |
| 12 * | 12 * |
| 13 * [data] can be either an [ImageElement], a | 13 * [data] can be either an [ImageElement], a |
| 14 * [CanvasElement], a [VideoElement], or an [ImageData] object. | 14 * [CanvasElement], a [VideoElement], or an [ImageData] object. |
| 15 * | 15 * |
| 16 * To use [texImage2d] with a TypedData object, use [texImage2dTyped]. | 16 * To use [texImage2d] with a TypedData object, use [texImage2dTyped]. |
| 17 * | 17 * |
| 18 */ | 18 */ |
| 19 @DomName('WebGLRenderingContext.texImage2D') | 19 @DomName('WebGLRenderingContext.texImage2D') |
| 20 $if DART2JS | 20 $if DART2JS |
| 21 @JSName('texImage2D') | 21 @JSName('texImage2D') |
| 22 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 22 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, |
| 23 int format, int type, data) native; | 23 int format, int type, data) native; |
| 24 $else | 24 $else |
| 25 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 25 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, |
| 26 int format, int type, data) { | 26 int format, int type, data) { |
| 27 _texImage2D(targetTexture, levelOfDetail, internalFormat, | 27 if (data is ImageElement) { |
| 28 format, type, data); | 28 texImage2DImage(targetTexture, levelOfDetail, internalFormat, format, |
| 29 type, data); |
| 30 } else if (data is ImageData) { |
| 31 texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format, |
| 32 type, data); |
| 33 } else if (data is CanvasElement) { |
| 34 texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format, |
| 35 type, data); |
| 36 } else { |
| 37 texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format, |
| 38 type, data); |
| 39 } |
| 29 } | 40 } |
| 30 $endif | 41 $endif |
| 31 | 42 |
| 32 /** | 43 /** |
| 33 * Sets the currently bound texture to [data]. | 44 * Sets the currently bound texture to [data]. |
| 34 */ | 45 */ |
| 35 $if DART2JS | 46 $if DART2JS |
| 36 @JSName('texImage2D') | 47 @JSName('texImage2D') |
| 37 void texImage2DTyped(int targetTexture, int levelOfDetail, | 48 void texImage2DTyped(int targetTexture, int levelOfDetail, |
| 38 int internalFormat, int width, int height, int border, int format, | 49 int internalFormat, int width, int height, int border, int format, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 int type, TypedData data) native; | 88 int type, TypedData data) native; |
| 78 $else | 89 $else |
| 79 void texSubImage2DTyped(int targetTexture, int levelOfDetail, | 90 void texSubImage2DTyped(int targetTexture, int levelOfDetail, |
| 80 int internalFormat, int width, int height, int border, int format, | 91 int internalFormat, int width, int height, int border, int format, |
| 81 int type, TypedData data) { | 92 int type, TypedData data) { |
| 82 _texSubImage2D(targetTexture, levelOfDetail, internalFormat, | 93 _texSubImage2D(targetTexture, levelOfDetail, internalFormat, |
| 83 width, height, border, format, type, data); | 94 width, height, border, format, type, data); |
| 84 } | 95 } |
| 85 $endif | 96 $endif |
| 86 } | 97 } |
| OLD | NEW |