Skip to content

Commit

Permalink
tests: Add avm2/bitmapdata_draw_cpu_overwrite_gpu test
Browse files Browse the repository at this point in the history
  • Loading branch information
kjarosh authored and torokati44 committed Dec 26, 2024
1 parent 21bdfdd commit 05c1576
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/tests/swfs/avm2/bitmapdata_draw_cpu_overwrite_gpu/Test.as
Original file line number Diff line number Diff line change
@@ -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));
}
}
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_ticks = 1

[image_comparisons.output]
tolerance = 0

[player_options]
with_renderer = { optional = false, sample_count = 4 }

0 comments on commit 05c1576

Please sign in to comment.