From 8475cd58712ee2407206b7ddb320ee748ad8510b Mon Sep 17 00:00:00 2001 From: Hixie Date: Thu, 20 Nov 2014 15:30:30 -0800 Subject: [PATCH] Specs: Simplify the paint model. Now you are not responsible for actually telling your child to paint, you just say where it would paint. The platform then takes care of making sure all the dirty nodes have their paint() methods called. Review URL: https://codereview.chromium.org/744843003 --- .../src/flutter/examples/style/hex-layout.sky | 30 +++++++++---------- .../flutter/examples/style/toolbar-layout.sky | 4 +-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/engine/src/flutter/examples/style/hex-layout.sky b/engine/src/flutter/examples/style/hex-layout.sky index 2633c0f38c8..3f223c39558 100644 --- a/engine/src/flutter/examples/style/hex-layout.sky +++ b/engine/src/flutter/examples/style/hex-layout.sky @@ -69,22 +69,20 @@ let loop = children.next(); while (!loop.done) { let child = loop.value; - if (child.needsPaint || child.descendantNeedsPaint) { - canvas.save(); - try { - canvas.beginPath(); - canvas.moveTo(child.x, child.y + cellDim/4); - canvas.lineTo(child.x + cellDim/2, child.y); - canvas.lineTo(child.x + cellDim, child.y + cellDim/4); - canvas.lineTo(child.x + cellDim, child.y + 3*cellDim/4); - canvas.lineTo(child.x + cellDim/2, child.y + cellDim); - canvas.moveTo(child.x, child.y + 3*cellDim/4); - canvas.closePath(); - canvas.clip(); - this.paintChild(child); - } finally { - canvas.restore(); - } + canvas.save(); + try { + canvas.beginPath(); + canvas.moveTo(child.x, child.y + cellDim/4); + canvas.lineTo(child.x + cellDim/2, child.y); + canvas.lineTo(child.x + cellDim, child.y + cellDim/4); + canvas.lineTo(child.x + cellDim, child.y + 3*cellDim/4); + canvas.lineTo(child.x + cellDim/2, child.y + cellDim); + canvas.moveTo(child.x, child.y + 3*cellDim/4); + canvas.closePath(); + canvas.clip(); + canvas.paintChild(child); + } finally { + canvas.restore(); } loop = children.next(); } diff --git a/engine/src/flutter/examples/style/toolbar-layout.sky b/engine/src/flutter/examples/style/toolbar-layout.sky index a10191e4c25..ff9038ca3cd 100644 --- a/engine/src/flutter/examples/style/toolbar-layout.sky +++ b/engine/src/flutter/examples/style/toolbar-layout.sky @@ -188,9 +188,9 @@ SKY MODULE let children = this.walkChildren(); let loop = children.next(); while ((!loop.done) && (loop.value != this.firstSkippedChild)) - this.paintChild(loop.value, canvas); + canvas.paintChild(loop.value); if (this.showingOverflow) - this.paintChild(this.overflowChild, canvas); + canvas.paintChild(this.overflowChild); } function inChild(child, x, y) { return (x >= child.x) && (y >= child.y) && (x < child.x+child.width) && (y < child.y+child.height);