author | unc0rr |
Mon, 29 Oct 2018 23:06:18 +0100 | |
changeset 14071 | 4b40bdd214df |
parent 13972 | 03e41712eef8 |
child 14073 | 9c817b2eedae |
permissions | -rw-r--r-- |
13957 | 1 |
extern crate integral_geometry; |
13938 | 2 |
extern crate vec2d; |
3 |
||
13967 | 4 |
use std::cmp; |
13938 | 5 |
|
13965
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
6 |
use integral_geometry::{ArcPoints, EquidistantPoints, LinePoints, Point}; |
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
7 |
|
13938 | 8 |
pub struct Land2D<T> { |
9 |
pixels: vec2d::Vec2D<T>, |
|
14071
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
10 |
play_width: usize, |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
11 |
play_height: usize, |
13938 | 12 |
width_mask: usize, |
13 |
height_mask: usize, |
|
14 |
} |
|
15 |
||
13952 | 16 |
impl<T: Copy + PartialEq> Land2D<T> { |
14071
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
17 |
pub fn new(play_width: usize, play_height: usize, fill_value: T) -> Self { |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
18 |
let real_width = play_width.next_power_of_two(); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
19 |
let real_height = play_height.next_power_of_two(); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
20 |
|
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
21 |
assert!(real_width > 0); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
22 |
assert!(real_height > 0); |
13938 | 23 |
|
24 |
Self { |
|
14071
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
25 |
pixels: vec2d::Vec2D::new(real_width, real_height, fill_value), |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
26 |
play_width, |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
27 |
play_height, |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
28 |
width_mask: !(real_width - 1), |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
29 |
height_mask: !(real_height - 1), |
13938 | 30 |
} |
31 |
} |
|
32 |
||
33 |
#[inline] |
|
13945 | 34 |
pub fn width(&self) -> usize { |
35 |
self.pixels.width() |
|
36 |
} |
|
37 |
||
38 |
#[inline] |
|
39 |
pub fn height(&self) -> usize { |
|
40 |
self.pixels.height() |
|
41 |
} |
|
42 |
||
43 |
#[inline] |
|
14071
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
44 |
pub fn play_width(&self) -> usize { |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
45 |
self.play_width |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
46 |
} |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
47 |
|
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
48 |
#[inline] |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
49 |
pub fn play_height(&self) -> usize { |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
50 |
self.play_height |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
51 |
} |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
52 |
|
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
53 |
#[inline] |
13952 | 54 |
pub fn is_valid_x(&self, x: i32) -> bool { |
55 |
(x as usize & self.width_mask) == 0 |
|
56 |
} |
|
57 |
||
58 |
#[inline] |
|
59 |
pub fn is_valid_y(&self, y: i32) -> bool { |
|
60 |
(y as usize & self.height_mask) == 0 |
|
61 |
} |
|
62 |
||
63 |
#[inline] |
|
13945 | 64 |
pub fn is_valid_coordinate(&self, x: i32, y: i32) -> bool { |
13952 | 65 |
self.is_valid_x(x) && self.is_valid_y(y) |
13938 | 66 |
} |
67 |
||
68 |
#[inline] |
|
13961
1c30793b1cea
put back land2d.map accidentally replaced by testing code
alfadur
parents:
13959
diff
changeset
|
69 |
pub fn map<U: Default, F: FnOnce(&mut T) -> U>(&mut self, y: i32, x: i32, f: F) -> U { |
13938 | 70 |
if self.is_valid_coordinate(x, y) { |
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
71 |
unsafe { |
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
72 |
// hey, I just checked that coordinates are valid! |
13961
1c30793b1cea
put back land2d.map accidentally replaced by testing code
alfadur
parents:
13959
diff
changeset
|
73 |
f(self.pixels.get_unchecked_mut(y as usize, x as usize)) |
13952 | 74 |
} |
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
75 |
} else { |
13961
1c30793b1cea
put back land2d.map accidentally replaced by testing code
alfadur
parents:
13959
diff
changeset
|
76 |
U::default() |
13938 | 77 |
} |
78 |
} |
|
79 |
||
13965
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
80 |
#[inline] |
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
81 |
pub fn map_point<U: Default, F: FnOnce(&mut T) -> U>(&mut self, point: Point, f: F) -> U { |
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
82 |
self.map(point.y, point.x, f) |
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
83 |
} |
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
84 |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
85 |
pub fn fill_from_iter<I>(&mut self, i: I, value: T) -> usize |
13964
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
86 |
where |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
87 |
I: std::iter::Iterator<Item = Point>, |
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
88 |
{ |
13964
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
89 |
i.map(|p| { |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
90 |
self.map(p.y, p.x, |v| { |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
91 |
*v = value; |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
92 |
1 |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
93 |
}) |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
94 |
}).count() |
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
95 |
} |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
96 |
|
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
97 |
pub fn draw_line(&mut self, from: Point, to: Point, value: T) -> usize { |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
98 |
self.fill_from_iter(LinePoints::new(from, to), value) |
13938 | 99 |
} |
13945 | 100 |
|
13969 | 101 |
pub fn fill(&mut self, start_point: Point, border_value: T, fill_value: T) { |
102 |
debug_assert!(self.is_valid_coordinate(start_point.x - 1, start_point.y)); |
|
103 |
debug_assert!(self.is_valid_coordinate(start_point.x, start_point.y)); |
|
13945 | 104 |
|
105 |
let mut stack: Vec<(usize, usize, usize, isize)> = Vec::new(); |
|
13952 | 106 |
fn push<T: Copy + PartialEq>( |
13945 | 107 |
land: &Land2D<T>, |
108 |
stack: &mut Vec<(usize, usize, usize, isize)>, |
|
109 |
xl: usize, |
|
110 |
xr: usize, |
|
111 |
y: usize, |
|
112 |
dir: isize, |
|
113 |
) { |
|
114 |
let yd = y as isize + dir; |
|
115 |
||
116 |
if land.is_valid_coordinate(0, yd as i32) { |
|
117 |
stack.push((xl, xr, yd as usize, dir)); |
|
118 |
} |
|
119 |
}; |
|
120 |
||
13969 | 121 |
let start_x_l = (start_point.x - 1) as usize; |
122 |
let start_x_r = start_point.x as usize; |
|
123 |
push( |
|
124 |
self, |
|
125 |
&mut stack, |
|
126 |
start_x_l, |
|
127 |
start_x_r, |
|
128 |
start_point.y as usize, |
|
129 |
-1, |
|
130 |
); |
|
131 |
push( |
|
132 |
self, |
|
133 |
&mut stack, |
|
134 |
start_x_l, |
|
135 |
start_x_r, |
|
136 |
start_point.y as usize, |
|
137 |
1, |
|
138 |
); |
|
13945 | 139 |
|
13972 | 140 |
while let Some(a) = stack.pop() { |
141 |
let (mut xl, mut xr, y, mut dir) = a; |
|
13945 | 142 |
|
13972 | 143 |
while xl > 0 && self |
144 |
.pixels |
|
145 |
.get(y, xl) |
|
146 |
.map_or(false, |v| *v != border_value && *v != fill_value) |
|
147 |
{ |
|
148 |
xl -= 1; |
|
149 |
} |
|
13945 | 150 |
|
13972 | 151 |
while xr < self.width() - 1 && self |
152 |
.pixels |
|
153 |
.get(y, xr) |
|
154 |
.map_or(false, |v| *v != border_value && *v != fill_value) |
|
155 |
{ |
|
156 |
xr += 1; |
|
157 |
} |
|
13945 | 158 |
|
13972 | 159 |
while xl < xr { |
160 |
while xl <= xr |
|
161 |
&& (self.pixels[y][xl] == border_value || self.pixels[y][xl] == fill_value) |
|
162 |
{ |
|
163 |
xl += 1; |
|
164 |
} |
|
13945 | 165 |
|
13972 | 166 |
let mut x = xl; |
13945 | 167 |
|
13972 | 168 |
while xl <= xr |
169 |
&& (self.pixels[y][xl] != border_value && self.pixels[y][xl] != fill_value) |
|
170 |
{ |
|
171 |
self.pixels[y][xl] = fill_value; |
|
13945 | 172 |
|
13972 | 173 |
xl += 1; |
174 |
} |
|
13945 | 175 |
|
13972 | 176 |
if x < xl { |
177 |
push(self, &mut stack, x, xl - 1, y, dir); |
|
178 |
push(self, &mut stack, x, xl - 1, y, -dir); |
|
13945 | 179 |
} |
180 |
} |
|
181 |
} |
|
182 |
} |
|
13952 | 183 |
|
184 |
#[inline] |
|
185 |
fn fill_circle_line<F: Fn(&mut T) -> usize>( |
|
186 |
&mut self, |
|
187 |
y: i32, |
|
188 |
x_from: i32, |
|
189 |
x_to: i32, |
|
190 |
f: &F, |
|
191 |
) -> usize { |
|
192 |
let mut result = 0; |
|
193 |
||
194 |
if self.is_valid_y(y) { |
|
195 |
for i in cmp::min(x_from, 0) as usize..cmp::max(x_to as usize, self.width() - 1) { |
|
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
196 |
unsafe { |
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
197 |
// coordinates are valid at this point |
13952 | 198 |
result += f(self.pixels.get_unchecked_mut(y as usize, i)); |
199 |
} |
|
200 |
} |
|
201 |
} |
|
202 |
||
203 |
result |
|
204 |
} |
|
205 |
||
206 |
#[inline] |
|
207 |
fn fill_circle_lines<F: Fn(&mut T) -> usize>( |
|
208 |
&mut self, |
|
209 |
x: i32, |
|
210 |
y: i32, |
|
211 |
dx: i32, |
|
212 |
dy: i32, |
|
213 |
f: &F, |
|
214 |
) -> usize { |
|
215 |
self.fill_circle_line(y + dy, x - dx, x + dx, f) |
|
216 |
+ self.fill_circle_line(y - dy, x - dx, x + dx, f) |
|
217 |
+ self.fill_circle_line(y + dx, x - dy, x + dy, f) |
|
218 |
+ self.fill_circle_line(y - dx, x - dy, x + dy, f) |
|
219 |
} |
|
220 |
||
221 |
pub fn change_round<F: Fn(&mut T) -> usize>( |
|
222 |
&mut self, |
|
223 |
x: i32, |
|
224 |
y: i32, |
|
225 |
radius: i32, |
|
226 |
f: F, |
|
227 |
) -> usize { |
|
13964
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
228 |
ArcPoints::new(radius) |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
229 |
.map(&mut |p: Point| self.fill_circle_lines(x, y, p.x, p.y, &f)) |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
230 |
.sum() |
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
231 |
} |
13952 | 232 |
|
13965
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
233 |
pub fn draw_thick_line(&mut self, from: Point, to: Point, radius: i32, value: T) -> usize { |
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
234 |
let mut result = 0; |
13952 | 235 |
|
13970
a1895019bb94
change draw_thick_line iteration order to benchmark winner
alfadur
parents:
13969
diff
changeset
|
236 |
for vector in ArcPoints::new(radius) { |
a1895019bb94
change draw_thick_line iteration order to benchmark winner
alfadur
parents:
13969
diff
changeset
|
237 |
for delta in EquidistantPoints::new(vector) { |
a1895019bb94
change draw_thick_line iteration order to benchmark winner
alfadur
parents:
13969
diff
changeset
|
238 |
for point in LinePoints::new(from, to) { |
13967 | 239 |
self.map_point(point + delta, |p| { |
240 |
if *p != value { |
|
241 |
*p = value; |
|
242 |
result += 1; |
|
243 |
} |
|
244 |
}) |
|
13965
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
245 |
} |
13964
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
246 |
} |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
247 |
} |
a325ed57ebfe
Don't generate unnecessary duplication in case of equal coordinates
unc0rr
parents:
13961
diff
changeset
|
248 |
|
13965
4162ea9ae333
Use integral-geometry iterators to implement Land2D::draw_thick_line, remove no longer unused functions from Land2D
unc0rr
parents:
13964
diff
changeset
|
249 |
result |
13955
9c112f2ae02d
Raise levels of abstraction to implement draw_thick_line() avoiding code duplication
unc0rr
parents:
13952
diff
changeset
|
250 |
} |
13938 | 251 |
} |
252 |
||
253 |
#[cfg(test)] |
|
254 |
mod tests { |
|
255 |
use super::*; |
|
256 |
||
257 |
#[test] |
|
258 |
fn basics() { |
|
14071
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
259 |
let l: Land2D<u8> = Land2D::new(30, 50, 0); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
260 |
|
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
261 |
assert_eq!(l.play_width(), 30); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
262 |
assert_eq!(l.play_height(), 50); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
263 |
assert_eq!(l.width(), 32); |
4b40bdd214df
Use next_power_of_two() just like hedgewars engine does, expose original and real dimensions
unc0rr
parents:
13972
diff
changeset
|
264 |
assert_eq!(l.height(), 64); |
13938 | 265 |
|
266 |
assert!(l.is_valid_coordinate(0, 0)); |
|
267 |
assert!(!l.is_valid_coordinate(-1, -1)); |
|
268 |
||
269 |
assert!(l.is_valid_coordinate(31, 63)); |
|
270 |
assert!(!l.is_valid_coordinate(32, 63)); |
|
271 |
assert!(!l.is_valid_coordinate(31, 64)); |
|
272 |
} |
|
273 |
||
13945 | 274 |
#[test] |
275 |
fn fill() { |
|
13952 | 276 |
let mut l: Land2D<u8> = Land2D::new(128, 128, 0); |
13945 | 277 |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
278 |
l.draw_line(Point::new(0, 0), Point::new(32, 96), 1); |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
279 |
l.draw_line(Point::new(32, 96), Point::new(64, 32), 1); |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
280 |
l.draw_line(Point::new(64, 32), Point::new(96, 80), 1); |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
281 |
l.draw_line(Point::new(96, 80), Point::new(128, 0), 1); |
13945 | 282 |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
283 |
l.draw_line(Point::new(0, 128), Point::new(64, 96), 1); |
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13957
diff
changeset
|
284 |
l.draw_line(Point::new(128, 128), Point::new(64, 96), 1); |
13945 | 285 |
|
13969 | 286 |
l.fill(Point::new(32, 32), 1, 2); |
287 |
l.fill(Point::new(16, 96), 1, 3); |
|
288 |
l.fill(Point::new(60, 100), 1, 4); |
|
13945 | 289 |
|
290 |
assert_eq!(l.pixels[0][0], 1); |
|
291 |
assert_eq!(l.pixels[96][64], 1); |
|
292 |
||
293 |
assert_eq!(l.pixels[40][32], 2); |
|
294 |
assert_eq!(l.pixels[40][96], 2); |
|
295 |
assert_eq!(l.pixels[5][0], 3); |
|
296 |
assert_eq!(l.pixels[120][0], 3); |
|
297 |
assert_eq!(l.pixels[5][127], 3); |
|
298 |
assert_eq!(l.pixels[120][127], 3); |
|
299 |
assert_eq!(l.pixels[35][64], 3); |
|
300 |
assert_eq!(l.pixels[120][20], 4); |
|
301 |
assert_eq!(l.pixels[120][100], 4); |
|
302 |
assert_eq!(l.pixels[100][64], 4); |
|
303 |
} |
|
13938 | 304 |
} |