<commit_before>package ;

import flambe.display.Texture;
import flambe.Entity;
import flambe.System;
import flambe.asset.AssetPack;
import flambe.asset.Manifest;
import flambe.display.FillSprite;
import flambe.display.ImageSprite;
import haxe.Timer;
import hxPixels.Pixels;

#if flash
@:bitmap("assets/global/galapagosColor.png")
class GalapagosColor extends flash.display.BitmapData { }
#end

class FlambeAbstractPixelsDemo
{
    private static function main ()
    {
        // Wind up all platform-specific stuff
        System.init();

        // Load up the compiled pack in the assets directory named "global"
        var manifest = Manifest.fromAssets("global");
        var loader = System.loadAssetPack(manifest);
        loader.get(onSuccess);
    }

    private static function onSuccess (pack :AssetPack)
    {
        // Add a solid color background
        var background = new FillSprite(0xffffff, System.stage.width, System.stage.height).setXY(0, 0);
        System.root.addChild(new Entity().add(background));

        var texture:Texture = pack.getTexture("galapagosColor");
		
		// show the sprite
        var sprite = new ImageSprite(texture).centerAnchor().setXY(System.stage.width/2, System.stage.height/2);
        var entity = new Entity().add(sprite);
		System.root.addChild(entity);
		
		// load texture into pixels abstract
		var startTime = Timer.stamp();
	#if html
		var pixels:Pixels = texture;
	#else
		var bitmapData = new GalapagosColor(0, 0);
		var pixels:Pixels = bitmapData;
	#end
		trace("load", Timer.stamp() - startTime);
		
		// add random red points
		startTime = Timer.stamp();
		for (i in 0...10000) {
			pixels.setPixel32(Std.int(Math.random() * pixels.width), Std.int(Math.random() * pixels.height), 0xFFFF0000);
		}
		trace("set", Timer.stamp() - startTime);
		
		// apply the modified pixels back to texture
		startTime = Timer.stamp();
	#if	html
		pixels.applyTo(texture);
	#else
		pixels.applyTo(bitmapData);
		entity.remove(sprite);
		texture = System.renderer.createTextureFromImage(bitmapData);
        sprite = new ImageSprite(texture).centerAnchor().setXY(System.stage.width/2, System.stage.height/2);
        entity.add(sprite);
	#end
		trace("apply", Timer.stamp() - startTime);
    }
}<commit_msg>[flambe] trace via external interface<commit_after>package ;

import flambe.display.Texture;
import flambe.Entity;
import flambe.System;
import flambe.asset.AssetPack;
import flambe.asset.Manifest;
import flambe.display.FillSprite;
import flambe.display.ImageSprite;
import haxe.Timer;
import hxPixels.Pixels;

#if flash
@:bitmap("assets/global/galapagosColor.png")
class GalapagosColor extends flash.display.BitmapData { }
#end

class FlambeAbstractPixelsDemo
{
    private static function main ()
    {
        // Wind up all platform-specific stuff
        System.init();

        // Load up the compiled pack in the assets directory named "global"
        var manifest = Manifest.fromAssets("global");
        var loader = System.loadAssetPack(manifest);
        loader.get(onSuccess);
    }

    private static function onSuccess (pack :AssetPack)
    {
        // Add a solid color background
        var background = new FillSprite(0xffffff, System.stage.width, System.stage.height).setXY(0, 0);
        System.root.addChild(new Entity().add(background));

        var texture:Texture = pack.getTexture("galapagosColor");
		
		// show the sprite
        var sprite = new ImageSprite(texture).centerAnchor().setXY(System.stage.width/2, System.stage.height/2);
        var entity = new Entity().add(sprite);
		System.root.addChild(entity);
		
		// load texture into pixels abstract
		var startTime = Timer.stamp();
	#if html
		var pixels:Pixels = texture;
	#else
		var bitmapData = new GalapagosColor(0, 0);
		var pixels:Pixels = bitmapData;
	#end
		log("load " + (Timer.stamp() - startTime));
		
		// add random red points
		startTime = Timer.stamp();
		for (i in 0...10000) {
			pixels.setPixel32(Std.int(Math.random() * pixels.width), Std.int(Math.random() * pixels.height), 0xFFFF0000);
		}
		log("set " + (Timer.stamp() - startTime));
		
		// apply the modified pixels back to texture
		startTime = Timer.stamp();
	#if	html
		pixels.applyTo(texture);
	#else
		pixels.applyTo(bitmapData);
		entity.remove(sprite);
		texture = System.renderer.createTextureFromImage(bitmapData);
        sprite = new ImageSprite(texture).centerAnchor().setXY(System.stage.width/2, System.stage.height/2);
        entity.add(sprite);
	#end
		log("apply " + (Timer.stamp() - startTime));
    }
	
	static public function log(x:Dynamic):Void {
	#if flash
		flash.external.ExternalInterface.call("console.log", x);
	#else
		trace(x);
	#end
	}
}
{'fraction_non_alphanumeric': 0.1263877028181042, 'fraction_numerical': 0.009393680614859094, 'mean_word_length': 3.5618305744888024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3807314', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1481, 'n_words': 341}