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

Unified Diff: sky/engine/core/painting/Canvas.dart

Issue 1135283005: Sky: Add a CustomDart attribute to the IDL compiler, and use that with Canvas (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: . Created 5 years, 7 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/painting/Canvas.cpp ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Canvas.dart
diff --git a/sky/engine/core/painting/Canvas.dart b/sky/engine/core/painting/Canvas.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0d75a63bd8e577ba6825a65e8c0d6aad5e31cd15
--- /dev/null
+++ b/sky/engine/core/painting/Canvas.dart
@@ -0,0 +1,40 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This extends the Canvas.dart generated from Canvas.idl.
+
+class Rect {
+ List<double> _value;
+ double get left => _value[0];
+ double get top => _value[1];
+ double get right => _value[2];
+ double get bottom => _value[3];
+
+ void setLTRB(double left, double top, double right, double bottom) {
+ _value = [left, top, right, bottom];
+ }
+}
+
+class Canvas extends _Canvas {
+ double get height => _height;
+ double get width => _width;
+
+ void save() => _save();
+ void saveLayer(Rect bounds, Paint paint) =>
+ _saveLayer(bounds._value, Paint paint);
+ void restore() => _restore();
+ void translate(double dx, double dy) => _translate(dx, dy);
+ void scale(double sx, double sy) => _scale(sx, sy);
+ void rotateDegrees(double degrees) => _rotateDegrees(degrees);
+ void skew(double sx, double sy) => _skew(sx, sy);
+ void concat(List<double> matrix9) => _concat(matrix9);
+ void clipRect(Rect rect) => _clipRect(rect._value);
+
+ void drawPicture(Picture picture) => _drawPicture(picture);
+ void drawPaint(Paint paint) => _drawPaint(paint);
+ void drawRect(Rect rect, Paint paint) => _drawRect(rect._value, paint);
+ void drawOval(Rect rect, Paint paint) => _drawOval(rect._value, paint);
+ void drawCircle(double x, double y, double radius, Paint paint) =>
+ _drawCircle(x, y, radius, paint);
+}
« no previous file with comments | « sky/engine/core/painting/Canvas.cpp ('k') | sky/engine/core/painting/Canvas.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698