diff --git a/core/src/avm1/object/bitmap_data.rs b/core/src/avm1/object/bitmap_data.rs index 454ecc510..4b521de16 100644 --- a/core/src/avm1/object/bitmap_data.rs +++ b/core/src/avm1/object/bitmap_data.rs @@ -373,6 +373,10 @@ impl BitmapData { 255 }; + for _ in 0..6 { + rng.gen_range(low..high); + } + Color::argb(a, r, g, b) }; @@ -384,6 +388,11 @@ impl BitmapData { for _ in 0..(x + 1) { rng.gen(); } + } else if !gray_scale { + rng = LehmerRNG::with_seed(true_seed); + for _ in 0..(self.height() * (x + 1)) { + rng.gen(); + } } } } diff --git a/core/tests/swfs/avm1/bitmap_data_noise/output.txt b/core/tests/swfs/avm1/bitmap_data_noise/output.txt index c50a4f3ab..3b0b832f9 100644 --- a/core/tests/swfs/avm1/bitmap_data_noise/output.txt +++ b/core/tests/swfs/avm1/bitmap_data_noise/output.txt @@ -1,287 +1,379 @@ // noise(1) without transparency // bitmap.getPixel32(0, 0) -ffa7f1d9 +ff:a7:f1:d9 // noise(2) without transparency // bitmap.getPixel32(0, 0) -ff4ee2b3 +ff:4e:e2:b3 // noise(1, 0, 255, 1, true) without transparency // bitmap.getPixel32(0, 0) -ffa7a7a7 +ff:a7:a7:a7 // bitmap.getPixel32(0, 1) -fff1f1f1 +ff:f1:f1:f1 // bitmap.getPixel32(0, 2) -ffd9d9d9 +ff:d9:d9:d9 // bitmap.getPixel32(0, 3) -ff2a2a2a +ff:2a:2a:2a // bitmap.getPixel32(0, 4) -ff828282 +ff:82:82:82 // bitmap.getPixel32(0, 5) -ffc8c8c8 +ff:c8:c8:c8 // bitmap.getPixel32(0, 6) -ffd8d8d8 +ff:d8:d8:d8 // bitmap.getPixel32(0, 7) -fffefefe +ff:fe:fe:fe // bitmap.getPixel32(0, 8) -ff434343 +ff:43:43:43 // bitmap.getPixel32(0, 9) -ff4d4d4d +ff:4d:4d:4d // noise(1, 0, 255, 1, true) with transparency // bitmap.getPixel32(0, 0) -ffa7a7a7 +ff:a7:a7:a7 // bitmap.getPixel32(1, 0) -fff1f1f1 +ff:f1:f1:f1 // bitmap.getPixel32(2, 0) -ffd9d9d9 +ff:d9:d9:d9 // bitmap.getPixel32(3, 0) -ff2a2a2a +ff:2a:2a:2a // bitmap.getPixel32(4, 0) -ff828282 +ff:82:82:82 // bitmap.getPixel32(5, 0) -ffc8c8c8 +ff:c8:c8:c8 // bitmap.getPixel32(6, 0) -ffd8d8d8 +ff:d8:d8:d8 // bitmap.getPixel32(7, 0) -fffefefe +ff:fe:fe:fe // bitmap.getPixel32(8, 0) -ff434343 +ff:43:43:43 // bitmap.getPixel32(9, 0) -ff4d4d4d +ff:4d:4d:4d // noise(1, 0, 255, 1, true) with transparency // bitmap.getPixel32(0, 0) -ffa7a7a7 +ff:a7:a7:a7 // bitmap.getPixel32(1, 0) -fff1f1f1 +ff:f1:f1:f1 // bitmap.getPixel32(2, 0) -ffd9d9d9 +ff:d9:d9:d9 // bitmap.getPixel32(3, 0) -ff2a2a2a +ff:2a:2a:2a // bitmap.getPixel32(4, 0) -ff828282 +ff:82:82:82 // bitmap.getPixel32(5, 0) -ffc8c8c8 +ff:c8:c8:c8 // bitmap.getPixel32(6, 0) -ffd8d8d8 +ff:d8:d8:d8 // bitmap.getPixel32(7, 0) -fffefefe +ff:fe:fe:fe // bitmap.getPixel32(8, 0) -ff434343 +ff:43:43:43 // bitmap.getPixel32(9, 0) -ff4d4d4d +ff:4d:4d:4d // bitmap.getPixel32(10, 0) -ff989898 +ff:98:98:98 // bitmap.getPixel32(11, 0) -ff555555 +ff:55:55:55 // bitmap.getPixel32(12, 0) -ff8c8c8c +ff:8c:8c:8c // bitmap.getPixel32(13, 0) -ffe2e2e2 +ff:e2:e2:e2 // bitmap.getPixel32(14, 0) -ffb3b3b3 +ff:b3:b3:b3 // bitmap.getPixel32(15, 0) -ff474747 +ff:47:47:47 // bitmap.getPixel32(16, 0) -ff171717 +ff:17:17:17 // bitmap.getPixel32(17, 0) -ff111111 +ff:11:11:11 // bitmap.getPixel32(18, 0) -ff989898 +ff:98:98:98 // bitmap.getPixel32(19, 0) -ff545454 +ff:54:54:54 // bitmap.getPixel32(20, 0) -ff2f2f2f +ff:2f:2f:2f // bitmap.getPixel32(21, 0) -ff111111 +ff:11:11:11 // bitmap.getPixel32(22, 0) -ff2d2d2d +ff:2d:2d:2d // bitmap.getPixel32(23, 0) -ff555 +ff:5:5:5 // bitmap.getPixel32(24, 0) -ff585858 +ff:58:58:58 // bitmap.getPixel32(25, 0) -fff5f5f5 +ff:f5:f5:f5 // bitmap.getPixel32(26, 0) -ff6b6b6b +ff:6b:6b:6b // bitmap.getPixel32(27, 0) -ffd6d6d6 +ff:d6:d6:d6 // bitmap.getPixel32(28, 0) -ff888888 +ff:88:88:88 // bitmap.getPixel32(29, 0) -ff777 +ff:7:7:7 // bitmap.getPixel32(30, 0) -ff999999 +ff:99:99:99 // bitmap.getPixel32(31, 0) -ff929292 +ff:92:92:92 // bitmap.getPixel32(32, 0) -ff484848 +ff:48:48:48 // bitmap.getPixel32(33, 0) -ff333333 +ff:33:33:33 // bitmap.getPixel32(34, 0) -ff626262 +ff:62:62:62 // bitmap.getPixel32(35, 0) -ff414141 +ff:41:41:41 // bitmap.getPixel32(36, 0) -fff3f3f3 +ff:f3:f3:f3 // bitmap.getPixel32(37, 0) -ffddd +ff:d:d:d // bitmap.getPixel32(38, 0) -ff232323 +ff:23:23:23 // bitmap.getPixel32(39, 0) -ffe5e5e5 +ff:e5:e5:e5 // bitmap.getPixel32(40, 0) -ff5f5f5f +ff:5f:5f:5f // bitmap.getPixel32(41, 0) -ff303030 +ff:30:30:30 // bitmap.getPixel32(42, 0) -ffd1d1d1 +ff:d1:d1:d1 // bitmap.getPixel32(43, 0) -ffc8c8c8 +ff:c8:c8:c8 // bitmap.getPixel32(44, 0) -ffededed +ff:ed:ed:ed // bitmap.getPixel32(45, 0) -ff616161 +ff:61:61:61 // bitmap.getPixel32(46, 0) -ffccc +ff:c:c:c // bitmap.getPixel32(47, 0) -ff4b4b4b +ff:4b:4b:4b // bitmap.getPixel32(48, 0) -ff222 +ff:2:2:2 // bitmap.getPixel32(49, 0) -ff353535 +ff:35:35:35 // bitmap.getPixel32(50, 0) -ff393939 +ff:39:39:39 // bitmap.getPixel32(51, 0) -ff818181 +ff:81:81:81 // bitmap.getPixel32(52, 0) -ff848484 +ff:84:84:84 // bitmap.getPixel32(53, 0) -ffb8b8b8 +ff:b8:b8:b8 // bitmap.getPixel32(54, 0) -ff141414 +ff:14:14:14 // bitmap.getPixel32(55, 0) -ffa2a2a2 +ff:a2:a2:a2 // bitmap.getPixel32(56, 0) -ff9c9c9c +ff:9c:9c:9c // bitmap.getPixel32(57, 0) -ffb4b4b4 +ff:b4:b4:b4 // bitmap.getPixel32(58, 0) -ff5a5a5a +ff:5a:5a:5a // bitmap.getPixel32(59, 0) -ff676767 +ff:67:67:67 // bitmap.getPixel32(60, 0) -ff2a2a2a +ff:2a:2a:2a // bitmap.getPixel32(61, 0) -ffcacaca +ff:ca:ca:ca // bitmap.getPixel32(62, 0) -ffe5e5e5 +ff:e5:e5:e5 // bitmap.getPixel32(63, 0) -ff484848 +ff:48:48:48 // bitmap.getPixel32(64, 0) -ffe9e9e9 +ff:e9:e9:e9 // bitmap.getPixel32(65, 0) -ffc5c5c5 +ff:c5:c5:c5 // bitmap.getPixel32(66, 0) -fff1f1f1 +ff:f1:f1:f1 // bitmap.getPixel32(67, 0) -ffb0b0b0 +ff:b0:b0:b0 // bitmap.getPixel32(68, 0) -ffc4c4c4 +ff:c4:c4:c4 // bitmap.getPixel32(69, 0) -ff151515 +ff:15:15:15 // bitmap.getPixel32(70, 0) -ff8a8a8a +ff:8a:8a:8a // bitmap.getPixel32(71, 0) -ffe5e5e5 +ff:e5:e5:e5 // bitmap.getPixel32(72, 0) -ff9b9b9b +ff:9b:9b:9b // bitmap.getPixel32(73, 0) -ff4d4d4d +ff:4d:4d:4d // bitmap.getPixel32(74, 0) -ff393939 +ff:39:39:39 // bitmap.getPixel32(75, 0) -fff6f6f6 +ff:f6:f6:f6 // bitmap.getPixel32(76, 0) -fff7f7f7 +ff:f7:f7:f7 // bitmap.getPixel32(77, 0) -ffe8e8e8 +ff:e8:e8:e8 // bitmap.getPixel32(78, 0) -ffa1a1a1 +ff:a1:a1:a1 // bitmap.getPixel32(79, 0) -ff555 +ff:5:5:5 // bitmap.getPixel32(80, 0) -ffd3d3d3 +ff:d3:d3:d3 // bitmap.getPixel32(81, 0) -fffefefe +ff:fe:fe:fe // bitmap.getPixel32(82, 0) -ffededed +ff:ed:ed:ed // bitmap.getPixel32(83, 0) -ffa5a5a5 +ff:a5:a5:a5 // bitmap.getPixel32(84, 0) -ffd5d5d5 +ff:d5:d5:d5 // bitmap.getPixel32(85, 0) -fff3f3f3 +ff:f3:f3:f3 // bitmap.getPixel32(86, 0) -ffd9d9d9 +ff:d9:d9:d9 // bitmap.getPixel32(87, 0) -ffe4e4e4 +ff:e4:e4:e4 // bitmap.getPixel32(88, 0) -ff5b5b5b +ff:5b:5b:5b // bitmap.getPixel32(89, 0) -fffafafa +ff:fa:fa:fa // bitmap.getPixel32(90, 0) -ff6c6c6c +ff:6c:6c:6c // bitmap.getPixel32(91, 0) -ffc3c3c3 +ff:c3:c3:c3 // bitmap.getPixel32(92, 0) -ff515151 +ff:51:51:51 // bitmap.getPixel32(93, 0) -ffe2e2e2 +ff:e2:e2:e2 // bitmap.getPixel32(94, 0) -ff202020 +ff:20:20:20 // bitmap.getPixel32(95, 0) -ffaeaeae +ff:ae:ae:ae // bitmap.getPixel32(96, 0) -ffccc +ff:c:c:c // bitmap.getPixel32(97, 0) -ffe1e1e1 +ff:e1:e1:e1 // bitmap.getPixel32(98, 0) -ff666 +ff:6:6:6 // bitmap.getPixel32(99, 0) -ff989898 +ff:98:98:98 // noise(0) // bitmap.getPixel32(0, 0) -ffa7a7a7 +ff:a7:a7:a7 // bitmap.getPixel32(0, 1) -ff2a2a2a +ff:2a:2a:2a // bitmap.getPixel32(0, 2) -ffd8d8d8 +ff:d8:d8:d8 // bitmap.getPixel32(1, 0) -fff1f1f1 +ff:f1:f1:f1 // bitmap.getPixel32(1, 1) -ff828282 +ff:82:82:82 // bitmap.getPixel32(1, 2) -fffefefe +ff:fe:fe:fe // bitmap.getPixel32(2, 0) -ffd9d9d9 +ff:d9:d9:d9 // bitmap.getPixel32(2, 1) -ffc8c8c8 +ff:c8:c8:c8 // bitmap.getPixel32(2, 2) -ff434343 +ff:43:43:43 // noise(-1) without transparency // bitmap.getPixel32(0, 0) -ff4e4e4e +ff:4e:4e:4e // bitmap.getPixel32(0, 1) -ff545454 +ff:54:54:54 // bitmap.getPixel32(0, 2) -ffb0b0b0 +ff:b0:b0:b0 // bitmap.getPixel32(1, 0) -ffe2e2e2 +ff:e2:e2:e2 // bitmap.getPixel32(1, 1) -ff555 +ff:5:5:5 // bitmap.getPixel32(1, 2) -fffdfdfd +ff:fd:fd:fd // bitmap.getPixel32(2, 0) -ffb3b3b3 +ff:b3:b3:b3 // bitmap.getPixel32(2, 1) -ff909090 +ff:90:90:90 // bitmap.getPixel32(2, 2) -ff878787 +ff:87:87:87 +// noise(0) +// bitmap.getPixel32(0, 0) +ff:4e:e2:b3 +// bitmap.getPixel32(0, 1) +ff:9b:30:ab +// bitmap.getPixel32(0, 2) +ff:30:a8:5e +// bitmap.getPixel32(1, 0) +ff:54:5:90 +// bitmap.getPixel32(1, 1) +ff:19:c4:66 +// bitmap.getPixel32(1, 2) +ff:23:5b:b +// bitmap.getPixel32(2, 0) +ff:b0:fd:87 +// bitmap.getPixel32(2, 1) +ff:8f:2f:22 +// bitmap.getPixel32(2, 2) +ff:b1:eb:d6 +// noise(0) +// bitmap.getPixel32(0, 0) +ff:4e:e2:b3 +// bitmap.getPixel32(0, 1) +ff:30:a8:5e +// bitmap.getPixel32(0, 2) +ff:e7:1b:47 +// bitmap.getPixel32(0, 3) +ff:28:44:38 +// bitmap.getPixel32(0, 4) +ff:36:9b:73 +// bitmap.getPixel32(0, 5) +ff:d8:86:a2 +// bitmap.getPixel32(1, 0) +ff:54:5:90 +// bitmap.getPixel32(1, 1) +ff:23:5b:b +// bitmap.getPixel32(1, 2) +ff:ca:be:61 +// bitmap.getPixel32(1, 3) +ff:69:b5:ce +// bitmap.getPixel32(1, 4) +ff:ec:ef:d0 +// bitmap.getPixel32(1, 5) +ff:c5:41:5d +// bitmap.getPixel32(2, 0) +ff:b0:fd:87 +// bitmap.getPixel32(2, 1) +ff:b1:eb:d6 +// bitmap.getPixel32(2, 2) +ff:a3:91:db +// bitmap.getPixel32(2, 3) +ff:55:95:cb +// bitmap.getPixel32(2, 4) +ff:43:b:a7 +// bitmap.getPixel32(2, 5) +ff:18:c3:c +// bitmap.getPixel32(3, 0) +ff:9b:30:ab +// bitmap.getPixel32(3, 1) +ff:ad:10:f +// bitmap.getPixel32(3, 2) +ff:c2:19:97 +// bitmap.getPixel32(3, 3) +ff:90:d3:8a +// bitmap.getPixel32(3, 4) +ff:fc:da:4b +// bitmap.getPixel32(3, 5) +ff:30:db:c2 +// bitmap.getPixel32(4, 0) +ff:19:c4:66 +// bitmap.getPixel32(4, 1) +ff:33:25:90 +// bitmap.getPixel32(4, 2) +ff:4:6a:73 +// bitmap.getPixel32(4, 3) +ff:e2:60:89 +// bitmap.getPixel32(4, 4) +ff:ab:e7:b3 +// bitmap.getPixel32(4, 5) +ff:fe:68:42 +// bitmap.getPixel32(5, 0) +ff:8f:2f:22 +// bitmap.getPixel32(5, 1) +ff:66:c5:82 +// bitmap.getPixel32(5, 2) +ff:2:8:70 +// bitmap.getPixel32(5, 3) +ff:2a:15:ca +// bitmap.getPixel32(5, 4) +ff:c9:b7:f5 +// bitmap.getPixel32(5, 5) +ff:3d:33:fa diff --git a/core/tests/swfs/avm1/bitmap_data_noise/test.fla b/core/tests/swfs/avm1/bitmap_data_noise/test.fla index e02fd1898..3fc588e81 100644 Binary files a/core/tests/swfs/avm1/bitmap_data_noise/test.fla and b/core/tests/swfs/avm1/bitmap_data_noise/test.fla differ diff --git a/core/tests/swfs/avm1/bitmap_data_noise/test.swf b/core/tests/swfs/avm1/bitmap_data_noise/test.swf index f021d8750..0cbb2f23c 100644 Binary files a/core/tests/swfs/avm1/bitmap_data_noise/test.swf and b/core/tests/swfs/avm1/bitmap_data_noise/test.swf differ