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

Unified Diff: sky/tests/resources/display_list.dart

Issue 1190123003: Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia co… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
Index: sky/tests/resources/display_list.dart
diff --git a/sky/tests/resources/display_list.dart b/sky/tests/resources/display_list.dart
index 71f5202ac714957e7ba06467b92df1179b055a6a..bed194045a08786c63edcf25b20f6c1c37e7cbea 100644
--- a/sky/tests/resources/display_list.dart
+++ b/sky/tests/resources/display_list.dart
@@ -1,22 +1,41 @@
import 'dart:sky' as sky;
+import 'dart:typed_data';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/object.dart';
typedef void Logger (String s);
-class TestDisplayList extends RenderObjectDisplayList {
- TestDisplayList(double width, double height, this.logger, { this.indent: '' }) :
- this.width = width,
- this.height = height,
- super(width, height) {
- log("TestDisplayList() constructor: $width x $height");
+class TestPictureRecorder extends sky.PictureRecorder {
+ TestPictureRecorder(this.logger, { this.indent: '' }) {
+ log("TestPictureRecorder() constructor");
+ }
+ final String indent;
+ Logger logger;
+
+ void log(String s) {
+ logger("${indent} ${s}");
+ }
+
+ sky.Canvas beginRecording(double width, double height) {
+ log("beginRecording($width, $height)");
+
+ var canvas = super.beginRecording(width, height);
+
+ return new TestCanvas(canvas, width, height, this.logger, indent: this.indent);
+ }
+}
+
+class TestCanvas implements sky.Canvas {
+ TestCanvas(this.canvas, this.width, this.height, this.logger, { this.indent: '' }) {
+ log("TestCanvas() constructor: $width x $height");
}
final String indent;
final double width;
final double height;
+ sky.Canvas canvas;
abarth-chromium 2015/06/18 00:03:52 I don't think you need to pass |canvas| to this ob
iansf 2015/06/20 00:02:40 Done. (This file is still in flux, though, so don
Logger logger;
void log(String s) {
@@ -56,8 +75,8 @@ class TestDisplayList extends RenderObjectDisplayList {
log("skew($sx, $sy)");
}
- void concat(List<double> matrix9) {
- log("concat($matrix9)");
+ void concat(Float32List matrix4) {
+ log("concat($matrix4)");
}
void clipRect(Rect rect) {
@@ -107,11 +126,6 @@ class TestDisplayList extends RenderObjectDisplayList {
void drawImage(sky.Image image, double x, double y, Paint paint) {
log("drawImage($image, $x, $y, ${explainPaint(paint)})");
}
-
- void paintChild(RenderObject child, Point position) {
- log("paintChild ${child.runtimeType} at $position");
- child.paint(new TestDisplayList(width, height, logger, indent: "$indent |"));
- }
}
class TestRenderView extends RenderView {
@@ -136,8 +150,10 @@ class TestRenderView extends RenderView {
frame += 1;
lastPaint = '';
log("PAINT FOR FRAME #${frame} ----------------------------------------------");
- var canvas = new TestDisplayList(rootConstraints.width, rootConstraints.height, log, indent: "${frame} |");
+ var recorder = new TestPictureRecorder(log, indent: "${frame} |");
+ var canvas = recorder.beginRecording(rootConstraints.width, rootConstraints.height);
paint(canvas);
+ recorder.endRecording();
log("------------------------------------------------------------------------");
RenderObject.debugDoingPaint = false;
}
« sky/sdk/lib/framework/rendering/stack.dart ('K') | « sky/sdk/lib/framework/widgets/scaffold.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698