Skip to content

Commit 7b9ae51

Browse files
committed
Removed duplicate polyfills.
1 parent 41e2fbf commit 7b9ae51

1 file changed

Lines changed: 0 additions & 143 deletions

File tree

src/pixi/utils/Utils.js

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,6 @@
22
* @author Mat Groves http://matgroves.com/ @Doormat23
33
*/
44

5-
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
6-
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
7-
8-
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
9-
10-
// MIT license
11-
12-
/**
13-
* A polyfill for requestAnimationFrame
14-
* You can actually use both requestAnimationFrame and requestAnimFrame,
15-
* you will still benefit from the polyfill
16-
*
17-
* @method requestAnimationFrame
18-
*/
19-
20-
/**
21-
* A polyfill for cancelAnimationFrame
22-
*
23-
* @method cancelAnimationFrame
24-
*/
25-
(function(window) {
26-
var lastTime = 0;
27-
var vendors = ['ms', 'moz', 'webkit', 'o'];
28-
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
29-
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
30-
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
31-
window[vendors[x] + 'CancelRequestAnimationFrame'];
32-
}
33-
34-
if (!window.requestAnimationFrame) {
35-
window.requestAnimationFrame = function(callback) {
36-
var currTime = new Date().getTime();
37-
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
38-
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
39-
timeToCall);
40-
lastTime = currTime + timeToCall;
41-
return id;
42-
};
43-
}
44-
45-
if (!window.cancelAnimationFrame) {
46-
window.cancelAnimationFrame = function(id) {
47-
clearTimeout(id);
48-
};
49-
}
50-
51-
window.requestAnimFrame = window.requestAnimationFrame;
52-
})(this);
53-
545
/**
556
* Converts a hex color number to an [R, G, B] array
567
*
@@ -71,100 +22,6 @@ PIXI.rgb2hex = function(rgb) {
7122
return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255);
7223
};
7324

74-
/**
75-
* A polyfill for Function.prototype.bind
76-
*
77-
* @method bind
78-
*/
79-
if (typeof Function.prototype.bind !== 'function') {
80-
Function.prototype.bind = (function () {
81-
return function (thisArg) {
82-
var target = this, i = arguments.length - 1, boundArgs = [];
83-
if (i > 0)
84-
{
85-
boundArgs.length = i;
86-
while (i--) boundArgs[i] = arguments[i + 1];
87-
}
88-
89-
if (typeof target !== 'function') throw new TypeError();
90-
91-
function bound() {
92-
var i = arguments.length, args = new Array(i);
93-
while (i--) args[i] = arguments[i];
94-
args = boundArgs.concat(args);
95-
return target.apply(this instanceof bound ? this : thisArg, args);
96-
}
97-
98-
bound.prototype = (function F(proto) {
99-
if (proto) F.prototype = proto;
100-
if (!(this instanceof F)) return new F();
101-
})(target.prototype);
102-
103-
return bound;
104-
};
105-
})();
106-
}
107-
108-
/**
109-
* A wrapper for ajax requests to be handled cross browser
110-
*
111-
* @class AjaxRequest
112-
* @constructor
113-
*/
114-
PIXI.AjaxRequest = function()
115-
{
116-
var activexmodes = ['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.3.0', 'Microsoft.XMLHTTP']; //activeX versions to check for in IE
117-
118-
if (window.ActiveXObject)
119-
{ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
120-
for (var i=0; i<activexmodes.length; i++)
121-
{
122-
try{
123-
return new window.ActiveXObject(activexmodes[i]);
124-
}
125-
catch(e) {
126-
//suppress error
127-
}
128-
}
129-
}
130-
else if (window.XMLHttpRequest) // if Mozilla, Safari etc
131-
{
132-
return new window.XMLHttpRequest();
133-
}
134-
else
135-
{
136-
return false;
137-
}
138-
};
139-
/*
140-
PIXI.packColorRGBA = function(r, g, b, a)//r, g, b, a)
141-
{
142-
// console.log(r, b, c, d)
143-
return (Math.floor((r)*63) << 18) | (Math.floor((g)*63) << 12) | (Math.floor((b)*63) << 6);// | (Math.floor((a)*63))
144-
// i = i | (Math.floor((a)*63));
145-
// return i;
146-
// var r = (i / 262144.0 ) / 64;
147-
// var g = (i / 4096.0)%64 / 64;
148-
// var b = (i / 64.0)%64 / 64;
149-
// var a = (i)%64 / 64;
150-
151-
// console.log(r, g, b, a);
152-
// return i;
153-
154-
};
155-
*/
156-
/*
157-
PIXI.packColorRGB = function(r, g, b)//r, g, b, a)
158-
{
159-
return (Math.floor((r)*255) << 16) | (Math.floor((g)*255) << 8) | (Math.floor((b)*255));
160-
};
161-
162-
PIXI.unpackColorRGB = function(r, g, b)//r, g, b, a)
163-
{
164-
return (Math.floor((r)*255) << 16) | (Math.floor((g)*255) << 8) | (Math.floor((b)*255));
165-
};
166-
*/
167-
16825
/**
16926
* Checks whether the Canvas BlendModes are supported by the current browser for drawImage
17027
*

0 commit comments

Comments
 (0)