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

Unified Diff: sky/sdk/lib/framework/paint.dart

Issue 1143053003: Paint tree logic for layout2.dart Base URL: https://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/sdk/lib/framework/layout2.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/paint.dart
diff --git a/sky/sdk/lib/framework/paint.dart b/sky/sdk/lib/framework/paint.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b3fb034999566f32b8654e53996f6f2490f8ea80
--- /dev/null
+++ b/sky/sdk/lib/framework/paint.dart
@@ -0,0 +1,71 @@
+library paint;
+
+class Matrix extends NativeFieldWrapperClass2 {
+ static final Matrix IDENTITY = new Matrix.transformation(1, 0, 0, 1, 0, 0);
+
+ // set a transformation
+ external Matrix.transformation(double a, double b, double c, double d, double e, double f);
+
+ // translate by dx,dy
+ external Matrix.translation(double dx, double dy);
+ external void translate(double dx, double dy);
+
+ // rotate theta radians clockwise around cx,cy
+ external Matrix.rotation(double cx, double cy, double theta);
+ external void rotate(double cx, double cy, double theta);
+
+ // ...
+}
+
+class Filter {
+ // ...
+}
+
+class Rect {
+ const Rect({ this.x, this.y, this.width, this.height });
+ final double x;
+ final double y;
+ final double width;
+ final double height;
+}
+
+class DisplayList extends NativeFieldWrapperClass2 {
+ // Wraps an SkPictureRecorder.
+ // All APIs throw once the recording has been ended.
+
+ DisplayList({ this.cullRect });
+ // Creates an SkPictureRecorder and starts recording.
+ // Note that Skia today assumes that the cullRect origin is (0,0),
+ // but this API does not (because we may want to draw outside a
+ // widget's bounds, inflating it on all sides, e.g. to draw a focus
+ // outline, but yet still put the widget top left at 0,0).
+
+ // Drawing commands outside these bounds (if set) may be optimised away.
+ // However, this is not guaranteed.
+ final Rect cullRect;
+
+ // Drawing API - circles, lines, rectangles, gradients, etc
+ // (defers to the canvas created when this class was instantiated)
+ // ...
+ external void pushTransform();
+ external Matrix get transform;
+ external void set transform (Matrix value);
+ external void popTransform();
+
+ external void drawPaintNode(PaintNode node, { Matrix transform: null, Filter filter: null });
+ // Inserts a PaintNode (i.e. SkDrawable) into the recording.
+ // assume: if (transform == null) transform = Matrix.IDENTITY;
+}
+
+class PaintNode extends NativeFieldWrapperClass2 {
+ // Wraps an SkDrawable.
+ // A PaintNode is inherently paintable, though that isn't exposed to
+ // the Dart side.
+
+ external setDisplayList(DisplayList picture);
+ // Ends picture's recording and updates the SkDrawable to that new
+ // picture, notifying the C++ side of the change so that the next
+ // time we paint, we use this new picture.
+}
+
+external PaintNode rootPaintNode;
« no previous file with comments | « sky/sdk/lib/framework/layout2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698