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

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: Rework the API a bit 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
« sky/sdk/lib/rendering/object.dart ('K') | « sky/sdk/lib/widgets/scaffold.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/resources/display_list.dart
diff --git a/sky/tests/resources/display_list.dart b/sky/tests/resources/display_list.dart
index a83f34d0aa9878ed6cdda5111169934f4510891c..0e22d052144a98844839901af842bd94d20d2961 100644
--- a/sky/tests/resources/display_list.dart
+++ b/sky/tests/resources/display_list.dart
@@ -2,6 +2,7 @@
import 'dart:async';
import 'dart:sky' as sky;
import "dart:sky.internals" as internals;
+import 'dart:typed_data';
import 'package:sky/widgets/basic.dart';
import 'package:sky/rendering/box.dart';
@@ -9,12 +10,29 @@ import 'package:sky/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(width, height, this.logger, indent: this.indent);
abarth-chromium 2015/06/20 00:50:29 This function then becomes: return new TestCanvas
+ }
+}
+
+class TestCanvas extends sky.Canvas {
+ TestCanvas(this.width, this.height, this.logger, { this.indent: '' }) {
abarth-chromium 2015/06/20 00:50:29 I'd call |super| here.
+ log("TestCanvas() constructor: $width x $height");
}
final String indent;
@@ -54,8 +72,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) {
@@ -108,7 +126,7 @@ class TestDisplayList extends RenderObjectDisplayList {
void paintChild(RenderObject child, Point position) {
log("paintChild ${child.runtimeType} at $position");
- child.paint(new TestDisplayList(width, height, logger, indent: "$indent |"));
+ child.paint(new TestCanvas(width, height, logger, indent: "$indent |"));
}
}
@@ -134,8 +152,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/rendering/object.dart ('K') | « sky/sdk/lib/widgets/scaffold.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698