Skip to content

Commit

Permalink
updated .gitignore and added more performance tests around image crop…
Browse files Browse the repository at this point in the history
…ping and scaling in order to understand the value of a SpriteSheet plugin
  • Loading branch information
ericdrowell committed Dec 10, 2012
1 parent 2915831 commit 9b7f0ea
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
jsdoc-toolkit
dist
tests/js/unitTests.js
analysis

# Numerous always-ignore extensions
*.diff
Expand Down
66 changes: 64 additions & 2 deletions tests/js/performanceTests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Test.Modules.PERFORMANCE = {
'*draw 1000 cropped images': function(containerId) {
'draw 1000 cropped and scaled images': function(containerId) {
var imageObj = new Image();
imageObj.onload = function() {
var stage = new Kinetic.Stage({
Expand All @@ -25,13 +25,75 @@ Test.Modules.PERFORMANCE = {
layer.add(darth);
}

stage.add(layer);
endTimer('draw 1000 cropped and scaled images');

};
imageObj.src = '../assets/darth-vader.jpg';
},
'draw 1000 cropped images': function(containerId) {
var imageObj = new Image();
imageObj.onload = function() {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();

startTimer();
for(var n = 0; n < 1000; n++) {
var darth = new Kinetic.Image({
x: 200,
y: 75,
image: imageObj,
width: 53,
height: 37,
crop: [186, 211, 292 - 186, 285 - 211],
draggable: true
});

layer.add(darth);
}

stage.add(layer);
endTimer('draw 1000 cropped images');

};
imageObj.src = '../assets/darth-vader.jpg';
},
'*draw 1000 pre-processed cropped images': function(containerId) {
'draw 1000 scaled images': function(containerId) {
var imageObj = new Image();
imageObj.onload = function() {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});
var layer = new Kinetic.Layer();

startTimer();
for(var n = 0; n < 1000; n++) {
var darth = new Kinetic.Image({
x: 200,
y: 75,
image: imageObj,
width: 107,
height: 75,
draggable: true,
scale: 0.5
});

layer.add(darth);
}

stage.add(layer);
endTimer('draw 1000 scaled images');

};
imageObj.src = '../assets/darth-vader.jpg';
},
'*draw 1000 pre-processed cropped and scaled images': function(containerId) {
var imageObj = new Image();
imageObj.onload = function() {
var stage = new Kinetic.Stage({
Expand Down

0 comments on commit 9b7f0ea

Please sign in to comment.