Permalink
Browse files

Included some bug fixes and performance improvements

  • Loading branch information...
1 parent 9baa8b2 commit 58963277798b1712be5f41f8498f30104f54043c Tobias Schneider committed Jan 30, 2010
Showing with 1,342 additions and 1,312 deletions.
  1. +0 −1 demos/trip.html
  2. +17 −11 gordon.js
  3. +0 −40 src/Color.js
  4. +0 −35 src/Cxform.js
  5. +0 −35 src/Matrix.js
  6. +82 −721 src/Movie.js
  7. +106 −113 src/Stream.js
  8. +262 −244 src/SvgRenderer.js
  9. +11 −5 src/_base.js
  10. +728 −0 src/_parser.js
  11. +0 −107 src/base64.js
  12. +136 −0 src/worker.js
View
@@ -4,7 +4,6 @@
<head>
<title>Gordon: An open source Flash™ runtime written in pure JavaScript</title>
<script type="text/javascript" src="../gordon.js"></script>
- <script type="text/javascript" src="../src/Movie.js"></script>
</head>
<body onload="new Gordon.Movie('trip.swf', {id: 'stage', width: 500, height: 400})">
<div id="stage"></div>
View
@@ -9,11 +9,14 @@
var _g = Gordon = {};
var _loadedUrls = {};
- var scripts = document.getElementsByTagName("script");
- var i = scripts.length;
- while(i--){
- var match = scripts[i].src.match(/(^|.*\/)gordon\.js$/);
- if(match){ _g.ROOT = match[1]; }
+ if(self.importScripts){ _g.ROOT = "../"; }
+ else{
+ var scripts = document.getElementsByTagName("script");
+ var i = scripts.length;
+ while(i--){
+ var match = scripts[i].src.match(/(^|.*\/)gordon\.js$/);
+ if(match){ _g.ROOT = match[1]; }
+ }
}
_g.xhr = function(){
@@ -25,17 +28,20 @@
_g.require = function(url){
if(!url.match(/\.([^\/]*)$/)){ url += ".js"; }
if(!_loadedUrls[url]){
- with(_g.xhr("GET", _g.ROOT + url, false)){
- send(null);
- if(status == 200){
- eval(responseText);
- _loadedUrls[url] = true;
+ if(self.importScripts){ importScripts(_g.ROOT + url); }
+ else{
+ with(_g.xhr("GET", _g.ROOT + url, false)){
+ send(null);
+ if(200 == status){
+ eval(responseText);
+ _loadedUrls[url] = true;
+ }else{ throw new Error("Unable to load " + url + " status: " + status); }
}
- else{ throw new Error("Unable to load " + url + " status: " + status); }
}
}
}
})();
Gordon.require("src/_base");
+Gordon.require("src/worker");
Gordon.require("src/Movie");
View
@@ -1,40 +0,0 @@
-/*
- * Gordon: An open source Flash™ runtime written in pure JavaScript
- *
- * Copyright (c) 2010 Tobias Schneider
- * Gordon is freely distributable under the terms of the MIT license.
- */
-
-(function(){
- var _g = Gordon;
- var _properties = {
- r: 255,
- g: 255,
- b: 255,
- a: 1
- };
-
- _g.Color = function(color){
- if(typeof color == "string"){
- var match = color.match(/^#([0-9,a-z]{2})([0-9,a-z]{2})([0-9,a-z]{2})/i);
- if(match){ color = {
- r: parseInt(match[1], 16),
- g: parseInt(match[2], 16),
- b: parseInt(match[3], 16)
- }; }
- }
- for(var p in _properties){ this[p] = isNaN(color[p]) ? _properties[p] : color[p]; }
- };
- _g.Color.prototype = {
- toArray: function(withAlpha){
- var t = this;
- var array = [t.r, t.g, t.b];
- if(withAlpha){ array.push(t.a); }
- return array;
- },
-
- toString: function(withAlpha){
- return "rgb" + (withAlpha ? 'a' : '') + '(' + this.toArray(withAlpha).join(", ") + ')';
- }
- };
-})();
View
@@ -1,35 +0,0 @@
-/*
- * Gordon: An open source Flash™ runtime written in pure JavaScript
- *
- * Copyright (c) 2010 Tobias Schneider
- * Gordon is freely distributable under the terms of the MIT license.
- */
-
-(function(){
- var _g = Gordon;
- var _properties = {
- multR: 1.0,
- multG: 1.0,
- multB: 1.0,
- multA: 1.0,
- addR: 0.0,
- addG: 0.0,
- addB: 0.0,
- addA: 0.0
- };
-
- _g.Cxform = function(cxform){
- for(var p in _properties){ this[p] = isNaN(cxform[p]) ? _properties[p] : cxform[p]; }
- };
- _g.Cxform.prototype = {
- toArray: function(){
- with(this){
- return [multR, 0, 0, 0, addR, 0, multG, 0, 0, addG, 0, 0, multB, 0, addB, 0, 0, 0, multA, addA];
- }
- },
-
- toString: function(){
- return this.toArray().join(' ');
- }
- };
-})();
View
@@ -1,35 +0,0 @@
-/*
- * Gordon: An open source Flash™ runtime written in pure JavaScript
- *
- * Copyright (c) 2010 Tobias Schneider
- * Gordon is freely distributable under the terms of the MIT license.
- */
-
-(function(){
- var _g = Gordon;
- var _properties = {
- scaleX: 1.0,
- scaleY: 1.0,
- skewX: 0.0,
- skewY: 0.0,
- moveX: 0,
- moveY: 0
- };
-
- _g.Matrix = function(matrix){
- for(var p in _properties){ this[p] = isNaN(matrix[p]) ? _properties[p] : matrix[p]; }
- };
- _g.Matrix.prototype = {
- toArray: function(){
- with(this){
- return [scaleX, skewX, skewY, scaleY, moveX, moveY];
- }
- },
-
- toString: function(){
- with(this){
- return "matrix(" + this.toArray().join(' ') + ')';
- }
- }
- };
-})();
Oops, something went wrong.

0 comments on commit 5896327

Please sign in to comment.