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

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

Issue 12775010: Added the CanvasImageSource interface, which all types that a canvas can draw (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 571032b69d701a779ff6cdc7db4e6ed8bc6d33b5..96a3aa0e384301c91bf75bd49a01161963b333c3 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -1081,7 +1081,7 @@ class CDataSection extends Text {
@DomName('HTMLCanvasElement')
-class CanvasElement extends _Element_Merged {
+class CanvasElement extends _Element_Merged implements CanvasImageSource {
CanvasElement.internal() : super.internal();
@DomName('HTMLCanvasElement.HTMLCanvasElement')
@@ -1560,7 +1560,7 @@ class CanvasRenderingContext2D extends CanvasRenderingContext {
@DocsEditable
CanvasGradient createRadialGradient(num x0, num y0, num r0, num x1, num y1, num r1) native "CanvasRenderingContext2D_createRadialGradient_Callback";
- void drawImage(canvas_OR_image_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) {
+ void $dom_drawImage(canvas_OR_image_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) {
if ((canvas_OR_image_OR_video is ImageElement || canvas_OR_image_OR_video == null) && (sx_OR_x is num || sx_OR_x == null) && (sy_OR_y is num || sy_OR_y == null) && !?sw_OR_width && !?height_OR_sh && !?dx && !?dy && !?dw && !?dh) {
_drawImage_1(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y);
return;
@@ -1881,6 +1881,25 @@ class CanvasRenderingContext2D extends CanvasRenderingContext {
$dom_arc(x, y, radius, startAngle, endAngle, anticlockwise);
}
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImage(CanvasImageSource source, num x, num y) {
+ $dom_drawImage(source, x, y);
+ }
+
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImageAndScale(CanvasImageSource source, num x, num y, num width, num
+ height) {
+ $dom_drawImage(source, x, y, width, height);
+ }
+
+ @DomName('CanvasRenderingContext2D.drawImage')
+ void drawImageAndTransform(CanvasImageSource source, num sourceX, num sourceY,
+ num sourceWidth, num sourceHeight, num destinationX, num destinationY,
+ num destinationWidth, num destinationHeight) {
+ $dom_drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight,
+ destinationX, destinationY, destinationWidth, destinationHeight);
+ }
+
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -14333,12 +14352,9 @@ class ImageData extends NativeFieldWrapperClass1 {
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// WARNING: Do not edit - generated code.
-
-@DocsEditable
@DomName('HTMLImageElement')
-class ImageElement extends _Element_Merged {
+class ImageElement extends _Element_Merged implements CanvasImageSource {
ImageElement.internal() : super.internal();
@DomName('HTMLImageElement.HTMLImageElement')
@@ -26179,12 +26195,9 @@ class ValidityState extends NativeFieldWrapperClass1 {
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// WARNING: Do not edit - generated code.
-
-@DocsEditable
@DomName('HTMLVideoElement')
-class VideoElement extends MediaElement {
+class VideoElement extends MediaElement implements CanvasImageSource {
VideoElement.internal() : super.internal();
@DomName('HTMLVideoElement.HTMLVideoElement')
@@ -32266,6 +32279,12 @@ class _DataAttributeMap implements Map<String, String> {
// BSD-style license that can be found in the LICENSE file.
+abstract class CanvasImageSource {}
+// 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
+// BSD-style license that can be found in the LICENSE file.
+
+
/**
* An object representing the top-level context object for web scripting.
*
@@ -35264,6 +35283,7 @@ class _Utils {
static window() native "Utils_window";
static print(String message) native "Utils_print";
+ static forwardingPrint(String message) native "Utils_forwardingPrint";
static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_spawnDomFunction";
static int _getNewIsolateId() native "Utils_getNewIsolateId";
static bool shadowRootSupported(Document document) native "Utils_shadowRootSupported";
@@ -35343,3 +35363,5 @@ get _printClosure => (s) {
_Utils.print(s);
}
};
+
+final _forwardingPrintClosure = _Utils.forwardingPrint;

Powered by Google App Engine
This is Rietveld 408576698