| 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') | |
| 20 $if DART2JS | 19 $if DART2JS |
| 21 @JSName('texImage2D') | 20 @JSName('texImage2D') |
| 22 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 21 void texImage2DUntyped(int targetTexture, int levelOfDetail, |
| 23 int format, int type, data) native; | 22 int internalFormat, int format, int type, data) native; |
| 24 $else | 23 $else |
| 25 void texImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 24 void texImage2DUntyped(int targetTexture, int levelOfDetail, |
| 26 int format, int type, data) { | 25 int internalFormat, int format, int type, data) { |
| 27 if (data is ImageElement) { | 26 if (data is ImageElement) { |
| 28 texImage2DImage(targetTexture, levelOfDetail, internalFormat, format, | 27 texImage2DImage(targetTexture, levelOfDetail, internalFormat, format, |
| 29 type, data); | 28 type, data); |
| 30 } else if (data is ImageData) { | 29 } else if (data is ImageData) { |
| 31 texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format, | 30 texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format, |
| 32 type, data); | 31 type, data); |
| 33 } else if (data is CanvasElement) { | 32 } else if (data is CanvasElement) { |
| 34 texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format, | 33 texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format, |
| 35 type, data); | 34 type, data); |
| 36 } else { | 35 } else { |
| 37 texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format, | 36 texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format, |
| 38 type, data); | 37 type, data); |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 $endif | 40 $endif |
| 42 | 41 |
| 43 /** | 42 /** |
| 44 * Sets the currently bound texture to [data]. | 43 * Sets the currently bound texture to [data]. |
| 45 */ | 44 */ |
| 46 $if DART2JS | 45 $if DART2JS |
| 47 @JSName('texImage2D') | 46 @JSName('texImage2D') |
| 48 void texImage2DTyped(int targetTexture, int levelOfDetail, | 47 void texImage2DTyped(int targetTexture, int levelOfDetail, |
| 49 int internalFormat, int width, int height, int border, int format, | 48 int internalFormat, int width, int height, int border, int format, |
| 50 int type, TypedData data) native; | 49 int type, TypedData data) native; |
| 51 $else | 50 $else |
| 52 void texImage2DTyped(int targetTexture, int levelOfDetail, int internalFormat, | 51 void texImage2DTyped(int targetTexture, int levelOfDetail, int internalFormat, |
| 53 int width, int height, int border, int format, int type, TypedData data) { | 52 int width, int height, int border, int format, int type, TypedData data) { |
| 54 _texImage2D(targetTexture, levelOfDetail, internalFormat, | 53 texImage2D(targetTexture, levelOfDetail, internalFormat, |
| 55 width, height, border, format, type, data); | 54 width, height, border, format, type, data); |
| 56 } | 55 } |
| 57 $endif | 56 $endif |
| 58 | 57 |
| 59 /** | 58 /** |
| 60 * Updates a sub-rectangle of the currently bound texture to [data]. | 59 * Updates a sub-rectangle of the currently bound texture to [data]. |
| 61 * | 60 * |
| 62 * [data] can be either an [ImageElement], a | 61 * [data] can be either an [ImageElement], a |
| 63 * [CanvasElement], a [VideoElement], or an [ImageData] object. | 62 * [CanvasElement], a [VideoElement], or an [ImageData] object. |
| 64 * | 63 * |
| 65 * To use [texSubImage2d] with a TypedData object, use [texSubImage2dTyped]. | 64 * To use [texSubImage2d] with a TypedData object, use [texSubImage2dTyped]. |
| 66 * | 65 * |
| 67 */ | 66 */ |
| 68 @DomName('WebGLRenderingContext.texSubImage2D') | |
| 69 $if DART2JS | 67 $if DART2JS |
| 70 @JSName('texSubImage2D') | 68 @JSName('texSubImage2D') |
| 71 void texSubImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 69 void texSubImage2DUntyped(int targetTexture, int levelOfDetail, |
| 72 int format, int type, data) native; | 70 int internalFormat, int format, int type, data) native; |
| 73 $else | 71 $else |
| 74 void texSubImage2D(int targetTexture, int levelOfDetail, int internalFormat, | 72 void texSubImage2DUntyped(int targetTexture, int levelOfDetail, |
| 75 int format, int type, data) { | 73 int internalFormat, int format, int type, data) { |
| 76 _texSubImage2D(targetTexture, levelOfDetail, internalFormat, | 74 texSubImage2D(targetTexture, levelOfDetail, internalFormat, |
| 77 format, type, data); | 75 format, type, data); |
| 78 } | 76 } |
| 79 $endif | 77 $endif |
| 80 | 78 |
| 81 /** | 79 /** |
| 82 * Updates a sub-rectangle of the currently bound texture to [data]. | 80 * Updates a sub-rectangle of the currently bound texture to [data]. |
| 83 */ | 81 */ |
| 84 $if DART2JS | 82 $if DART2JS |
| 85 @JSName('texSubImage2D') | 83 @JSName('texSubImage2D') |
| 86 void texSubImage2DTyped(int targetTexture, int levelOfDetail, | 84 void texSubImage2DTyped(int targetTexture, int levelOfDetail, |
| 87 int internalFormat, int width, int height, int border, int format, | 85 int internalFormat, int width, int height, int border, int format, |
| 88 int type, TypedData data) native; | 86 int type, TypedData data) native; |
| 89 $else | 87 $else |
| 90 void texSubImage2DTyped(int targetTexture, int levelOfDetail, | 88 void texSubImage2DTyped(int targetTexture, int levelOfDetail, |
| 91 int internalFormat, int width, int height, int border, int format, | 89 int internalFormat, int width, int height, int border, int format, |
| 92 int type, TypedData data) { | 90 int type, TypedData data) { |
| 93 _texSubImage2D(targetTexture, levelOfDetail, internalFormat, | 91 texSubImage2D(targetTexture, levelOfDetail, internalFormat, |
| 94 width, height, border, format, type, data); | 92 width, height, border, format, type, data); |
| 95 } | 93 } |
| 96 $endif | 94 $endif |
| 97 } | 95 } |
| OLD | NEW |