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

Unified Diff: sky/examples/raw/paint_element_into_displaylist.sky

Issue 1144673002: Make it possible to Paint elements into a display list. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add example 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/raw/paint_element_into_displaylist.sky
diff --git a/sky/examples/raw/paint_element_into_displaylist.sky b/sky/examples/raw/paint_element_into_displaylist.sky
new file mode 100644
index 0000000000000000000000000000000000000000..c684836d0cdb75b0425a408041123de699bda9a2
--- /dev/null
+++ b/sky/examples/raw/paint_element_into_displaylist.sky
@@ -0,0 +1,24 @@
+<script>
+import "dart:sky";
+
+void main() {
+ var root = document.createElement('div');
+ root.style['display'] = 'paragraph';
+ root.appendChild(new Text('Hello World'));
+ document.appendChild(root);
+ root.offsetWidth; // force layout.
+
+ double width = window.innerWidth.toDouble();
+ double height = window.innerHeight.toDouble();
+ PictureRecorder recorder = new PictureRecorder(width, height);
+ Paint paint = new Paint()..setARGB(255, 0, 255, 0);
+ recorder.drawCircle(50.0, 50.0, 50.0, paint);
+ recorder.translate(10.0, 10.0);
+ root.paint(recorder);
+ recorder.translate(10.0, 10.0);
+ root.paint(recorder);
+ recorder.translate(10.0, 10.0);
+ root.paint(recorder);
+ document.rootPicture = recorder.endRecording();
+}
+</script>
« no previous file with comments | « sky/engine/core/painting/Canvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698