Mercurial > projects > doodle
comparison doodle/dia/layer_stack.d @ 74:c03ed75c0f8e
Icky
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 15 Aug 2010 01:11:58 +0930 |
parents | |
children | b759414d2b72 |
comparison
equal
deleted
inserted
replaced
73:6f2525e170f2 | 74:c03ed75c0f8e |
---|---|
1 module doodle.dia.layer_stack; | |
2 | |
3 public { | |
4 import doodle.dia.icanvas; | |
5 } | |
6 | |
7 final class LayerStack { | |
8 this(in Layer[] layers) { | |
9 _layers = layers.dup; | |
10 } | |
11 | |
12 Rectangle bounds() const { | |
13 // Take the union of all layer bounds | |
14 Rectangle bounds = Rectangle.DEFAULT; | |
15 foreach (layer; _layers) { bounds = bounds | layer.bounds; } | |
16 assert(bounds.valid); | |
17 return bounds; | |
18 } | |
19 | |
20 void draw(in Rectangle pixelDamage, scope Context pixelCr, | |
21 in Rectangle modelDamage, scope Context modelCr) { | |
22 foreach(layer; _layers) { | |
23 layer.draw(pixelDamage, pixelCr, modelDamage, modelCr); | |
24 } | |
25 } | |
26 | |
27 private { | |
28 Layer[] _layers; | |
29 } | |
30 } |