Commit 062e0106 authored by Adam Barth's avatar Adam Barth

Merge pull request #558 from abarth/compositing_offset

Fix upload of composited scene with non-zero offsets
parents 1a351a65 a35344f4
...@@ -140,7 +140,7 @@ class StatisticsLayer extends Layer { ...@@ -140,7 +140,7 @@ class StatisticsLayer extends Layer {
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
assert(optionsMask != null); assert(optionsMask != null);
builder.addStatistics(optionsMask, paintBounds.shift(layerOffset)); builder.addStatistics(optionsMask, paintBounds.shift(offset + layerOffset));
builder.setRasterizerTracingThreshold(rasterizerThreshold); builder.setRasterizerTracingThreshold(rasterizerThreshold);
} }
} }
...@@ -231,10 +231,10 @@ class ContainerLayer extends Layer { ...@@ -231,10 +231,10 @@ class ContainerLayer extends Layer {
} }
/// Uploads all of this layer's children to the engine /// Uploads all of this layer's children to the engine
void addChildrenToScene(ui.SceneBuilder builder, Offset layerOffset) { void addChildrenToScene(ui.SceneBuilder builder, Offset childOffset) {
Layer child = _firstChild; Layer child = _firstChild;
while (child != null) { while (child != null) {
child.addToScene(builder, layerOffset); child.addToScene(builder, childOffset);
child = child.nextSibling; child = child.nextSibling;
} }
} }
...@@ -268,8 +268,9 @@ class ClipRectLayer extends ContainerLayer { ...@@ -268,8 +268,9 @@ class ClipRectLayer extends ContainerLayer {
// instead of in the coordinate system of this layer? // instead of in the coordinate system of this layer?
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipRect(clipRect.shift(layerOffset)); Offset childOffset = offset + layerOffset;
addChildrenToScene(builder, offset + layerOffset); builder.pushClipRect(clipRect.shift(childOffset));
addChildrenToScene(builder, childOffset);
builder.pop(); builder.pop();
} }
...@@ -293,8 +294,9 @@ class ClipRRectLayer extends ContainerLayer { ...@@ -293,8 +294,9 @@ class ClipRRectLayer extends ContainerLayer {
// instead of in the coordinate system of this layer? // instead of in the coordinate system of this layer?
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipRRect(clipRRect.shift(layerOffset), bounds.shift(layerOffset)); Offset childOffset = offset + layerOffset;
addChildrenToScene(builder, offset + layerOffset); builder.pushClipRRect(clipRRect.shift(childOffset), bounds.shift(childOffset));
addChildrenToScene(builder, childOffset);
builder.pop(); builder.pop();
} }
...@@ -319,8 +321,9 @@ class ClipPathLayer extends ContainerLayer { ...@@ -319,8 +321,9 @@ class ClipPathLayer extends ContainerLayer {
// in the coordinate system of this layer? // in the coordinate system of this layer?
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushClipPath(clipPath.shift(layerOffset), bounds.shift(layerOffset)); Offset childOffset = offset + layerOffset;
addChildrenToScene(builder, offset + layerOffset); builder.pushClipPath(clipPath.shift(childOffset), bounds.shift(childOffset));
addChildrenToScene(builder, childOffset);
builder.pop(); builder.pop();
} }
...@@ -368,8 +371,9 @@ class OpacityLayer extends ContainerLayer { ...@@ -368,8 +371,9 @@ class OpacityLayer extends ContainerLayer {
int alpha; int alpha;
void addToScene(ui.SceneBuilder builder, Offset layerOffset) { void addToScene(ui.SceneBuilder builder, Offset layerOffset) {
builder.pushOpacity(alpha, bounds?.shift(layerOffset)); Offset childOffset = offset + layerOffset;
addChildrenToScene(builder, offset + layerOffset); builder.pushOpacity(alpha, bounds?.shift(childOffset));
addChildrenToScene(builder, childOffset);
builder.pop(); builder.pop();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment