From 05c157651039cd5db2d73ad8ea6634fb9408e5f2 Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Thu, 26 Dec 2024 00:21:52 +0100 Subject: [PATCH] tests: Add avm2/bitmapdata_draw_cpu_overwrite_gpu test --- .../bitmapdata_draw_cpu_overwrite_gpu/Test.as | 39 ++++++++++++++++++ .../TestFont.ttf | Bin 0 -> 1600 bytes .../output.expected.png | Bin 0 -> 230 bytes .../output.txt | 0 .../test.swf | Bin 0 -> 1824 bytes .../test.toml | 7 ++++ 6 files changed, 46 insertions(+) create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/Test.as create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/TestFont.ttf create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.expected.png create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.txt create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.swf create mode 100644 tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.toml diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/Test.as b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/Test.as new file mode 100644 index 000000000000..d12498535eeb --- /dev/null +++ b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/Test.as @@ -0,0 +1,39 @@ +package { +import flash.display.*; +import flash.text.*; +import flash.geom.*; +import flash.utils.*; + +/** + * In this test we're doing: + * 1. draw (GPU) + * 2. full fill (CPU) + * 3. draw (GPU) + * + * And we're verifying whether these operations are properly + * synchronized, especially the "CPU overwriting GPU" part (1 vs 2). + */ +[SWF(width="50", height="50")] +public class Test extends MovieClip { + [Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")] + private var TestFont:Class; + + public function Test() { + var bd = new BitmapData(50, 50); + + var tf = new TextField(); + tf.defaultTextFormat = new TextFormat("TestFont", 20); + tf.embedFonts = true; + tf.text = "ab"; + + var mx = new Matrix(); + bd.draw(tf, mx); + bd.fillRect(new Rectangle(0, 0, 100, 100), 0); + + mx.translate(20, 0); + bd.draw(tf, mx); + + addChild(new Bitmap(bd)); + } +} +} diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/TestFont.ttf b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/TestFont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..761128c1eb3c323d499229f8c34f7523983545de GIT binary patch literal 1600 zcmcgsOK4L;6g~4kX-ma^u!vA)9v1tdO<$5?t7K8s#!nGNLlIHzYnmp3{CG*Fbs;WA zL|loe3lYJc*n%MFJ}zB|t1e1cF6>g=RN|SJX>Gd@x^W)EoO|xQGw03R83+LTaStY@ z6N%)-H_u=80-+wV-Dl5CB+!Kew40TE>FRKF>h#FD9KThYr+ zA+Zr(<`%9;V;xRMZ>-~}BU--KYR0qQbB=LMZ*x#}JS&DcrrcOnoxjUnRuxG^U&QGO ze5wF=Yu|1iki;pC1#56#V}lAGX>6hgs~THq76&!9(I&<<4w0Wx6=JDc9A|G}fp(-c zHn{FxjZK`x6OApj3tM9wM}*WkME){Pql7XR;Uk9(vZz9$k8}2OjKXCf;r*1DWStin zlPA7F>@%;TZt&?+dC|{hvQ^oa>X%VBIx;9Hy+ST8FL-{b!iXf&46P!;lp;qY)0JwX zR3y4WSBATi4`#%bbY?#9`Pd3oDLy08ftoP&NStKfJ!ON9A%Y={vTrJfS|(BQGiezO zyYi&mT$(Tz85$i@djF|#ifj9np9{oGDsZ`qQldUgrTt2-RFtk83A-+d-O9H8EKg0} v)cSiW)YZlDZ{sV(6E|4R6AJO}8@dAcs`9;8mr~6kbk}pNS$!mSzL$RhFdoS* literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.expected.png b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..4d270133f67b67fde1a7e8e8cfd0464752a4cc28 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2nC-mUKs7M+SzC{oH>NS%G}U;vjb? z#+xT~>VX`EWRD45bDP46hOx7_4S6Fo+k-*%fF5lt}S( zaSX}0_x8FY*8u|#mID%>{_Ee4ey5}xlJ=gH=T)MzaWU_SIOn2!zburZ-mmU9N>fsR xgI^xjcOON*H4fu`l5hU$Yj32k04A6)n?3IiZ!%ZCG0;s644$rjF6*2UngD$sKwSU; literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.txt b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/output.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.swf b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.swf new file mode 100644 index 0000000000000000000000000000000000000000..ddb2e0e4dbffb70e67205f2fb6f894d9827aa26e GIT binary patch literal 1824 zcmV+*2jBQZS5qm+3;+Ol0j*ZeZ`;TfpBa9PD1S+|Ov`ezRyNvrleI-!vc0jBb>mub z8yA}tQMMZ_%o<~HXtAM0fuv%kK+z)Txu>3b>t7O}Knt{o!pUN{*P^FIFVO^!U-D6-f( zjw`kp)f0BD_KD|)bsh}9Q}vzbj0NyPzumOsNMpkbMPXJ8IE(!MX*5t1CLU{^w%IA) z<;~;Is`&ClkNVm~GdGqGY7fA`WRCwgnlRuZCOc46rKXvq5nEf&Nh=&n+GkYI| z82uV)VtwE@BSgR?hi;(!7L*y9`3s_dK=iMO{s}bm8(07FE3y6!TF%0np%aAepj4T{ zcqf4pAY0Wj8amteTh9Xbv>xR@tX+>!x|;tHYq(zikOhADbMzwfg)AaKu?xd(nj?Mh8AwC~sWpR~WPX6JD(O4P&obHcFER+O!WM>Bi9QT#$wp{)PL&oea~%W#^u#k;6}VKF0Awde{k|MUW@i2E6i>3V0m2W zUNhnWt3~cp-cwu}-yd^wskg_UidNmZD_&xsMbK|Sk~dDcEwUdHb|MRS)K6IyxEA&vS)9YUxm+eUpVM;-xvc&X zNn;|(ib@k&a$<67dM1@#q(r7zp^`@B2`W!%(^y-?+7hOTOWI`^-_w?{mdBJ_q0;-5 z6ez(|`jC?AboK_7R;jc`r6QFK=wt$YaTOkd8~-x+1EHh zE_ZcHDwGPPLy0{9s++asLm55)y1V$wQdX5h=1?I_?dD!xW3;>UYBk3a-OHACsG;Y7 z>%RB$)t3iJa=p9!(wZnB__GW4;e=d32a_PZ@?{|d(iu?$e0`joCaX-3YKazFR@Wv-zu&bO;r7kz#c{e zSTDU5qA}c7tH5N<(|4n5-rO3=#2`7^(8sNdYfVDGjMqAQ2QE1xXrCPR!!u9K17FRx}k$qLT3eCNgAN zxPcrKXmA*0W%}HFjR{)%DPEQ9BI6iiMNNIHb{)vN+O0#2ciny^$X8<7BTKcYLrqI@ zlz0&RQ!FKX)r{=Y7xG3T3 zcqh2={ZZc7{;z2*-P}@R+Lp6ePXJD8Os3EU(JA7!g(HfoOL30c+ zRX_WVdSk>lbO##XKQSWzKYCZvrG$bA#WKV%?ja~YxGfM#hzTYXs;NgOi*p1v$0`BT O#Twm#$-e=P?v=VHmyGKG literal 0 HcmV?d00001 diff --git a/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.toml b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.toml new file mode 100644 index 000000000000..7c8574cf4c61 --- /dev/null +++ b/tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/test.toml @@ -0,0 +1,7 @@ +num_ticks = 1 + +[image_comparisons.output] +tolerance = 0 + +[player_options] +with_renderer = { optional = false, sample_count = 4 }